From 73ebd629eaec8bd18b461e26188dce94fcabf5b5 Mon Sep 17 00:00:00 2001 From: Zetazzz Date: Tue, 3 Dec 2024 06:59:47 +0800 Subject: [PATCH] seperate interchain-query and interchainjs --- .telescope.json | 2 +- libs/interchain-query/.eslintignore | 1 + libs/interchain-query/CHANGELOG.md | 176 + libs/interchain-query/README.md | 21 + libs/interchain-query/jest.starship.config.js | 18 + libs/interchain-query/package.json | 55 + libs/interchain-query/src/amino/amino.ts | 1 + libs/interchain-query/src/binary.ts | 534 ++ .../src/cosmos/auth/v1beta1/auth.ts | 550 ++ .../src/cosmos/auth/v1beta1/query.rpc.func.ts | 113 + .../src/cosmos/auth/v1beta1/query.ts | 2033 +++++ .../src/cosmos/authz/v1beta1/authz.ts | 477 ++ .../src/cosmos/authz/v1beta1/tx.rpc.func.ts | 31 + .../src/cosmos/authz/v1beta1/tx.ts | 647 ++ .../src/cosmos/bank/v1beta1/bank.ts | 974 +++ .../src/cosmos/bank/v1beta1/query.rpc.func.ts | 146 + .../src/cosmos/bank/v1beta1/query.ts | 3027 +++++++ .../src/cosmos/bank/v1beta1/tx.rpc.func.ts | 40 + .../src/cosmos/bank/v1beta1/tx.ts | 861 ++ .../src/cosmos/base/abci/v1beta1/abci.ts | 1698 ++++ .../cosmos/base/query/v1beta1/pagination.ts | 361 + .../src/cosmos/base/v1beta1/coin.ts | 439 + .../src/cosmos/crypto/ed25519/keys.ts | 209 + .../crypto/multisig/v1beta1/multisig.ts | 225 + .../src/cosmos/crypto/secp256k1/keys.ts | 203 + .../src/cosmos/crypto/secp256r1/keys.ts | 201 + .../distribution/v1beta1/distribution.ts | 1494 ++++ .../distribution/v1beta1/tx.rpc.func.ts | 67 + .../src/cosmos/distribution/v1beta1/tx.ts | 1478 ++++ .../cosmos/feegrant/v1beta1/tx.rpc.func.ts | 31 + .../src/cosmos/feegrant/v1beta1/tx.ts | 596 ++ .../interchain-query/src/cosmos/gov/v1/gov.ts | 1843 +++++ .../src/cosmos/gov/v1/tx.rpc.func.ts | 67 + libs/interchain-query/src/cosmos/gov/v1/tx.ts | 1655 ++++ .../src/cosmos/gov/v1beta1/gov.ts | 1423 ++++ .../src/cosmos/gov/v1beta1/query.rpc.func.ts | 91 + .../src/cosmos/gov/v1beta1/query.ts | 1749 ++++ .../src/cosmos/gov/v1beta1/tx.rpc.func.ts | 40 + .../src/cosmos/gov/v1beta1/tx.ts | 879 ++ .../src/cosmos/group/v1/tx.rpc.func.ts | 130 + .../src/cosmos/group/v1/tx.ts | 3207 ++++++++ .../src/cosmos/group/v1/types.ts | 2081 +++++ .../src/cosmos/ics23/v1/proofs.ts | 2052 +++++ .../interchain-query/src/cosmos/msg/v1/msg.ts | 1 + .../src/cosmos/query/v1/query.ts | 1 + .../cosmos/staking/v1beta1/query.rpc.func.ts | 157 + .../src/cosmos/staking/v1beta1/query.ts | 3073 +++++++ .../src/cosmos/staking/v1beta1/staking.ts | 3005 +++++++ .../src/cosmos/staking/v1beta1/tx.rpc.func.ts | 67 + .../src/cosmos/staking/v1beta1/tx.ts | 1638 ++++ .../src/cosmos/tx/signing/v1beta1/signing.ts | 688 ++ .../src/cosmos/tx/v1beta1/service.rpc.func.ts | 102 + .../src/cosmos/tx/v1beta1/service.ts | 2294 ++++++ .../src/cosmos/tx/v1beta1/tx.ts | 2029 +++++ .../src/cosmos/upgrade/v1beta1/upgrade.ts | 591 ++ .../src/cosmos/vesting/v1beta1/tx.rpc.func.ts | 31 + .../src/cosmos/vesting/v1beta1/tx.ts | 698 ++ .../src/cosmos/vesting/v1beta1/vesting.ts | 735 ++ .../src/cosmos_proto/cosmos.ts | 341 + .../src/cosmwasm/wasm/v1/query.rpc.func.ts | 135 + .../src/cosmwasm/wasm/v1/query.ts | 2818 +++++++ .../src/cosmwasm/wasm/v1/tx.rpc.func.ts | 157 + .../src/cosmwasm/wasm/v1/tx.ts | 4191 ++++++++++ .../src/cosmwasm/wasm/v1/types.ts | 1120 +++ libs/interchain-query/src/extern.ts | 38 + libs/interchain-query/src/gogoproto/gogo.ts | 1 + .../src/google/api/annotations.ts | 1 + libs/interchain-query/src/google/api/http.ts | 1085 +++ .../src/google/protobuf/any.ts | 331 + .../src/google/protobuf/descriptor.ts | 7068 +++++++++++++++++ .../src/google/protobuf/duration.ts | 225 + .../src/google/protobuf/timestamp.ts | 281 + .../interchain-query/src/helper-func-types.ts | 191 + libs/interchain-query/src/helpers.ts | 259 + .../ibc/applications/transfer/v1/transfer.ts | 137 + .../applications/transfer/v1/tx.rpc.func.ts | 22 + .../src/ibc/applications/transfer/v1/tx.ts | 552 ++ .../src/ibc/core/channel/v1/channel.ts | 1510 ++++ .../src/ibc/core/channel/v1/tx.rpc.func.ts | 175 + .../src/ibc/core/channel/v1/tx.ts | 4866 ++++++++++++ .../src/ibc/core/channel/v1/upgrade.ts | 388 + .../src/ibc/core/client/v1/client.ts | 927 +++ .../src/ibc/core/client/v1/tx.rpc.func.ts | 67 + .../src/ibc/core/client/v1/tx.ts | 1543 ++++ .../src/ibc/core/commitment/v1/commitment.ts | 418 + .../src/ibc/core/connection/v1/connection.ts | 1010 +++ .../src/ibc/core/connection/v1/tx.rpc.func.ts | 49 + .../src/ibc/core/connection/v1/tx.ts | 1365 ++++ .../src/injective/types/v1beta1/account.ts | 110 + libs/interchain-query/src/react-query.ts | 185 + libs/interchain-query/src/registry.ts | 218 + .../src/tendermint/abci/types.ts | 6283 +++++++++++++++ .../src/tendermint/crypto/keys.ts | 103 + .../src/tendermint/crypto/proof.ts | 555 ++ .../src/tendermint/types/block.ts | 131 + .../src/tendermint/types/evidence.ts | 476 ++ .../src/tendermint/types/params.ts | 814 ++ .../src/tendermint/types/types.ts | 2157 +++++ .../src/tendermint/types/validator.ts | 389 + .../src/tendermint/version/types.ts | 219 + libs/interchain-query/src/types.ts | 155 + libs/interchain-query/src/utf8.ts | 148 + libs/interchain-query/src/varint.ts | 488 ++ libs/interchain-query/tsconfig.esm.json | 9 + libs/interchain-query/tsconfig.json | 9 + libs/interchainjs/README.md | 2 - libs/interchainjs/package.json | 2 +- .../src/cosmos/auth/v1beta1/query.rpc.func.ts | 41 - .../src/cosmos/authz/v1beta1/tx.rpc.func.ts | 10 - .../src/cosmos/bank/v1beta1/query.rpc.func.ts | 53 - .../src/cosmos/bank/v1beta1/tx.rpc.func.ts | 13 - .../distribution/v1beta1/tx.rpc.func.ts | 22 - .../cosmos/feegrant/v1beta1/tx.rpc.func.ts | 10 - .../src/cosmos/gov/v1/tx.rpc.func.ts | 22 - .../src/cosmos/gov/v1beta1/query.rpc.func.ts | 33 - .../src/cosmos/gov/v1beta1/tx.rpc.func.ts | 13 - .../src/cosmos/group/v1/tx.rpc.func.ts | 43 - .../cosmos/staking/v1beta1/query.rpc.func.ts | 57 - .../src/cosmos/staking/v1beta1/tx.rpc.func.ts | 22 - .../src/cosmos/tx/v1beta1/service.rpc.func.ts | 37 - .../src/cosmos/vesting/v1beta1/tx.rpc.func.ts | 10 - .../src/cosmwasm/wasm/v1/query.rpc.func.ts | 49 - .../src/cosmwasm/wasm/v1/tx.rpc.func.ts | 52 - .../applications/transfer/v1/tx.rpc.func.ts | 7 - .../src/ibc/core/channel/v1/tx.rpc.func.ts | 58 - .../src/ibc/core/client/v1/tx.rpc.func.ts | 22 - .../src/ibc/core/connection/v1/tx.rpc.func.ts | 16 - package.json | 2 +- scripts/interchain-query.telescope.json | 77 + scripts/interchainjs.telescope.json | 2 +- 130 files changed, 90835 insertions(+), 596 deletions(-) create mode 100644 libs/interchain-query/.eslintignore create mode 100644 libs/interchain-query/CHANGELOG.md create mode 100644 libs/interchain-query/README.md create mode 100644 libs/interchain-query/jest.starship.config.js create mode 100644 libs/interchain-query/package.json create mode 100644 libs/interchain-query/src/amino/amino.ts create mode 100644 libs/interchain-query/src/binary.ts create mode 100644 libs/interchain-query/src/cosmos/auth/v1beta1/auth.ts create mode 100644 libs/interchain-query/src/cosmos/auth/v1beta1/query.rpc.func.ts create mode 100644 libs/interchain-query/src/cosmos/auth/v1beta1/query.ts create mode 100644 libs/interchain-query/src/cosmos/authz/v1beta1/authz.ts create mode 100644 libs/interchain-query/src/cosmos/authz/v1beta1/tx.rpc.func.ts create mode 100644 libs/interchain-query/src/cosmos/authz/v1beta1/tx.ts create mode 100644 libs/interchain-query/src/cosmos/bank/v1beta1/bank.ts create mode 100644 libs/interchain-query/src/cosmos/bank/v1beta1/query.rpc.func.ts create mode 100644 libs/interchain-query/src/cosmos/bank/v1beta1/query.ts create mode 100644 libs/interchain-query/src/cosmos/bank/v1beta1/tx.rpc.func.ts create mode 100644 libs/interchain-query/src/cosmos/bank/v1beta1/tx.ts create mode 100644 libs/interchain-query/src/cosmos/base/abci/v1beta1/abci.ts create mode 100644 libs/interchain-query/src/cosmos/base/query/v1beta1/pagination.ts create mode 100644 libs/interchain-query/src/cosmos/base/v1beta1/coin.ts create mode 100644 libs/interchain-query/src/cosmos/crypto/ed25519/keys.ts create mode 100644 libs/interchain-query/src/cosmos/crypto/multisig/v1beta1/multisig.ts create mode 100644 libs/interchain-query/src/cosmos/crypto/secp256k1/keys.ts create mode 100644 libs/interchain-query/src/cosmos/crypto/secp256r1/keys.ts create mode 100644 libs/interchain-query/src/cosmos/distribution/v1beta1/distribution.ts create mode 100644 libs/interchain-query/src/cosmos/distribution/v1beta1/tx.rpc.func.ts create mode 100644 libs/interchain-query/src/cosmos/distribution/v1beta1/tx.ts create mode 100644 libs/interchain-query/src/cosmos/feegrant/v1beta1/tx.rpc.func.ts create mode 100644 libs/interchain-query/src/cosmos/feegrant/v1beta1/tx.ts create mode 100644 libs/interchain-query/src/cosmos/gov/v1/gov.ts create mode 100644 libs/interchain-query/src/cosmos/gov/v1/tx.rpc.func.ts create mode 100644 libs/interchain-query/src/cosmos/gov/v1/tx.ts create mode 100644 libs/interchain-query/src/cosmos/gov/v1beta1/gov.ts create mode 100644 libs/interchain-query/src/cosmos/gov/v1beta1/query.rpc.func.ts create mode 100644 libs/interchain-query/src/cosmos/gov/v1beta1/query.ts create mode 100644 libs/interchain-query/src/cosmos/gov/v1beta1/tx.rpc.func.ts create mode 100644 libs/interchain-query/src/cosmos/gov/v1beta1/tx.ts create mode 100644 libs/interchain-query/src/cosmos/group/v1/tx.rpc.func.ts create mode 100644 libs/interchain-query/src/cosmos/group/v1/tx.ts create mode 100644 libs/interchain-query/src/cosmos/group/v1/types.ts create mode 100644 libs/interchain-query/src/cosmos/ics23/v1/proofs.ts create mode 100644 libs/interchain-query/src/cosmos/msg/v1/msg.ts create mode 100644 libs/interchain-query/src/cosmos/query/v1/query.ts create mode 100644 libs/interchain-query/src/cosmos/staking/v1beta1/query.rpc.func.ts create mode 100644 libs/interchain-query/src/cosmos/staking/v1beta1/query.ts create mode 100644 libs/interchain-query/src/cosmos/staking/v1beta1/staking.ts create mode 100644 libs/interchain-query/src/cosmos/staking/v1beta1/tx.rpc.func.ts create mode 100644 libs/interchain-query/src/cosmos/staking/v1beta1/tx.ts create mode 100644 libs/interchain-query/src/cosmos/tx/signing/v1beta1/signing.ts create mode 100644 libs/interchain-query/src/cosmos/tx/v1beta1/service.rpc.func.ts create mode 100644 libs/interchain-query/src/cosmos/tx/v1beta1/service.ts create mode 100644 libs/interchain-query/src/cosmos/tx/v1beta1/tx.ts create mode 100644 libs/interchain-query/src/cosmos/upgrade/v1beta1/upgrade.ts create mode 100644 libs/interchain-query/src/cosmos/vesting/v1beta1/tx.rpc.func.ts create mode 100644 libs/interchain-query/src/cosmos/vesting/v1beta1/tx.ts create mode 100644 libs/interchain-query/src/cosmos/vesting/v1beta1/vesting.ts create mode 100644 libs/interchain-query/src/cosmos_proto/cosmos.ts create mode 100644 libs/interchain-query/src/cosmwasm/wasm/v1/query.rpc.func.ts create mode 100644 libs/interchain-query/src/cosmwasm/wasm/v1/query.ts create mode 100644 libs/interchain-query/src/cosmwasm/wasm/v1/tx.rpc.func.ts create mode 100644 libs/interchain-query/src/cosmwasm/wasm/v1/tx.ts create mode 100644 libs/interchain-query/src/cosmwasm/wasm/v1/types.ts create mode 100644 libs/interchain-query/src/extern.ts create mode 100644 libs/interchain-query/src/gogoproto/gogo.ts create mode 100644 libs/interchain-query/src/google/api/annotations.ts create mode 100644 libs/interchain-query/src/google/api/http.ts create mode 100644 libs/interchain-query/src/google/protobuf/any.ts create mode 100644 libs/interchain-query/src/google/protobuf/descriptor.ts create mode 100644 libs/interchain-query/src/google/protobuf/duration.ts create mode 100644 libs/interchain-query/src/google/protobuf/timestamp.ts create mode 100644 libs/interchain-query/src/helper-func-types.ts create mode 100644 libs/interchain-query/src/helpers.ts create mode 100644 libs/interchain-query/src/ibc/applications/transfer/v1/transfer.ts create mode 100644 libs/interchain-query/src/ibc/applications/transfer/v1/tx.rpc.func.ts create mode 100644 libs/interchain-query/src/ibc/applications/transfer/v1/tx.ts create mode 100644 libs/interchain-query/src/ibc/core/channel/v1/channel.ts create mode 100644 libs/interchain-query/src/ibc/core/channel/v1/tx.rpc.func.ts create mode 100644 libs/interchain-query/src/ibc/core/channel/v1/tx.ts create mode 100644 libs/interchain-query/src/ibc/core/channel/v1/upgrade.ts create mode 100644 libs/interchain-query/src/ibc/core/client/v1/client.ts create mode 100644 libs/interchain-query/src/ibc/core/client/v1/tx.rpc.func.ts create mode 100644 libs/interchain-query/src/ibc/core/client/v1/tx.ts create mode 100644 libs/interchain-query/src/ibc/core/commitment/v1/commitment.ts create mode 100644 libs/interchain-query/src/ibc/core/connection/v1/connection.ts create mode 100644 libs/interchain-query/src/ibc/core/connection/v1/tx.rpc.func.ts create mode 100644 libs/interchain-query/src/ibc/core/connection/v1/tx.ts create mode 100644 libs/interchain-query/src/injective/types/v1beta1/account.ts create mode 100644 libs/interchain-query/src/react-query.ts create mode 100644 libs/interchain-query/src/registry.ts create mode 100644 libs/interchain-query/src/tendermint/abci/types.ts create mode 100644 libs/interchain-query/src/tendermint/crypto/keys.ts create mode 100644 libs/interchain-query/src/tendermint/crypto/proof.ts create mode 100644 libs/interchain-query/src/tendermint/types/block.ts create mode 100644 libs/interchain-query/src/tendermint/types/evidence.ts create mode 100644 libs/interchain-query/src/tendermint/types/params.ts create mode 100644 libs/interchain-query/src/tendermint/types/types.ts create mode 100644 libs/interchain-query/src/tendermint/types/validator.ts create mode 100644 libs/interchain-query/src/tendermint/version/types.ts create mode 100644 libs/interchain-query/src/types.ts create mode 100644 libs/interchain-query/src/utf8.ts create mode 100644 libs/interchain-query/src/varint.ts create mode 100644 libs/interchain-query/tsconfig.esm.json create mode 100644 libs/interchain-query/tsconfig.json create mode 100644 scripts/interchain-query.telescope.json diff --git a/.telescope.json b/.telescope.json index 000e2158..510be282 100644 --- a/.telescope.json +++ b/.telescope.json @@ -2,7 +2,7 @@ "protoDirs": [ "./protos" ], - "outPath": "./libs/interchainjs/src", + "outPath": "./libs/interchain-query/src", "options": { "classesUseArrowFunctions": true, "env": "v-next", diff --git a/libs/interchain-query/.eslintignore b/libs/interchain-query/.eslintignore new file mode 100644 index 00000000..838458f2 --- /dev/null +++ b/libs/interchain-query/.eslintignore @@ -0,0 +1 @@ +/dist/ \ No newline at end of file diff --git a/libs/interchain-query/CHANGELOG.md b/libs/interchain-query/CHANGELOG.md new file mode 100644 index 00000000..c7519894 --- /dev/null +++ b/libs/interchain-query/CHANGELOG.md @@ -0,0 +1,176 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [0.0.1-beta.36](https://github.com/cosmology-tech/interchainjs/compare/interchainjs@0.0.1-beta.35...interchainjs@0.0.1-beta.36) (2024-11-04) + +**Note:** Version bump only for package interchainjs + +## [0.0.1-beta.35](https://github.com/cosmology-tech/interchainjs/compare/interchainjs@0.0.1-beta.34...interchainjs@0.0.1-beta.35) (2024-11-04) + +**Note:** Version bump only for package interchainjs + +## [0.0.1-beta.34](https://github.com/cosmology-tech/interchainjs/compare/interchainjs@0.0.1-beta.33...interchainjs@0.0.1-beta.34) (2024-11-01) + +**Note:** Version bump only for package interchainjs + +## [0.0.1-beta.33](https://github.com/cosmology-tech/interchainjs/compare/interchainjs@0.0.1-alpha.33...interchainjs@0.0.1-beta.33) (2024-11-01) + +**Note:** Version bump only for package interchainjs + +## [0.0.1-alpha.33](https://github.com/cosmology-tech/interchainjs/compare/interchainjs@0.0.1-alpha.32...interchainjs@0.0.1-alpha.33) (2024-11-01) + +**Note:** Version bump only for package interchainjs + +## [0.0.1-alpha.32](https://github.com/cosmology-tech/interchainjs/compare/interchainjs@0.0.1-alpha.31...interchainjs@0.0.1-alpha.32) (2024-11-01) + +**Note:** Version bump only for package interchainjs + +## [0.0.1-alpha.31](https://github.com/cosmology-tech/interchainjs/compare/interchainjs@0.0.1-alpha.30...interchainjs@0.0.1-alpha.31) (2024-10-30) + +**Note:** Version bump only for package interchainjs + +## [0.0.1-alpha.30](https://github.com/cosmology-tech/interchainjs/compare/interchainjs@0.0.1-beta.30...interchainjs@0.0.1-alpha.30) (2024-10-30) + +**Note:** Version bump only for package interchainjs + +## [0.0.1-beta.30](https://github.com/cosmology-tech/interchainjs/compare/interchainjs@0.0.1-beta.29...interchainjs@0.0.1-beta.30) (2024-10-25) + +**Note:** Version bump only for package interchainjs + +## [0.0.1-beta.29](https://github.com/cosmology-tech/interchainjs/compare/interchainjs@0.0.1-beta.28...interchainjs@0.0.1-beta.29) (2024-10-25) + +**Note:** Version bump only for package interchainjs + +## [0.0.1-beta.28](https://github.com/cosmology-tech/interchainjs/compare/interchainjs@0.0.1-beta.27...interchainjs@0.0.1-beta.28) (2024-10-25) + +**Note:** Version bump only for package interchainjs + +## [0.0.1-beta.27](https://github.com/cosmology-tech/interchainjs/compare/interchainjs@0.0.1-beta.26...interchainjs@0.0.1-beta.27) (2024-10-23) + +**Note:** Version bump only for package interchainjs + +## [0.0.1-beta.26](https://github.com/cosmology-tech/interchainjs/compare/interchainjs@0.0.1-beta.25...interchainjs@0.0.1-beta.26) (2024-10-22) + +**Note:** Version bump only for package interchainjs + +## [0.0.1-beta.25](https://github.com/cosmology-tech/interchainjs/compare/interchainjs@0.0.1-beta.24...interchainjs@0.0.1-beta.25) (2024-10-22) + +**Note:** Version bump only for package interchainjs + +## [0.0.1-beta.24](https://github.com/cosmology-tech/interchainjs/compare/interchainjs@0.0.1-beta.23...interchainjs@0.0.1-beta.24) (2024-10-22) + +**Note:** Version bump only for package interchainjs + +## [0.0.1-beta.23](https://github.com/cosmology-tech/interchainjs/compare/interchainjs@0.0.1-beta.22...interchainjs@0.0.1-beta.23) (2024-10-22) + +**Note:** Version bump only for package interchainjs + +## [0.0.1-beta.22](https://github.com/cosmology-tech/interchainjs/compare/interchainjs@0.0.1-beta.21...interchainjs@0.0.1-beta.22) (2024-10-22) + +**Note:** Version bump only for package interchainjs + +## [0.0.1-beta.21](https://github.com/cosmology-tech/interchainjs/compare/interchainjs@0.0.1-beta.20...interchainjs@0.0.1-beta.21) (2024-10-21) + +**Note:** Version bump only for package interchainjs + +## [0.0.1-beta.20](https://github.com/cosmology-tech/interchainjs/compare/interchainjs@0.0.1-beta.19...interchainjs@0.0.1-beta.20) (2024-10-21) + +**Note:** Version bump only for package interchainjs + +## [0.0.1-beta.19](https://github.com/cosmology-tech/interchainjs/compare/interchainjs@0.0.1-beta.18...interchainjs@0.0.1-beta.19) (2024-10-21) + +**Note:** Version bump only for package interchainjs + +## [0.0.1-beta.18](https://github.com/cosmology-tech/interchainjs/compare/interchainjs@0.0.1-beta.17...interchainjs@0.0.1-beta.18) (2024-10-21) + +**Note:** Version bump only for package interchainjs + +## [0.0.1-beta.17](https://github.com/cosmology-tech/interchainjs/compare/interchainjs@0.0.1-beta.16...interchainjs@0.0.1-beta.17) (2024-10-21) + +**Note:** Version bump only for package interchainjs + +## [0.0.1-beta.16](https://github.com/cosmology-tech/interchainjs/compare/interchainjs@0.0.1-beta.15...interchainjs@0.0.1-beta.16) (2024-10-21) + +**Note:** Version bump only for package interchainjs + +## [0.0.1-beta.15](https://github.com/cosmology-tech/interchainjs/compare/interchainjs@0.0.1-beta.14...interchainjs@0.0.1-beta.15) (2024-10-21) + +**Note:** Version bump only for package interchainjs + +## [0.0.1-beta.14](https://github.com/cosmology-tech/interchainjs/compare/interchainjs@0.0.1-beta.13...interchainjs@0.0.1-beta.14) (2024-09-13) + +**Note:** Version bump only for package interchainjs + +## [0.0.1-beta.13](https://github.com/cosmology-tech/interchainjs/compare/interchainjs@0.0.1-beta.12...interchainjs@0.0.1-beta.13) (2024-09-10) + +**Note:** Version bump only for package interchainjs + +## [0.0.1-beta.12](https://github.com/cosmology-tech/interchainjs/compare/interchainjs@0.0.1-beta.11...interchainjs@0.0.1-beta.12) (2024-08-30) + +**Note:** Version bump only for package interchainjs + +## [0.0.1-beta.11](https://github.com/cosmology-tech/interchainjs/compare/interchainjs@0.0.1-beta.10...interchainjs@0.0.1-beta.11) (2024-08-27) + +**Note:** Version bump only for package interchainjs + +## [0.0.1-beta.10](https://github.com/cosmology-tech/interchainjs/compare/interchainjs@0.0.1-beta.9...interchainjs@0.0.1-beta.10) (2024-08-26) + +**Note:** Version bump only for package interchainjs + +## [0.0.1-beta.9](https://github.com/cosmology-tech/interchainjs/compare/interchainjs@0.0.1-beta.8...interchainjs@0.0.1-beta.9) (2024-08-24) + +**Note:** Version bump only for package interchainjs + +## [0.0.1-beta.8](https://github.com/cosmology-tech/interchainjs/compare/interchainjs@0.0.1-beta.7...interchainjs@0.0.1-beta.8) (2024-08-21) + +**Note:** Version bump only for package interchainjs + +## [0.0.1-beta.7](https://github.com/cosmology-tech/interchainjs/compare/interchainjs@0.0.1-beta.6...interchainjs@0.0.1-beta.7) (2024-08-19) + +**Note:** Version bump only for package interchainjs + +## [0.0.1-beta.6](https://github.com/cosmology-tech/interchainjs/compare/interchainjs@0.0.1-beta.5...interchainjs@0.0.1-beta.6) (2024-08-14) + +**Note:** Version bump only for package interchainjs + +## [0.0.1-beta.5](https://github.com/cosmology-tech/interchainjs/compare/interchainjs@0.0.1-beta.4...interchainjs@0.0.1-beta.5) (2024-08-14) + +**Note:** Version bump only for package interchainjs + +## [0.0.1-beta.4](https://github.com/cosmology-tech/interchainjs/compare/interchainjs@0.0.1-beta.3...interchainjs@0.0.1-beta.4) (2024-08-13) + +**Note:** Version bump only for package interchainjs + +## [0.0.1-beta.3](https://github.com/cosmology-tech/interchainjs/compare/interchainjs@0.0.1-beta.2...interchainjs@0.0.1-beta.3) (2024-08-13) + +**Note:** Version bump only for package interchainjs + +## [0.0.1-beta.2](https://github.com/cosmology-tech/interchainjs/compare/interchainjs@0.0.1-beta.1...interchainjs@0.0.1-beta.2) (2024-06-07) + +**Note:** Version bump only for package interchainjs + +## [0.0.1-beta.1](https://github.com/cosmology-tech/interchainjs/compare/interchainjs@0.0.1-beta.0...interchainjs@0.0.1-beta.1) (2024-04-29) + +**Note:** Version bump only for package interchainjs + +## [0.0.1-beta.0](https://github.com/cosmology-tech/interchainjs/compare/interchainjs@0.0.1...interchainjs@0.0.1-beta.0) (2024-04-29) + +**Note:** Version bump only for package interchainjs + +## [0.0.1](https://github.com/cosmology-tech/interchainjs/compare/interchainjs@0.0.1...interchainjs@0.0.1) (2024-04-29) + +**Note:** Version bump only for package interchainjs + +## [0.0.1](https://github.com/cosmology-tech/interchainjs/compare/interchainjs@0.0.1...interchainjs@0.0.1) (2024-04-29) + +**Note:** Version bump only for package interchainjs + +## [0.0.1](https://github.com/cosmology-tech/interchainjs/compare/interchainjs@0.0.7...interchainjs@0.0.1) (2024-04-29) + +**Note:** Version bump only for package interchainjs + +## 0.0.7 (2024-04-02) + +**Note:** Version bump only for package interchainjs diff --git a/libs/interchain-query/README.md b/libs/interchain-query/README.md new file mode 100644 index 00000000..5acb6556 --- /dev/null +++ b/libs/interchain-query/README.md @@ -0,0 +1,21 @@ +# interchainjs + +

+ +

+ +

+ + + +

+ +React query helper hooks(Tx, Query) generated by Telescope. + +## License + +MIT License (MIT) & Apache License + +Copyright (c) 2024 Cosmology (https://cosmology.zone/) diff --git a/libs/interchain-query/jest.starship.config.js b/libs/interchain-query/jest.starship.config.js new file mode 100644 index 00000000..c8558038 --- /dev/null +++ b/libs/interchain-query/jest.starship.config.js @@ -0,0 +1,18 @@ +/** @type {import('ts-jest').JestConfigWithTsJest} */ +module.exports = { + testTimeout: 15000, + preset: 'ts-jest', + testEnvironment: 'node', + transform: { + '^.+\\.tsx?$': [ + 'ts-jest', + { + babelConfig: false, + tsconfig: 'tsconfig.json', + }, + ], + }, + transformIgnorePatterns: [`/node_modules/*`], + testRegex: '(/starship/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$', + moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], +}; diff --git a/libs/interchain-query/package.json b/libs/interchain-query/package.json new file mode 100644 index 00000000..599ce8a9 --- /dev/null +++ b/libs/interchain-query/package.json @@ -0,0 +1,55 @@ +{ + "name": "interchain-query", + "version": "0.0.1-beta.36", + "description": "InterchainJS is a JavaScript library providing react query hooks for interacting with Cosmos SDK based blockchains.", + "main": "index.js", + "module": "esm/index.js", + "types": "index.d.ts", + "author": "Cosmology ", + "homepage": "https://github.com/cosmology-tech/interchainjs", + "repository": { + "type": "git", + "url": "https://github.com/cosmology-tech/interchainjs" + }, + "license": "MIT", + "publishConfig": { + "access": "public", + "directory": "dist" + }, + "scripts": { + "copy": "copyfiles -f ../../LICENSE-MIT ../../LICENSE-Apache README.md package.json dist", + "clean": "rimraf dist/**", + "build": "npm run clean; tsc; tsc -p tsconfig.esm.json; npm run copy", + "build:dev": "npm run clean; tsc --declarationMap; tsc -p tsconfig.esm.json; npm run copy", + "lint": "eslint . --fix", + "starship": "starship --config ./starship/configs/config.yaml", + "starship:local": "starship --config ./starship/configs/config.local.yaml", + "starship:test": "jest --config ./jest.starship.config.js --verbose --bail", + "starship:debug": "jest --config ./jest.starship.config.js --runInBand --verbose --bail", + "starship:watch": "jest --watch --config ./jest.starship.config.js", + "starship:all": "yarn starship start", + "starship:clean": "yarn starship stop", + "prepare": "npm run build" + }, + "dependencies": { + "@interchainjs/cosmos": "^0.0.1-beta.34", + "@interchainjs/cosmos-types": "^0.0.1-beta.34", + "@interchainjs/types": "^0.0.1-beta.34", + "@interchainjs/utils": "^0.0.1-beta.34", + "@noble/hashes": "^1.3.1", + "decimal.js": "^10.4.3" + }, + "devDependencies": { + "@tanstack/react-query": "4.29.1" + }, + "peerDependencies": { + "@tanstack/react-query": "4.29.1" + }, + "keywords": [ + "cosmos", + "blockchain", + "transaction", + "cosmjs", + "wallet" + ] +} diff --git a/libs/interchain-query/src/amino/amino.ts b/libs/interchain-query/src/amino/amino.ts new file mode 100644 index 00000000..693da49f --- /dev/null +++ b/libs/interchain-query/src/amino/amino.ts @@ -0,0 +1 @@ +export {} \ No newline at end of file diff --git a/libs/interchain-query/src/binary.ts b/libs/interchain-query/src/binary.ts new file mode 100644 index 00000000..32ed676e --- /dev/null +++ b/libs/interchain-query/src/binary.ts @@ -0,0 +1,534 @@ +/** +* This file and any referenced files were automatically generated by @cosmology/telescope@1.10.8 +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +// Copyright (c) 2016, Daniel Wirtz All rights reserved. + +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: + +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of its author, nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. + +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// --- + +// Code generated by the command line utilities is owned by the owner +// of the input file used when generating it. This code is not +// standalone and requires a support library to be linked with it. This +// support library is itself covered by the above license. + +import { utf8Length, utf8Read, utf8Write } from "./utf8"; +import { + int64ToString, + readInt32, + readUInt32, + uInt64ToString, + varint32read, + varint64read, + writeVarint32, + writeVarint64, + int64FromString, + int64Length, + writeFixed32, + writeByte, + zzDecode, + zzEncode, +} from "./varint"; + +export enum WireType { + Varint = 0, + + Fixed64 = 1, + + Bytes = 2, + + Fixed32 = 5, +} + +// Reader +export interface IBinaryReader { + buf: Uint8Array; + pos: number; + type: number; + len: number; + tag(): [number, WireType, number]; + skip(length?: number): this; + skipType(wireType: number): this; + uint32(): number; + int32(): number; + sint32(): number; + fixed32(): number; + sfixed32(): number; + int64(): bigint; + uint64(): bigint; + sint64(): bigint; + fixed64(): bigint; + sfixed64(): bigint; + float(): number; + double(): number; + bool(): boolean; + bytes(): Uint8Array; + string(): string; +} + +export class BinaryReader implements IBinaryReader { + buf: Uint8Array; + pos: number; + type: number; + len: number; + + assertBounds(): void { + if (this.pos > this.len) throw new RangeError("premature EOF"); + } + + constructor(buf?: ArrayLike) { + this.buf = buf ? new Uint8Array(buf) : new Uint8Array(0); + this.pos = 0; + this.type = 0; + this.len = this.buf.length; + } + + tag(): [number, WireType, number] { + const tag = this.uint32(), + fieldNo = tag >>> 3, + wireType = tag & 7; + if (fieldNo <= 0 || wireType < 0 || wireType > 5) + throw new Error( + "illegal tag: field no " + fieldNo + " wire type " + wireType + ); + return [fieldNo, wireType, tag]; + } + + skip(length?: number) { + if (typeof length === "number") { + if (this.pos + length > this.len) throw indexOutOfRange(this, length); + this.pos += length; + } else { + do { + if (this.pos >= this.len) throw indexOutOfRange(this); + } while (this.buf[this.pos++] & 128); + } + return this; + } + + skipType(wireType: number) { + switch (wireType) { + case WireType.Varint: + this.skip(); + break; + case WireType.Fixed64: + this.skip(8); + break; + case WireType.Bytes: + this.skip(this.uint32()); + break; + case 3: + while ((wireType = this.uint32() & 7) !== 4) { + this.skipType(wireType); + } + break; + case WireType.Fixed32: + this.skip(4); + break; + + /* istanbul ignore next */ + default: + throw Error("invalid wire type " + wireType + " at offset " + this.pos); + } + return this; + } + + uint32(): number { + return varint32read.bind(this)(); + } + + int32(): number { + return this.uint32() | 0; + } + + sint32(): number { + const num = this.uint32(); + return num % 2 === 1 ? (num + 1) / -2 : num / 2; // zigzag encoding + } + + fixed32(): number { + const val = readUInt32(this.buf, this.pos); + this.pos += 4; + return val; + } + + sfixed32(): number { + const val = readInt32(this.buf, this.pos); + this.pos += 4; + return val; + } + + int64(): bigint { + const [lo, hi] = varint64read.bind(this)(); + return BigInt(int64ToString(lo, hi)); + } + + uint64(): bigint { + const [lo, hi] = varint64read.bind(this)(); + return BigInt(uInt64ToString(lo, hi)); + } + + sint64(): bigint { + let [lo, hi] = varint64read.bind(this)(); + // zig zag + [lo, hi] = zzDecode(lo, hi); + return BigInt(int64ToString(lo, hi)); + } + + fixed64(): bigint { + const lo = this.sfixed32(); + const hi = this.sfixed32(); + return BigInt(uInt64ToString(lo, hi)); + } + sfixed64(): bigint { + const lo = this.sfixed32(); + const hi = this.sfixed32(); + return BigInt(int64ToString(lo, hi)); + } + + float(): number { + throw new Error("float not supported"); + } + + double(): number { + throw new Error("double not supported"); + } + + bool(): boolean { + const [lo, hi] = varint64read.bind(this)(); + return lo !== 0 || hi !== 0; + } + + bytes(): Uint8Array { + const len = this.uint32(), + start = this.pos; + this.pos += len; + this.assertBounds(); + return this.buf.subarray(start, start + len); + } + + string(): string { + const bytes = this.bytes(); + return utf8Read(bytes, 0, bytes.length); + } +} + +// Writer +export interface IBinaryWriter { + len: number; + head: IOp; + tail: IOp; + states: State | null; + finish(): Uint8Array; + fork(): IBinaryWriter; + reset(): IBinaryWriter; + ldelim(): IBinaryWriter; + tag(fieldNo: number, type: WireType): IBinaryWriter; + uint32(value: number): IBinaryWriter; + int32(value: number): IBinaryWriter; + sint32(value: number): IBinaryWriter; + int64(value: string | number | bigint): IBinaryWriter; + uint64: (value: string | number | bigint) => IBinaryWriter; + sint64(value: string | number | bigint): IBinaryWriter; + fixed64(value: string | number | bigint): IBinaryWriter; + sfixed64: (value: string | number | bigint) => IBinaryWriter; + bool(value: boolean): IBinaryWriter; + fixed32(value: number): IBinaryWriter; + sfixed32: (value: number) => IBinaryWriter; + float(value: number): IBinaryWriter; + double(value: number): IBinaryWriter; + bytes(value: Uint8Array): IBinaryWriter; + string(value: string): IBinaryWriter; +} + +interface IOp { + len: number; + next?: IOp; + proceed(buf: Uint8Array | number[], pos: number): void; +} + +class Op implements IOp { + fn?: ((val: T, buf: Uint8Array | number[], pos: number) => void) | null; + len: number; + val: T; + next?: IOp; + + constructor( + fn: + | (( + val: T, + buf: Uint8Array | number[], + pos: number + ) => void | undefined | null) + | null, + len: number, + val: T + ) { + this.fn = fn; + this.len = len; + this.val = val; + } + + proceed(buf: Uint8Array | number[], pos: number) { + if (this.fn) { + this.fn(this.val, buf, pos); + } + } +} + +class State { + head: IOp; + tail: IOp; + len: number; + next: State | null; + + constructor(writer: BinaryWriter) { + this.head = writer.head; + this.tail = writer.tail; + this.len = writer.len; + this.next = writer.states; + } +} + +export class BinaryWriter implements IBinaryWriter { + len = 0; + head: IOp; + tail: IOp; + states: State | null; + + constructor() { + this.head = new Op(null, 0, 0); + this.tail = this.head; + this.states = null; + } + + static create() { + return new BinaryWriter(); + } + + static alloc(size: number): Uint8Array | number[] { + if (typeof Uint8Array !== "undefined") { + return pool( + (size) => new Uint8Array(size), + Uint8Array.prototype.subarray + )(size); + } else { + return new Array(size); + } + } + + private _push( + fn: (val: T, buf: Uint8Array | number[], pos: number) => void, + len: number, + val: T + ) { + this.tail = this.tail.next = new Op(fn, len, val); + this.len += len; + return this; + } + + finish(): Uint8Array { + let head = this.head.next, + pos = 0; + const buf = BinaryWriter.alloc(this.len); + while (head) { + head.proceed(buf, pos); + pos += head.len; + head = head.next; + } + return buf as Uint8Array; + } + + fork(): BinaryWriter { + this.states = new State(this); + this.head = this.tail = new Op(null, 0, 0); + this.len = 0; + return this; + } + + reset(): BinaryWriter { + if (this.states) { + this.head = this.states.head; + this.tail = this.states.tail; + this.len = this.states.len; + this.states = this.states.next; + } else { + this.head = this.tail = new Op(null, 0, 0); + this.len = 0; + } + return this; + } + + ldelim(): BinaryWriter { + const head = this.head, + tail = this.tail, + len = this.len; + this.reset().uint32(len); + if (len) { + this.tail.next = head.next; // skip noop + this.tail = tail; + this.len += len; + } + return this; + } + + tag(fieldNo: number, type: WireType): BinaryWriter { + return this.uint32(((fieldNo << 3) | type) >>> 0); + } + + uint32(value: number): BinaryWriter { + this.len += (this.tail = this.tail.next = + new Op( + writeVarint32, + (value = value >>> 0) < 128 + ? 1 + : value < 16384 + ? 2 + : value < 2097152 + ? 3 + : value < 268435456 + ? 4 + : 5, + value + )).len; + return this; + } + + int32(value: number): BinaryWriter { + return value < 0 + ? this._push(writeVarint64, 10, int64FromString(value.toString())) // 10 bytes per spec + : this.uint32(value); + } + + sint32(value: number): BinaryWriter { + return this.uint32(((value << 1) ^ (value >> 31)) >>> 0); + } + + int64(value: string | number | bigint): BinaryWriter { + const { lo, hi } = int64FromString(value.toString()); + return this._push(writeVarint64, int64Length(lo, hi), { lo, hi }); + } + + // uint64 is the same with int64 + uint64 = BinaryWriter.prototype.int64; + + sint64(value: string | number | bigint): BinaryWriter { + let { lo, hi } = int64FromString(value.toString()); + // zig zag + [lo, hi] = zzEncode(lo, hi); + return this._push(writeVarint64, int64Length(lo, hi), { lo, hi }); + } + + fixed64(value: string | number | bigint): BinaryWriter { + const { lo, hi } = int64FromString(value.toString()); + return this._push(writeFixed32, 4, lo)._push(writeFixed32, 4, hi); + } + + // sfixed64 is the same with fixed64 + sfixed64 = BinaryWriter.prototype.fixed64; + + bool(value: boolean): BinaryWriter { + return this._push(writeByte, 1, value ? 1 : 0); + } + + fixed32(value: number): BinaryWriter { + return this._push(writeFixed32, 4, value >>> 0); + } + + // sfixed32 is the same with fixed32 + sfixed32 = BinaryWriter.prototype.fixed32; + + float(value: number): BinaryWriter { + throw new Error("float not supported" + value); + } + + double(value: number): BinaryWriter { + throw new Error("double not supported" + value); + } + + bytes(value: Uint8Array): BinaryWriter { + const len = value.length >>> 0; + if (!len) return this._push(writeByte, 1, 0); + return this.uint32(len)._push(writeBytes, len, value); + } + + string(value: string): BinaryWriter { + const len = utf8Length(value); + return len + ? this.uint32(len)._push(utf8Write, len, value) + : this._push(writeByte, 1, 0); + } +} + +function writeBytes( + val: Uint8Array | number[], + buf: Uint8Array | number[], + pos: number +) { + if (typeof Uint8Array !== "undefined") { + (buf as Uint8Array).set(val, pos); + } else { + for (let i = 0; i < val.length; ++i) buf[pos + i] = val[i]; + } +} + +function pool( + alloc: (size: number) => Uint8Array, + slice: (begin?: number, end?: number) => Uint8Array, + size?: number +): (size: number) => Uint8Array { + const SIZE = size || 8192; + const MAX = SIZE >>> 1; + let slab: Uint8Array | null = null; + let offset = SIZE; + return function pool_alloc(size): Uint8Array { + if (size < 1 || size > MAX) return alloc(size); + if (offset + size > SIZE) { + slab = alloc(SIZE); + offset = 0; + } + const buf: Uint8Array = slice.call(slab, offset, (offset += size)); + if (offset & 7) + // align to 32 bit + offset = (offset | 7) + 1; + return buf; + }; +} + +function indexOutOfRange(reader: BinaryReader, writeLength?: number) { + return RangeError( + "index out of range: " + + reader.pos + + " + " + + (writeLength || 1) + + " > " + + reader.len + ); +} diff --git a/libs/interchain-query/src/cosmos/auth/v1beta1/auth.ts b/libs/interchain-query/src/cosmos/auth/v1beta1/auth.ts new file mode 100644 index 00000000..bd8ed990 --- /dev/null +++ b/libs/interchain-query/src/cosmos/auth/v1beta1/auth.ts @@ -0,0 +1,550 @@ +import { Any, AnyAmino } from "../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; +/** + * BaseAccount defines a base account type. It contains all the necessary fields + * for basic account functionality. Any custom account type should extend this + * type for additional functionality (e.g. vesting). + */ +export interface BaseAccount { + address: string; + pubKey?: Any; + accountNumber: bigint; + sequence: bigint; +} +export interface BaseAccountProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.BaseAccount"; + value: Uint8Array; +} +/** + * BaseAccount defines a base account type. It contains all the necessary fields + * for basic account functionality. Any custom account type should extend this + * type for additional functionality (e.g. vesting). + */ +export interface BaseAccountAmino { + address: string; + pub_key?: AnyAmino; + account_number: string; + sequence: string; +} +export interface BaseAccountAminoMsg { + type: "cosmos-sdk/BaseAccount"; + value: BaseAccountAmino; +} +/** ModuleAccount defines an account for modules that holds coins on a pool. */ +export interface ModuleAccount { + baseAccount?: BaseAccount; + name: string; + permissions: string[]; +} +export interface ModuleAccountProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.ModuleAccount"; + value: Uint8Array; +} +/** ModuleAccount defines an account for modules that holds coins on a pool. */ +export interface ModuleAccountAmino { + base_account?: BaseAccountAmino; + name: string; + permissions: string[]; +} +export interface ModuleAccountAminoMsg { + type: "cosmos-sdk/ModuleAccount"; + value: ModuleAccountAmino; +} +/** + * ModuleCredential represents a unclaimable pubkey for base accounts controlled by modules. + * + * Since: cosmos-sdk 0.47 + */ +export interface ModuleCredential { + /** module_name is the name of the module used for address derivation (passed into address.Module). */ + moduleName: string; + /** + * derivation_keys is for deriving a module account address (passed into address.Module) + * adding more keys creates sub-account addresses (passed into address.Derive) + */ + derivationKeys: Uint8Array[]; +} +export interface ModuleCredentialProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.ModuleCredential"; + value: Uint8Array; +} +/** + * ModuleCredential represents a unclaimable pubkey for base accounts controlled by modules. + * + * Since: cosmos-sdk 0.47 + */ +export interface ModuleCredentialAmino { + /** module_name is the name of the module used for address derivation (passed into address.Module). */ + module_name: string; + /** + * derivation_keys is for deriving a module account address (passed into address.Module) + * adding more keys creates sub-account addresses (passed into address.Derive) + */ + derivation_keys: string[]; +} +export interface ModuleCredentialAminoMsg { + type: "cosmos-sdk/GroupAccountCredential"; + value: ModuleCredentialAmino; +} +/** Params defines the parameters for the auth module. */ +export interface Params { + maxMemoCharacters: bigint; + txSigLimit: bigint; + txSizeCostPerByte: bigint; + sigVerifyCostEd25519: bigint; + sigVerifyCostSecp256k1: bigint; +} +export interface ParamsProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.Params"; + value: Uint8Array; +} +/** Params defines the parameters for the auth module. */ +export interface ParamsAmino { + max_memo_characters: string; + tx_sig_limit: string; + tx_size_cost_per_byte: string; + sig_verify_cost_ed25519: string; + sig_verify_cost_secp256k1: string; +} +export interface ParamsAminoMsg { + type: "cosmos-sdk/x/auth/Params"; + value: ParamsAmino; +} +function createBaseBaseAccount(): BaseAccount { + return { + address: "", + pubKey: undefined, + accountNumber: BigInt(0), + sequence: BigInt(0) + }; +} +export const BaseAccount = { + typeUrl: "/cosmos.auth.v1beta1.BaseAccount", + aminoType: "cosmos-sdk/BaseAccount", + is(o: any): o is BaseAccount { + return o && (o.$typeUrl === BaseAccount.typeUrl || typeof o.address === "string" && typeof o.accountNumber === "bigint" && typeof o.sequence === "bigint"); + }, + isAmino(o: any): o is BaseAccountAmino { + return o && (o.$typeUrl === BaseAccount.typeUrl || typeof o.address === "string" && typeof o.account_number === "bigint" && typeof o.sequence === "bigint"); + }, + encode(message: BaseAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pubKey !== undefined) { + Any.encode(message.pubKey, writer.uint32(18).fork()).ldelim(); + } + if (message.accountNumber !== BigInt(0)) { + writer.uint32(24).uint64(message.accountNumber); + } + if (message.sequence !== BigInt(0)) { + writer.uint32(32).uint64(message.sequence); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): BaseAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBaseAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.pubKey = Any.decode(reader, reader.uint32()); + break; + case 3: + message.accountNumber = reader.uint64(); + break; + case 4: + message.sequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): BaseAccount { + const message = createBaseBaseAccount(); + message.address = object.address ?? ""; + message.pubKey = object.pubKey !== undefined && object.pubKey !== null ? Any.fromPartial(object.pubKey) : undefined; + message.accountNumber = object.accountNumber !== undefined && object.accountNumber !== null ? BigInt(object.accountNumber.toString()) : BigInt(0); + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + return message; + }, + fromAmino(object: BaseAccountAmino): BaseAccount { + const message = createBaseBaseAccount(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.pub_key !== undefined && object.pub_key !== null) { + message.pubKey = Any.fromAmino(object.pub_key); + } + if (object.account_number !== undefined && object.account_number !== null) { + message.accountNumber = BigInt(object.account_number); + } + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + return message; + }, + toAmino(message: BaseAccount): BaseAccountAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined; + obj.account_number = message.accountNumber !== BigInt(0) ? message.accountNumber?.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: BaseAccountAminoMsg): BaseAccount { + return BaseAccount.fromAmino(object.value); + }, + toAminoMsg(message: BaseAccount): BaseAccountAminoMsg { + return { + type: "cosmos-sdk/BaseAccount", + value: BaseAccount.toAmino(message) + }; + }, + fromProtoMsg(message: BaseAccountProtoMsg): BaseAccount { + return BaseAccount.decode(message.value); + }, + toProto(message: BaseAccount): Uint8Array { + return BaseAccount.encode(message).finish(); + }, + toProtoMsg(message: BaseAccount): BaseAccountProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.BaseAccount", + value: BaseAccount.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(BaseAccount.typeUrl, BaseAccount); +GlobalDecoderRegistry.registerAminoProtoMapping(BaseAccount.aminoType, BaseAccount.typeUrl); +function createBaseModuleAccount(): ModuleAccount { + return { + baseAccount: undefined, + name: "", + permissions: [] + }; +} +export const ModuleAccount = { + typeUrl: "/cosmos.auth.v1beta1.ModuleAccount", + aminoType: "cosmos-sdk/ModuleAccount", + is(o: any): o is ModuleAccount { + return o && (o.$typeUrl === ModuleAccount.typeUrl || typeof o.name === "string" && Array.isArray(o.permissions) && (!o.permissions.length || typeof o.permissions[0] === "string")); + }, + isAmino(o: any): o is ModuleAccountAmino { + return o && (o.$typeUrl === ModuleAccount.typeUrl || typeof o.name === "string" && Array.isArray(o.permissions) && (!o.permissions.length || typeof o.permissions[0] === "string")); + }, + encode(message: ModuleAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.baseAccount !== undefined) { + BaseAccount.encode(message.baseAccount, writer.uint32(10).fork()).ldelim(); + } + if (message.name !== "") { + writer.uint32(18).string(message.name); + } + for (const v of message.permissions) { + writer.uint32(26).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ModuleAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.baseAccount = BaseAccount.decode(reader, reader.uint32()); + break; + case 2: + message.name = reader.string(); + break; + case 3: + message.permissions.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ModuleAccount { + const message = createBaseModuleAccount(); + message.baseAccount = object.baseAccount !== undefined && object.baseAccount !== null ? BaseAccount.fromPartial(object.baseAccount) : undefined; + message.name = object.name ?? ""; + message.permissions = object.permissions?.map(e => e) || []; + return message; + }, + fromAmino(object: ModuleAccountAmino): ModuleAccount { + const message = createBaseModuleAccount(); + if (object.base_account !== undefined && object.base_account !== null) { + message.baseAccount = BaseAccount.fromAmino(object.base_account); + } + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + message.permissions = object.permissions?.map(e => e) || []; + return message; + }, + toAmino(message: ModuleAccount): ModuleAccountAmino { + const obj: any = {}; + obj.base_account = message.baseAccount ? BaseAccount.toAmino(message.baseAccount) : undefined; + obj.name = message.name === "" ? undefined : message.name; + if (message.permissions) { + obj.permissions = message.permissions.map(e => e); + } else { + obj.permissions = message.permissions; + } + return obj; + }, + fromAminoMsg(object: ModuleAccountAminoMsg): ModuleAccount { + return ModuleAccount.fromAmino(object.value); + }, + toAminoMsg(message: ModuleAccount): ModuleAccountAminoMsg { + return { + type: "cosmos-sdk/ModuleAccount", + value: ModuleAccount.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleAccountProtoMsg): ModuleAccount { + return ModuleAccount.decode(message.value); + }, + toProto(message: ModuleAccount): Uint8Array { + return ModuleAccount.encode(message).finish(); + }, + toProtoMsg(message: ModuleAccount): ModuleAccountProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.ModuleAccount", + value: ModuleAccount.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ModuleAccount.typeUrl, ModuleAccount); +GlobalDecoderRegistry.registerAminoProtoMapping(ModuleAccount.aminoType, ModuleAccount.typeUrl); +function createBaseModuleCredential(): ModuleCredential { + return { + moduleName: "", + derivationKeys: [] + }; +} +export const ModuleCredential = { + typeUrl: "/cosmos.auth.v1beta1.ModuleCredential", + aminoType: "cosmos-sdk/GroupAccountCredential", + is(o: any): o is ModuleCredential { + return o && (o.$typeUrl === ModuleCredential.typeUrl || typeof o.moduleName === "string" && Array.isArray(o.derivationKeys) && (!o.derivationKeys.length || o.derivationKeys[0] instanceof Uint8Array || typeof o.derivationKeys[0] === "string")); + }, + isAmino(o: any): o is ModuleCredentialAmino { + return o && (o.$typeUrl === ModuleCredential.typeUrl || typeof o.module_name === "string" && Array.isArray(o.derivation_keys) && (!o.derivation_keys.length || o.derivation_keys[0] instanceof Uint8Array || typeof o.derivation_keys[0] === "string")); + }, + encode(message: ModuleCredential, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.moduleName !== "") { + writer.uint32(10).string(message.moduleName); + } + for (const v of message.derivationKeys) { + writer.uint32(18).bytes(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ModuleCredential { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleCredential(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.moduleName = reader.string(); + break; + case 2: + message.derivationKeys.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ModuleCredential { + const message = createBaseModuleCredential(); + message.moduleName = object.moduleName ?? ""; + message.derivationKeys = object.derivationKeys?.map(e => e) || []; + return message; + }, + fromAmino(object: ModuleCredentialAmino): ModuleCredential { + const message = createBaseModuleCredential(); + if (object.module_name !== undefined && object.module_name !== null) { + message.moduleName = object.module_name; + } + message.derivationKeys = object.derivation_keys?.map(e => bytesFromBase64(e)) || []; + return message; + }, + toAmino(message: ModuleCredential): ModuleCredentialAmino { + const obj: any = {}; + obj.module_name = message.moduleName === "" ? undefined : message.moduleName; + if (message.derivationKeys) { + obj.derivation_keys = message.derivationKeys.map(e => base64FromBytes(e)); + } else { + obj.derivation_keys = message.derivationKeys; + } + return obj; + }, + fromAminoMsg(object: ModuleCredentialAminoMsg): ModuleCredential { + return ModuleCredential.fromAmino(object.value); + }, + toAminoMsg(message: ModuleCredential): ModuleCredentialAminoMsg { + return { + type: "cosmos-sdk/GroupAccountCredential", + value: ModuleCredential.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleCredentialProtoMsg): ModuleCredential { + return ModuleCredential.decode(message.value); + }, + toProto(message: ModuleCredential): Uint8Array { + return ModuleCredential.encode(message).finish(); + }, + toProtoMsg(message: ModuleCredential): ModuleCredentialProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.ModuleCredential", + value: ModuleCredential.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ModuleCredential.typeUrl, ModuleCredential); +GlobalDecoderRegistry.registerAminoProtoMapping(ModuleCredential.aminoType, ModuleCredential.typeUrl); +function createBaseParams(): Params { + return { + maxMemoCharacters: BigInt(0), + txSigLimit: BigInt(0), + txSizeCostPerByte: BigInt(0), + sigVerifyCostEd25519: BigInt(0), + sigVerifyCostSecp256k1: BigInt(0) + }; +} +export const Params = { + typeUrl: "/cosmos.auth.v1beta1.Params", + aminoType: "cosmos-sdk/x/auth/Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || typeof o.maxMemoCharacters === "bigint" && typeof o.txSigLimit === "bigint" && typeof o.txSizeCostPerByte === "bigint" && typeof o.sigVerifyCostEd25519 === "bigint" && typeof o.sigVerifyCostSecp256k1 === "bigint"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || typeof o.max_memo_characters === "bigint" && typeof o.tx_sig_limit === "bigint" && typeof o.tx_size_cost_per_byte === "bigint" && typeof o.sig_verify_cost_ed25519 === "bigint" && typeof o.sig_verify_cost_secp256k1 === "bigint"); + }, + encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.maxMemoCharacters !== BigInt(0)) { + writer.uint32(8).uint64(message.maxMemoCharacters); + } + if (message.txSigLimit !== BigInt(0)) { + writer.uint32(16).uint64(message.txSigLimit); + } + if (message.txSizeCostPerByte !== BigInt(0)) { + writer.uint32(24).uint64(message.txSizeCostPerByte); + } + if (message.sigVerifyCostEd25519 !== BigInt(0)) { + writer.uint32(32).uint64(message.sigVerifyCostEd25519); + } + if (message.sigVerifyCostSecp256k1 !== BigInt(0)) { + writer.uint32(40).uint64(message.sigVerifyCostSecp256k1); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.maxMemoCharacters = reader.uint64(); + break; + case 2: + message.txSigLimit = reader.uint64(); + break; + case 3: + message.txSizeCostPerByte = reader.uint64(); + break; + case 4: + message.sigVerifyCostEd25519 = reader.uint64(); + break; + case 5: + message.sigVerifyCostSecp256k1 = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Params { + const message = createBaseParams(); + message.maxMemoCharacters = object.maxMemoCharacters !== undefined && object.maxMemoCharacters !== null ? BigInt(object.maxMemoCharacters.toString()) : BigInt(0); + message.txSigLimit = object.txSigLimit !== undefined && object.txSigLimit !== null ? BigInt(object.txSigLimit.toString()) : BigInt(0); + message.txSizeCostPerByte = object.txSizeCostPerByte !== undefined && object.txSizeCostPerByte !== null ? BigInt(object.txSizeCostPerByte.toString()) : BigInt(0); + message.sigVerifyCostEd25519 = object.sigVerifyCostEd25519 !== undefined && object.sigVerifyCostEd25519 !== null ? BigInt(object.sigVerifyCostEd25519.toString()) : BigInt(0); + message.sigVerifyCostSecp256k1 = object.sigVerifyCostSecp256k1 !== undefined && object.sigVerifyCostSecp256k1 !== null ? BigInt(object.sigVerifyCostSecp256k1.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ParamsAmino): Params { + const message = createBaseParams(); + if (object.max_memo_characters !== undefined && object.max_memo_characters !== null) { + message.maxMemoCharacters = BigInt(object.max_memo_characters); + } + if (object.tx_sig_limit !== undefined && object.tx_sig_limit !== null) { + message.txSigLimit = BigInt(object.tx_sig_limit); + } + if (object.tx_size_cost_per_byte !== undefined && object.tx_size_cost_per_byte !== null) { + message.txSizeCostPerByte = BigInt(object.tx_size_cost_per_byte); + } + if (object.sig_verify_cost_ed25519 !== undefined && object.sig_verify_cost_ed25519 !== null) { + message.sigVerifyCostEd25519 = BigInt(object.sig_verify_cost_ed25519); + } + if (object.sig_verify_cost_secp256k1 !== undefined && object.sig_verify_cost_secp256k1 !== null) { + message.sigVerifyCostSecp256k1 = BigInt(object.sig_verify_cost_secp256k1); + } + return message; + }, + toAmino(message: Params): ParamsAmino { + const obj: any = {}; + obj.max_memo_characters = message.maxMemoCharacters !== BigInt(0) ? message.maxMemoCharacters?.toString() : undefined; + obj.tx_sig_limit = message.txSigLimit !== BigInt(0) ? message.txSigLimit?.toString() : undefined; + obj.tx_size_cost_per_byte = message.txSizeCostPerByte !== BigInt(0) ? message.txSizeCostPerByte?.toString() : undefined; + obj.sig_verify_cost_ed25519 = message.sigVerifyCostEd25519 !== BigInt(0) ? message.sigVerifyCostEd25519?.toString() : undefined; + obj.sig_verify_cost_secp256k1 = message.sigVerifyCostSecp256k1 !== BigInt(0) ? message.sigVerifyCostSecp256k1?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ParamsAminoMsg): Params { + return Params.fromAmino(object.value); + }, + toAminoMsg(message: Params): ParamsAminoMsg { + return { + type: "cosmos-sdk/x/auth/Params", + value: Params.toAmino(message) + }; + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.Params", + value: Params.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Params.typeUrl, Params); +GlobalDecoderRegistry.registerAminoProtoMapping(Params.aminoType, Params.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/auth/v1beta1/query.rpc.func.ts b/libs/interchain-query/src/cosmos/auth/v1beta1/query.rpc.func.ts new file mode 100644 index 00000000..55204af9 --- /dev/null +++ b/libs/interchain-query/src/cosmos/auth/v1beta1/query.rpc.func.ts @@ -0,0 +1,113 @@ +import { RpcResolver, buildQuery } from "../../../helper-func-types"; +import { buildUseQuery } from "../../../react-query"; +import { QueryAccountsRequest, QueryAccountsResponse, QueryAccountRequest, QueryAccountResponse, QueryAccountAddressByIDRequest, QueryAccountAddressByIDResponse, QueryParamsRequest, QueryParamsResponse, QueryModuleAccountsRequest, QueryModuleAccountsResponse, QueryModuleAccountByNameRequest, QueryModuleAccountByNameResponse, Bech32PrefixRequest, Bech32PrefixResponse, AddressBytesToStringRequest, AddressBytesToStringResponse, AddressStringToBytesRequest, AddressStringToBytesResponse, QueryAccountInfoRequest, QueryAccountInfoResponse } from "./query"; +export const createGetAccounts = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryAccountsRequest.encode, + decode: QueryAccountsResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "Accounts", + clientResolver +}); +export const useGetAccounts = buildUseQuery({ + builderQueryFn: createGetAccounts, + queryKeyPrefix: "AccountsQuery" +}); +export const createGetAccount = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryAccountRequest.encode, + decode: QueryAccountResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "Account", + clientResolver +}); +export const useGetAccount = buildUseQuery({ + builderQueryFn: createGetAccount, + queryKeyPrefix: "AccountQuery" +}); +export const createGetAccountAddressByID = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryAccountAddressByIDRequest.encode, + decode: QueryAccountAddressByIDResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "AccountAddressByID", + clientResolver +}); +export const useGetAccountAddressByID = buildUseQuery({ + builderQueryFn: createGetAccountAddressByID, + queryKeyPrefix: "AccountAddressByIDQuery" +}); +export const createGetParams = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "Params", + clientResolver +}); +export const useGetParams = buildUseQuery({ + builderQueryFn: createGetParams, + queryKeyPrefix: "ParamsQuery" +}); +export const createGetModuleAccounts = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryModuleAccountsRequest.encode, + decode: QueryModuleAccountsResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "ModuleAccounts", + clientResolver +}); +export const useGetModuleAccounts = buildUseQuery({ + builderQueryFn: createGetModuleAccounts, + queryKeyPrefix: "ModuleAccountsQuery" +}); +export const createGetModuleAccountByName = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryModuleAccountByNameRequest.encode, + decode: QueryModuleAccountByNameResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "ModuleAccountByName", + clientResolver +}); +export const useGetModuleAccountByName = buildUseQuery({ + builderQueryFn: createGetModuleAccountByName, + queryKeyPrefix: "ModuleAccountByNameQuery" +}); +export const createGetBech32Prefix = (clientResolver?: RpcResolver) => buildQuery({ + encode: Bech32PrefixRequest.encode, + decode: Bech32PrefixResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "Bech32Prefix", + clientResolver +}); +export const useGetBech32Prefix = buildUseQuery({ + builderQueryFn: createGetBech32Prefix, + queryKeyPrefix: "Bech32PrefixQuery" +}); +export const createGetAddressBytesToString = (clientResolver?: RpcResolver) => buildQuery({ + encode: AddressBytesToStringRequest.encode, + decode: AddressBytesToStringResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "AddressBytesToString", + clientResolver +}); +export const useGetAddressBytesToString = buildUseQuery({ + builderQueryFn: createGetAddressBytesToString, + queryKeyPrefix: "AddressBytesToStringQuery" +}); +export const createGetAddressStringToBytes = (clientResolver?: RpcResolver) => buildQuery({ + encode: AddressStringToBytesRequest.encode, + decode: AddressStringToBytesResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "AddressStringToBytes", + clientResolver +}); +export const useGetAddressStringToBytes = buildUseQuery({ + builderQueryFn: createGetAddressStringToBytes, + queryKeyPrefix: "AddressStringToBytesQuery" +}); +export const createGetAccountInfo = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryAccountInfoRequest.encode, + decode: QueryAccountInfoResponse.decode, + service: "cosmos.auth.v1beta1.Query", + method: "AccountInfo", + clientResolver +}); +export const useGetAccountInfo = buildUseQuery({ + builderQueryFn: createGetAccountInfo, + queryKeyPrefix: "AccountInfoQuery" +}); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/auth/v1beta1/query.ts b/libs/interchain-query/src/cosmos/auth/v1beta1/query.ts new file mode 100644 index 00000000..92299eea --- /dev/null +++ b/libs/interchain-query/src/cosmos/auth/v1beta1/query.ts @@ -0,0 +1,2033 @@ +import { PageRequest, PageRequestAmino, PageResponse, PageResponseAmino } from "../../base/query/v1beta1/pagination"; +import { Any, AnyProtoMsg, AnyAmino } from "../../../google/protobuf/any"; +import { Params, ParamsAmino, BaseAccount, BaseAccountProtoMsg, BaseAccountAmino, ModuleAccount, ModuleAccountProtoMsg } from "./auth"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; +/** + * QueryAccountsRequest is the request type for the Query/Accounts RPC method. + * + * Since: cosmos-sdk 0.43 + */ +export interface QueryAccountsRequest { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryAccountsRequestProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountsRequest"; + value: Uint8Array; +} +/** + * QueryAccountsRequest is the request type for the Query/Accounts RPC method. + * + * Since: cosmos-sdk 0.43 + */ +export interface QueryAccountsRequestAmino { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryAccountsRequestAminoMsg { + type: "cosmos-sdk/QueryAccountsRequest"; + value: QueryAccountsRequestAmino; +} +/** + * QueryAccountsResponse is the response type for the Query/Accounts RPC method. + * + * Since: cosmos-sdk 0.43 + */ +export interface QueryAccountsResponse { + /** accounts are the existing accounts */ + accounts: (BaseAccount | Any)[] | Any[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryAccountsResponseProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountsResponse"; + value: Uint8Array; +} +export type QueryAccountsResponseEncoded = Omit & { + /** accounts are the existing accounts */accounts: (BaseAccountProtoMsg | AnyProtoMsg)[]; +}; +/** + * QueryAccountsResponse is the response type for the Query/Accounts RPC method. + * + * Since: cosmos-sdk 0.43 + */ +export interface QueryAccountsResponseAmino { + /** accounts are the existing accounts */ + accounts: AnyAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryAccountsResponseAminoMsg { + type: "cosmos-sdk/QueryAccountsResponse"; + value: QueryAccountsResponseAmino; +} +/** QueryAccountRequest is the request type for the Query/Account RPC method. */ +export interface QueryAccountRequest { + /** address defines the address to query for. */ + address: string; +} +export interface QueryAccountRequestProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountRequest"; + value: Uint8Array; +} +/** QueryAccountRequest is the request type for the Query/Account RPC method. */ +export interface QueryAccountRequestAmino { + /** address defines the address to query for. */ + address: string; +} +export interface QueryAccountRequestAminoMsg { + type: "cosmos-sdk/QueryAccountRequest"; + value: QueryAccountRequestAmino; +} +/** QueryAccountResponse is the response type for the Query/Account RPC method. */ +export interface QueryAccountResponse { + /** account defines the account of the corresponding address. */ + account?: BaseAccount | Any | undefined; +} +export interface QueryAccountResponseProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountResponse"; + value: Uint8Array; +} +export type QueryAccountResponseEncoded = Omit & { + /** account defines the account of the corresponding address. */account?: BaseAccountProtoMsg | AnyProtoMsg | undefined; +}; +/** QueryAccountResponse is the response type for the Query/Account RPC method. */ +export interface QueryAccountResponseAmino { + /** account defines the account of the corresponding address. */ + account?: AnyAmino; +} +export interface QueryAccountResponseAminoMsg { + type: "cosmos-sdk/QueryAccountResponse"; + value: QueryAccountResponseAmino; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequest {} +export interface QueryParamsRequestProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.QueryParamsRequest"; + value: Uint8Array; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequestAmino {} +export interface QueryParamsRequestAminoMsg { + type: "cosmos-sdk/QueryParamsRequest"; + value: QueryParamsRequestAmino; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** params defines the parameters of the module. */ + params: Params; +} +export interface QueryParamsResponseProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.QueryParamsResponse"; + value: Uint8Array; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponseAmino { + /** params defines the parameters of the module. */ + params: ParamsAmino; +} +export interface QueryParamsResponseAminoMsg { + type: "cosmos-sdk/QueryParamsResponse"; + value: QueryParamsResponseAmino; +} +/** + * QueryModuleAccountsRequest is the request type for the Query/ModuleAccounts RPC method. + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryModuleAccountsRequest {} +export interface QueryModuleAccountsRequestProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountsRequest"; + value: Uint8Array; +} +/** + * QueryModuleAccountsRequest is the request type for the Query/ModuleAccounts RPC method. + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryModuleAccountsRequestAmino {} +export interface QueryModuleAccountsRequestAminoMsg { + type: "cosmos-sdk/QueryModuleAccountsRequest"; + value: QueryModuleAccountsRequestAmino; +} +/** + * QueryModuleAccountsResponse is the response type for the Query/ModuleAccounts RPC method. + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryModuleAccountsResponse { + accounts: (ModuleAccount | Any)[] | Any[]; +} +export interface QueryModuleAccountsResponseProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountsResponse"; + value: Uint8Array; +} +export type QueryModuleAccountsResponseEncoded = Omit & { + accounts: (ModuleAccountProtoMsg | AnyProtoMsg)[]; +}; +/** + * QueryModuleAccountsResponse is the response type for the Query/ModuleAccounts RPC method. + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryModuleAccountsResponseAmino { + accounts: AnyAmino[]; +} +export interface QueryModuleAccountsResponseAminoMsg { + type: "cosmos-sdk/QueryModuleAccountsResponse"; + value: QueryModuleAccountsResponseAmino; +} +/** QueryModuleAccountByNameRequest is the request type for the Query/ModuleAccountByName RPC method. */ +export interface QueryModuleAccountByNameRequest { + name: string; +} +export interface QueryModuleAccountByNameRequestProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountByNameRequest"; + value: Uint8Array; +} +/** QueryModuleAccountByNameRequest is the request type for the Query/ModuleAccountByName RPC method. */ +export interface QueryModuleAccountByNameRequestAmino { + name: string; +} +export interface QueryModuleAccountByNameRequestAminoMsg { + type: "cosmos-sdk/QueryModuleAccountByNameRequest"; + value: QueryModuleAccountByNameRequestAmino; +} +/** QueryModuleAccountByNameResponse is the response type for the Query/ModuleAccountByName RPC method. */ +export interface QueryModuleAccountByNameResponse { + account?: ModuleAccount | Any | undefined; +} +export interface QueryModuleAccountByNameResponseProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountByNameResponse"; + value: Uint8Array; +} +export type QueryModuleAccountByNameResponseEncoded = Omit & { + account?: ModuleAccountProtoMsg | AnyProtoMsg | undefined; +}; +/** QueryModuleAccountByNameResponse is the response type for the Query/ModuleAccountByName RPC method. */ +export interface QueryModuleAccountByNameResponseAmino { + account?: AnyAmino; +} +export interface QueryModuleAccountByNameResponseAminoMsg { + type: "cosmos-sdk/QueryModuleAccountByNameResponse"; + value: QueryModuleAccountByNameResponseAmino; +} +/** + * Bech32PrefixRequest is the request type for Bech32Prefix rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface Bech32PrefixRequest {} +export interface Bech32PrefixRequestProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.Bech32PrefixRequest"; + value: Uint8Array; +} +/** + * Bech32PrefixRequest is the request type for Bech32Prefix rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface Bech32PrefixRequestAmino {} +export interface Bech32PrefixRequestAminoMsg { + type: "cosmos-sdk/Bech32PrefixRequest"; + value: Bech32PrefixRequestAmino; +} +/** + * Bech32PrefixResponse is the response type for Bech32Prefix rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface Bech32PrefixResponse { + bech32Prefix: string; +} +export interface Bech32PrefixResponseProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.Bech32PrefixResponse"; + value: Uint8Array; +} +/** + * Bech32PrefixResponse is the response type for Bech32Prefix rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface Bech32PrefixResponseAmino { + bech32_prefix: string; +} +export interface Bech32PrefixResponseAminoMsg { + type: "cosmos-sdk/Bech32PrefixResponse"; + value: Bech32PrefixResponseAmino; +} +/** + * AddressBytesToStringRequest is the request type for AddressString rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface AddressBytesToStringRequest { + addressBytes: Uint8Array; +} +export interface AddressBytesToStringRequestProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.AddressBytesToStringRequest"; + value: Uint8Array; +} +/** + * AddressBytesToStringRequest is the request type for AddressString rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface AddressBytesToStringRequestAmino { + address_bytes: string; +} +export interface AddressBytesToStringRequestAminoMsg { + type: "cosmos-sdk/AddressBytesToStringRequest"; + value: AddressBytesToStringRequestAmino; +} +/** + * AddressBytesToStringResponse is the response type for AddressString rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface AddressBytesToStringResponse { + addressString: string; +} +export interface AddressBytesToStringResponseProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.AddressBytesToStringResponse"; + value: Uint8Array; +} +/** + * AddressBytesToStringResponse is the response type for AddressString rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface AddressBytesToStringResponseAmino { + address_string: string; +} +export interface AddressBytesToStringResponseAminoMsg { + type: "cosmos-sdk/AddressBytesToStringResponse"; + value: AddressBytesToStringResponseAmino; +} +/** + * AddressStringToBytesRequest is the request type for AccountBytes rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface AddressStringToBytesRequest { + addressString: string; +} +export interface AddressStringToBytesRequestProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.AddressStringToBytesRequest"; + value: Uint8Array; +} +/** + * AddressStringToBytesRequest is the request type for AccountBytes rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface AddressStringToBytesRequestAmino { + address_string: string; +} +export interface AddressStringToBytesRequestAminoMsg { + type: "cosmos-sdk/AddressStringToBytesRequest"; + value: AddressStringToBytesRequestAmino; +} +/** + * AddressStringToBytesResponse is the response type for AddressBytes rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface AddressStringToBytesResponse { + addressBytes: Uint8Array; +} +export interface AddressStringToBytesResponseProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.AddressStringToBytesResponse"; + value: Uint8Array; +} +/** + * AddressStringToBytesResponse is the response type for AddressBytes rpc method. + * + * Since: cosmos-sdk 0.46 + */ +export interface AddressStringToBytesResponseAmino { + address_bytes: string; +} +export interface AddressStringToBytesResponseAminoMsg { + type: "cosmos-sdk/AddressStringToBytesResponse"; + value: AddressStringToBytesResponseAmino; +} +/** + * QueryAccountAddressByIDRequest is the request type for AccountAddressByID rpc method + * + * Since: cosmos-sdk 0.46.2 + */ +export interface QueryAccountAddressByIDRequest { + /** + * Deprecated, use account_id instead + * + * id is the account number of the address to be queried. This field + * should have been an uint64 (like all account numbers), and will be + * updated to uint64 in a future version of the auth query. + */ + /** @deprecated */ + id: bigint; + /** + * account_id is the account number of the address to be queried. + * + * Since: cosmos-sdk 0.47 + */ + accountId: bigint; +} +export interface QueryAccountAddressByIDRequestProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountAddressByIDRequest"; + value: Uint8Array; +} +/** + * QueryAccountAddressByIDRequest is the request type for AccountAddressByID rpc method + * + * Since: cosmos-sdk 0.46.2 + */ +export interface QueryAccountAddressByIDRequestAmino { + /** + * Deprecated, use account_id instead + * + * id is the account number of the address to be queried. This field + * should have been an uint64 (like all account numbers), and will be + * updated to uint64 in a future version of the auth query. + */ + /** @deprecated */ + id: string; + /** + * account_id is the account number of the address to be queried. + * + * Since: cosmos-sdk 0.47 + */ + account_id: string; +} +export interface QueryAccountAddressByIDRequestAminoMsg { + type: "cosmos-sdk/QueryAccountAddressByIDRequest"; + value: QueryAccountAddressByIDRequestAmino; +} +/** + * QueryAccountAddressByIDResponse is the response type for AccountAddressByID rpc method + * + * Since: cosmos-sdk 0.46.2 + */ +export interface QueryAccountAddressByIDResponse { + accountAddress: string; +} +export interface QueryAccountAddressByIDResponseProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountAddressByIDResponse"; + value: Uint8Array; +} +/** + * QueryAccountAddressByIDResponse is the response type for AccountAddressByID rpc method + * + * Since: cosmos-sdk 0.46.2 + */ +export interface QueryAccountAddressByIDResponseAmino { + account_address: string; +} +export interface QueryAccountAddressByIDResponseAminoMsg { + type: "cosmos-sdk/QueryAccountAddressByIDResponse"; + value: QueryAccountAddressByIDResponseAmino; +} +/** + * QueryAccountInfoRequest is the Query/AccountInfo request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface QueryAccountInfoRequest { + /** address is the account address string. */ + address: string; +} +export interface QueryAccountInfoRequestProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountInfoRequest"; + value: Uint8Array; +} +/** + * QueryAccountInfoRequest is the Query/AccountInfo request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface QueryAccountInfoRequestAmino { + /** address is the account address string. */ + address: string; +} +export interface QueryAccountInfoRequestAminoMsg { + type: "cosmos-sdk/QueryAccountInfoRequest"; + value: QueryAccountInfoRequestAmino; +} +/** + * QueryAccountInfoResponse is the Query/AccountInfo response type. + * + * Since: cosmos-sdk 0.47 + */ +export interface QueryAccountInfoResponse { + /** info is the account info which is represented by BaseAccount. */ + info?: BaseAccount; +} +export interface QueryAccountInfoResponseProtoMsg { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountInfoResponse"; + value: Uint8Array; +} +/** + * QueryAccountInfoResponse is the Query/AccountInfo response type. + * + * Since: cosmos-sdk 0.47 + */ +export interface QueryAccountInfoResponseAmino { + /** info is the account info which is represented by BaseAccount. */ + info?: BaseAccountAmino; +} +export interface QueryAccountInfoResponseAminoMsg { + type: "cosmos-sdk/QueryAccountInfoResponse"; + value: QueryAccountInfoResponseAmino; +} +function createBaseQueryAccountsRequest(): QueryAccountsRequest { + return { + pagination: undefined + }; +} +export const QueryAccountsRequest = { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountsRequest", + aminoType: "cosmos-sdk/QueryAccountsRequest", + is(o: any): o is QueryAccountsRequest { + return o && o.$typeUrl === QueryAccountsRequest.typeUrl; + }, + isAmino(o: any): o is QueryAccountsRequestAmino { + return o && o.$typeUrl === QueryAccountsRequest.typeUrl; + }, + encode(message: QueryAccountsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryAccountsRequest { + const message = createBaseQueryAccountsRequest(); + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryAccountsRequestAmino): QueryAccountsRequest { + const message = createBaseQueryAccountsRequest(); + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryAccountsRequest): QueryAccountsRequestAmino { + const obj: any = {}; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryAccountsRequestAminoMsg): QueryAccountsRequest { + return QueryAccountsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryAccountsRequest): QueryAccountsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryAccountsRequest", + value: QueryAccountsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAccountsRequestProtoMsg): QueryAccountsRequest { + return QueryAccountsRequest.decode(message.value); + }, + toProto(message: QueryAccountsRequest): Uint8Array { + return QueryAccountsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryAccountsRequest): QueryAccountsRequestProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountsRequest", + value: QueryAccountsRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryAccountsRequest.typeUrl, QueryAccountsRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryAccountsRequest.aminoType, QueryAccountsRequest.typeUrl); +function createBaseQueryAccountsResponse(): QueryAccountsResponse { + return { + accounts: [], + pagination: undefined + }; +} +export const QueryAccountsResponse = { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountsResponse", + aminoType: "cosmos-sdk/QueryAccountsResponse", + is(o: any): o is QueryAccountsResponse { + return o && (o.$typeUrl === QueryAccountsResponse.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || BaseAccount.is(o.accounts[0]) || Any.is(o.accounts[0]))); + }, + isAmino(o: any): o is QueryAccountsResponseAmino { + return o && (o.$typeUrl === QueryAccountsResponse.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || BaseAccount.isAmino(o.accounts[0]) || Any.isAmino(o.accounts[0]))); + }, + encode(message: QueryAccountsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.accounts) { + Any.encode(GlobalDecoderRegistry.wrapAny(v!), writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.accounts.push(GlobalDecoderRegistry.unwrapAny(reader)); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryAccountsResponse { + const message = createBaseQueryAccountsResponse(); + message.accounts = object.accounts?.map(e => (GlobalDecoderRegistry.fromPartial(e) as any)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryAccountsResponseAmino): QueryAccountsResponse { + const message = createBaseQueryAccountsResponse(); + message.accounts = object.accounts?.map(e => GlobalDecoderRegistry.fromAminoMsg(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryAccountsResponse): QueryAccountsResponseAmino { + const obj: any = {}; + if (message.accounts) { + obj.accounts = message.accounts.map(e => e ? GlobalDecoderRegistry.toAminoMsg(e) : undefined); + } else { + obj.accounts = message.accounts; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryAccountsResponseAminoMsg): QueryAccountsResponse { + return QueryAccountsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryAccountsResponse): QueryAccountsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryAccountsResponse", + value: QueryAccountsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAccountsResponseProtoMsg): QueryAccountsResponse { + return QueryAccountsResponse.decode(message.value); + }, + toProto(message: QueryAccountsResponse): Uint8Array { + return QueryAccountsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryAccountsResponse): QueryAccountsResponseProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountsResponse", + value: QueryAccountsResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryAccountsResponse.typeUrl, QueryAccountsResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryAccountsResponse.aminoType, QueryAccountsResponse.typeUrl); +function createBaseQueryAccountRequest(): QueryAccountRequest { + return { + address: "" + }; +} +export const QueryAccountRequest = { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountRequest", + aminoType: "cosmos-sdk/QueryAccountRequest", + is(o: any): o is QueryAccountRequest { + return o && (o.$typeUrl === QueryAccountRequest.typeUrl || typeof o.address === "string"); + }, + isAmino(o: any): o is QueryAccountRequestAmino { + return o && (o.$typeUrl === QueryAccountRequest.typeUrl || typeof o.address === "string"); + }, + encode(message: QueryAccountRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryAccountRequest { + const message = createBaseQueryAccountRequest(); + message.address = object.address ?? ""; + return message; + }, + fromAmino(object: QueryAccountRequestAmino): QueryAccountRequest { + const message = createBaseQueryAccountRequest(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + return message; + }, + toAmino(message: QueryAccountRequest): QueryAccountRequestAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + return obj; + }, + fromAminoMsg(object: QueryAccountRequestAminoMsg): QueryAccountRequest { + return QueryAccountRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryAccountRequest): QueryAccountRequestAminoMsg { + return { + type: "cosmos-sdk/QueryAccountRequest", + value: QueryAccountRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAccountRequestProtoMsg): QueryAccountRequest { + return QueryAccountRequest.decode(message.value); + }, + toProto(message: QueryAccountRequest): Uint8Array { + return QueryAccountRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryAccountRequest): QueryAccountRequestProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountRequest", + value: QueryAccountRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryAccountRequest.typeUrl, QueryAccountRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryAccountRequest.aminoType, QueryAccountRequest.typeUrl); +function createBaseQueryAccountResponse(): QueryAccountResponse { + return { + account: undefined + }; +} +export const QueryAccountResponse = { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountResponse", + aminoType: "cosmos-sdk/QueryAccountResponse", + is(o: any): o is QueryAccountResponse { + return o && o.$typeUrl === QueryAccountResponse.typeUrl; + }, + isAmino(o: any): o is QueryAccountResponseAmino { + return o && o.$typeUrl === QueryAccountResponse.typeUrl; + }, + encode(message: QueryAccountResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.account !== undefined) { + Any.encode(GlobalDecoderRegistry.wrapAny(message.account), writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.account = GlobalDecoderRegistry.unwrapAny(reader); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryAccountResponse { + const message = createBaseQueryAccountResponse(); + message.account = object.account !== undefined && object.account !== null ? GlobalDecoderRegistry.fromPartial(object.account) : undefined; + return message; + }, + fromAmino(object: QueryAccountResponseAmino): QueryAccountResponse { + const message = createBaseQueryAccountResponse(); + if (object.account !== undefined && object.account !== null) { + message.account = GlobalDecoderRegistry.fromAminoMsg(object.account); + } + return message; + }, + toAmino(message: QueryAccountResponse): QueryAccountResponseAmino { + const obj: any = {}; + obj.account = message.account ? GlobalDecoderRegistry.toAminoMsg(message.account) : undefined; + return obj; + }, + fromAminoMsg(object: QueryAccountResponseAminoMsg): QueryAccountResponse { + return QueryAccountResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryAccountResponse): QueryAccountResponseAminoMsg { + return { + type: "cosmos-sdk/QueryAccountResponse", + value: QueryAccountResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAccountResponseProtoMsg): QueryAccountResponse { + return QueryAccountResponse.decode(message.value); + }, + toProto(message: QueryAccountResponse): Uint8Array { + return QueryAccountResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryAccountResponse): QueryAccountResponseProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountResponse", + value: QueryAccountResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryAccountResponse.typeUrl, QueryAccountResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryAccountResponse.aminoType, QueryAccountResponse.typeUrl); +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} +export const QueryParamsRequest = { + typeUrl: "/cosmos.auth.v1beta1.QueryParamsRequest", + aminoType: "cosmos-sdk/QueryParamsRequest", + is(o: any): o is QueryParamsRequest { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, + fromAmino(_: QueryParamsRequestAmino): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, + toAmino(_: QueryParamsRequest): QueryParamsRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { + return QueryParamsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsRequest): QueryParamsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryParamsRequest", + value: QueryParamsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsRequestProtoMsg): QueryParamsRequest { + return QueryParamsRequest.decode(message.value); + }, + toProto(message: QueryParamsRequest): Uint8Array { + return QueryParamsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsRequest): QueryParamsRequestProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.QueryParamsRequest", + value: QueryParamsRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryParamsRequest.typeUrl, QueryParamsRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryParamsRequest.aminoType, QueryParamsRequest.typeUrl); +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { + params: Params.fromPartial({}) + }; +} +export const QueryParamsResponse = { + typeUrl: "/cosmos.auth.v1beta1.QueryParamsResponse", + aminoType: "cosmos-sdk/QueryParamsResponse", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.is(o.params)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isAmino(o.params)); + }, + encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: QueryParamsResponseAmino): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { + return QueryParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsResponse): QueryParamsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryParamsResponse", + value: QueryParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsResponseProtoMsg): QueryParamsResponse { + return QueryParamsResponse.decode(message.value); + }, + toProto(message: QueryParamsResponse): Uint8Array { + return QueryParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsResponse): QueryParamsResponseProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.QueryParamsResponse", + value: QueryParamsResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryParamsResponse.typeUrl, QueryParamsResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryParamsResponse.aminoType, QueryParamsResponse.typeUrl); +function createBaseQueryModuleAccountsRequest(): QueryModuleAccountsRequest { + return {}; +} +export const QueryModuleAccountsRequest = { + typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountsRequest", + aminoType: "cosmos-sdk/QueryModuleAccountsRequest", + is(o: any): o is QueryModuleAccountsRequest { + return o && o.$typeUrl === QueryModuleAccountsRequest.typeUrl; + }, + isAmino(o: any): o is QueryModuleAccountsRequestAmino { + return o && o.$typeUrl === QueryModuleAccountsRequest.typeUrl; + }, + encode(_: QueryModuleAccountsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryModuleAccountsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryModuleAccountsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): QueryModuleAccountsRequest { + const message = createBaseQueryModuleAccountsRequest(); + return message; + }, + fromAmino(_: QueryModuleAccountsRequestAmino): QueryModuleAccountsRequest { + const message = createBaseQueryModuleAccountsRequest(); + return message; + }, + toAmino(_: QueryModuleAccountsRequest): QueryModuleAccountsRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryModuleAccountsRequestAminoMsg): QueryModuleAccountsRequest { + return QueryModuleAccountsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryModuleAccountsRequest): QueryModuleAccountsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryModuleAccountsRequest", + value: QueryModuleAccountsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryModuleAccountsRequestProtoMsg): QueryModuleAccountsRequest { + return QueryModuleAccountsRequest.decode(message.value); + }, + toProto(message: QueryModuleAccountsRequest): Uint8Array { + return QueryModuleAccountsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryModuleAccountsRequest): QueryModuleAccountsRequestProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountsRequest", + value: QueryModuleAccountsRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryModuleAccountsRequest.typeUrl, QueryModuleAccountsRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryModuleAccountsRequest.aminoType, QueryModuleAccountsRequest.typeUrl); +function createBaseQueryModuleAccountsResponse(): QueryModuleAccountsResponse { + return { + accounts: [] + }; +} +export const QueryModuleAccountsResponse = { + typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountsResponse", + aminoType: "cosmos-sdk/QueryModuleAccountsResponse", + is(o: any): o is QueryModuleAccountsResponse { + return o && (o.$typeUrl === QueryModuleAccountsResponse.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || ModuleAccount.is(o.accounts[0]) || Any.is(o.accounts[0]))); + }, + isAmino(o: any): o is QueryModuleAccountsResponseAmino { + return o && (o.$typeUrl === QueryModuleAccountsResponse.typeUrl || Array.isArray(o.accounts) && (!o.accounts.length || ModuleAccount.isAmino(o.accounts[0]) || Any.isAmino(o.accounts[0]))); + }, + encode(message: QueryModuleAccountsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.accounts) { + Any.encode(GlobalDecoderRegistry.wrapAny(v!), writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryModuleAccountsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryModuleAccountsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.accounts.push(GlobalDecoderRegistry.unwrapAny(reader)); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryModuleAccountsResponse { + const message = createBaseQueryModuleAccountsResponse(); + message.accounts = object.accounts?.map(e => (GlobalDecoderRegistry.fromPartial(e) as any)) || []; + return message; + }, + fromAmino(object: QueryModuleAccountsResponseAmino): QueryModuleAccountsResponse { + const message = createBaseQueryModuleAccountsResponse(); + message.accounts = object.accounts?.map(e => GlobalDecoderRegistry.fromAminoMsg(e)) || []; + return message; + }, + toAmino(message: QueryModuleAccountsResponse): QueryModuleAccountsResponseAmino { + const obj: any = {}; + if (message.accounts) { + obj.accounts = message.accounts.map(e => e ? GlobalDecoderRegistry.toAminoMsg(e) : undefined); + } else { + obj.accounts = message.accounts; + } + return obj; + }, + fromAminoMsg(object: QueryModuleAccountsResponseAminoMsg): QueryModuleAccountsResponse { + return QueryModuleAccountsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryModuleAccountsResponse): QueryModuleAccountsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryModuleAccountsResponse", + value: QueryModuleAccountsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryModuleAccountsResponseProtoMsg): QueryModuleAccountsResponse { + return QueryModuleAccountsResponse.decode(message.value); + }, + toProto(message: QueryModuleAccountsResponse): Uint8Array { + return QueryModuleAccountsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryModuleAccountsResponse): QueryModuleAccountsResponseProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountsResponse", + value: QueryModuleAccountsResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryModuleAccountsResponse.typeUrl, QueryModuleAccountsResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryModuleAccountsResponse.aminoType, QueryModuleAccountsResponse.typeUrl); +function createBaseQueryModuleAccountByNameRequest(): QueryModuleAccountByNameRequest { + return { + name: "" + }; +} +export const QueryModuleAccountByNameRequest = { + typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountByNameRequest", + aminoType: "cosmos-sdk/QueryModuleAccountByNameRequest", + is(o: any): o is QueryModuleAccountByNameRequest { + return o && (o.$typeUrl === QueryModuleAccountByNameRequest.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is QueryModuleAccountByNameRequestAmino { + return o && (o.$typeUrl === QueryModuleAccountByNameRequest.typeUrl || typeof o.name === "string"); + }, + encode(message: QueryModuleAccountByNameRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryModuleAccountByNameRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryModuleAccountByNameRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryModuleAccountByNameRequest { + const message = createBaseQueryModuleAccountByNameRequest(); + message.name = object.name ?? ""; + return message; + }, + fromAmino(object: QueryModuleAccountByNameRequestAmino): QueryModuleAccountByNameRequest { + const message = createBaseQueryModuleAccountByNameRequest(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + return message; + }, + toAmino(message: QueryModuleAccountByNameRequest): QueryModuleAccountByNameRequestAmino { + const obj: any = {}; + obj.name = message.name === "" ? undefined : message.name; + return obj; + }, + fromAminoMsg(object: QueryModuleAccountByNameRequestAminoMsg): QueryModuleAccountByNameRequest { + return QueryModuleAccountByNameRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryModuleAccountByNameRequest): QueryModuleAccountByNameRequestAminoMsg { + return { + type: "cosmos-sdk/QueryModuleAccountByNameRequest", + value: QueryModuleAccountByNameRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryModuleAccountByNameRequestProtoMsg): QueryModuleAccountByNameRequest { + return QueryModuleAccountByNameRequest.decode(message.value); + }, + toProto(message: QueryModuleAccountByNameRequest): Uint8Array { + return QueryModuleAccountByNameRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryModuleAccountByNameRequest): QueryModuleAccountByNameRequestProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountByNameRequest", + value: QueryModuleAccountByNameRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryModuleAccountByNameRequest.typeUrl, QueryModuleAccountByNameRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryModuleAccountByNameRequest.aminoType, QueryModuleAccountByNameRequest.typeUrl); +function createBaseQueryModuleAccountByNameResponse(): QueryModuleAccountByNameResponse { + return { + account: undefined + }; +} +export const QueryModuleAccountByNameResponse = { + typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountByNameResponse", + aminoType: "cosmos-sdk/QueryModuleAccountByNameResponse", + is(o: any): o is QueryModuleAccountByNameResponse { + return o && o.$typeUrl === QueryModuleAccountByNameResponse.typeUrl; + }, + isAmino(o: any): o is QueryModuleAccountByNameResponseAmino { + return o && o.$typeUrl === QueryModuleAccountByNameResponse.typeUrl; + }, + encode(message: QueryModuleAccountByNameResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.account !== undefined) { + Any.encode(GlobalDecoderRegistry.wrapAny(message.account), writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryModuleAccountByNameResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryModuleAccountByNameResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.account = GlobalDecoderRegistry.unwrapAny(reader); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryModuleAccountByNameResponse { + const message = createBaseQueryModuleAccountByNameResponse(); + message.account = object.account !== undefined && object.account !== null ? GlobalDecoderRegistry.fromPartial(object.account) : undefined; + return message; + }, + fromAmino(object: QueryModuleAccountByNameResponseAmino): QueryModuleAccountByNameResponse { + const message = createBaseQueryModuleAccountByNameResponse(); + if (object.account !== undefined && object.account !== null) { + message.account = GlobalDecoderRegistry.fromAminoMsg(object.account); + } + return message; + }, + toAmino(message: QueryModuleAccountByNameResponse): QueryModuleAccountByNameResponseAmino { + const obj: any = {}; + obj.account = message.account ? GlobalDecoderRegistry.toAminoMsg(message.account) : undefined; + return obj; + }, + fromAminoMsg(object: QueryModuleAccountByNameResponseAminoMsg): QueryModuleAccountByNameResponse { + return QueryModuleAccountByNameResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryModuleAccountByNameResponse): QueryModuleAccountByNameResponseAminoMsg { + return { + type: "cosmos-sdk/QueryModuleAccountByNameResponse", + value: QueryModuleAccountByNameResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryModuleAccountByNameResponseProtoMsg): QueryModuleAccountByNameResponse { + return QueryModuleAccountByNameResponse.decode(message.value); + }, + toProto(message: QueryModuleAccountByNameResponse): Uint8Array { + return QueryModuleAccountByNameResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryModuleAccountByNameResponse): QueryModuleAccountByNameResponseProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.QueryModuleAccountByNameResponse", + value: QueryModuleAccountByNameResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryModuleAccountByNameResponse.typeUrl, QueryModuleAccountByNameResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryModuleAccountByNameResponse.aminoType, QueryModuleAccountByNameResponse.typeUrl); +function createBaseBech32PrefixRequest(): Bech32PrefixRequest { + return {}; +} +export const Bech32PrefixRequest = { + typeUrl: "/cosmos.auth.v1beta1.Bech32PrefixRequest", + aminoType: "cosmos-sdk/Bech32PrefixRequest", + is(o: any): o is Bech32PrefixRequest { + return o && o.$typeUrl === Bech32PrefixRequest.typeUrl; + }, + isAmino(o: any): o is Bech32PrefixRequestAmino { + return o && o.$typeUrl === Bech32PrefixRequest.typeUrl; + }, + encode(_: Bech32PrefixRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Bech32PrefixRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBech32PrefixRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): Bech32PrefixRequest { + const message = createBaseBech32PrefixRequest(); + return message; + }, + fromAmino(_: Bech32PrefixRequestAmino): Bech32PrefixRequest { + const message = createBaseBech32PrefixRequest(); + return message; + }, + toAmino(_: Bech32PrefixRequest): Bech32PrefixRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: Bech32PrefixRequestAminoMsg): Bech32PrefixRequest { + return Bech32PrefixRequest.fromAmino(object.value); + }, + toAminoMsg(message: Bech32PrefixRequest): Bech32PrefixRequestAminoMsg { + return { + type: "cosmos-sdk/Bech32PrefixRequest", + value: Bech32PrefixRequest.toAmino(message) + }; + }, + fromProtoMsg(message: Bech32PrefixRequestProtoMsg): Bech32PrefixRequest { + return Bech32PrefixRequest.decode(message.value); + }, + toProto(message: Bech32PrefixRequest): Uint8Array { + return Bech32PrefixRequest.encode(message).finish(); + }, + toProtoMsg(message: Bech32PrefixRequest): Bech32PrefixRequestProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.Bech32PrefixRequest", + value: Bech32PrefixRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Bech32PrefixRequest.typeUrl, Bech32PrefixRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(Bech32PrefixRequest.aminoType, Bech32PrefixRequest.typeUrl); +function createBaseBech32PrefixResponse(): Bech32PrefixResponse { + return { + bech32Prefix: "" + }; +} +export const Bech32PrefixResponse = { + typeUrl: "/cosmos.auth.v1beta1.Bech32PrefixResponse", + aminoType: "cosmos-sdk/Bech32PrefixResponse", + is(o: any): o is Bech32PrefixResponse { + return o && (o.$typeUrl === Bech32PrefixResponse.typeUrl || typeof o.bech32Prefix === "string"); + }, + isAmino(o: any): o is Bech32PrefixResponseAmino { + return o && (o.$typeUrl === Bech32PrefixResponse.typeUrl || typeof o.bech32_prefix === "string"); + }, + encode(message: Bech32PrefixResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.bech32Prefix !== "") { + writer.uint32(10).string(message.bech32Prefix); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Bech32PrefixResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBech32PrefixResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bech32Prefix = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Bech32PrefixResponse { + const message = createBaseBech32PrefixResponse(); + message.bech32Prefix = object.bech32Prefix ?? ""; + return message; + }, + fromAmino(object: Bech32PrefixResponseAmino): Bech32PrefixResponse { + const message = createBaseBech32PrefixResponse(); + if (object.bech32_prefix !== undefined && object.bech32_prefix !== null) { + message.bech32Prefix = object.bech32_prefix; + } + return message; + }, + toAmino(message: Bech32PrefixResponse): Bech32PrefixResponseAmino { + const obj: any = {}; + obj.bech32_prefix = message.bech32Prefix === "" ? undefined : message.bech32Prefix; + return obj; + }, + fromAminoMsg(object: Bech32PrefixResponseAminoMsg): Bech32PrefixResponse { + return Bech32PrefixResponse.fromAmino(object.value); + }, + toAminoMsg(message: Bech32PrefixResponse): Bech32PrefixResponseAminoMsg { + return { + type: "cosmos-sdk/Bech32PrefixResponse", + value: Bech32PrefixResponse.toAmino(message) + }; + }, + fromProtoMsg(message: Bech32PrefixResponseProtoMsg): Bech32PrefixResponse { + return Bech32PrefixResponse.decode(message.value); + }, + toProto(message: Bech32PrefixResponse): Uint8Array { + return Bech32PrefixResponse.encode(message).finish(); + }, + toProtoMsg(message: Bech32PrefixResponse): Bech32PrefixResponseProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.Bech32PrefixResponse", + value: Bech32PrefixResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Bech32PrefixResponse.typeUrl, Bech32PrefixResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(Bech32PrefixResponse.aminoType, Bech32PrefixResponse.typeUrl); +function createBaseAddressBytesToStringRequest(): AddressBytesToStringRequest { + return { + addressBytes: new Uint8Array() + }; +} +export const AddressBytesToStringRequest = { + typeUrl: "/cosmos.auth.v1beta1.AddressBytesToStringRequest", + aminoType: "cosmos-sdk/AddressBytesToStringRequest", + is(o: any): o is AddressBytesToStringRequest { + return o && (o.$typeUrl === AddressBytesToStringRequest.typeUrl || o.addressBytes instanceof Uint8Array || typeof o.addressBytes === "string"); + }, + isAmino(o: any): o is AddressBytesToStringRequestAmino { + return o && (o.$typeUrl === AddressBytesToStringRequest.typeUrl || o.address_bytes instanceof Uint8Array || typeof o.address_bytes === "string"); + }, + encode(message: AddressBytesToStringRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.addressBytes.length !== 0) { + writer.uint32(10).bytes(message.addressBytes); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AddressBytesToStringRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAddressBytesToStringRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.addressBytes = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): AddressBytesToStringRequest { + const message = createBaseAddressBytesToStringRequest(); + message.addressBytes = object.addressBytes ?? new Uint8Array(); + return message; + }, + fromAmino(object: AddressBytesToStringRequestAmino): AddressBytesToStringRequest { + const message = createBaseAddressBytesToStringRequest(); + if (object.address_bytes !== undefined && object.address_bytes !== null) { + message.addressBytes = bytesFromBase64(object.address_bytes); + } + return message; + }, + toAmino(message: AddressBytesToStringRequest): AddressBytesToStringRequestAmino { + const obj: any = {}; + obj.address_bytes = message.addressBytes ? base64FromBytes(message.addressBytes) : undefined; + return obj; + }, + fromAminoMsg(object: AddressBytesToStringRequestAminoMsg): AddressBytesToStringRequest { + return AddressBytesToStringRequest.fromAmino(object.value); + }, + toAminoMsg(message: AddressBytesToStringRequest): AddressBytesToStringRequestAminoMsg { + return { + type: "cosmos-sdk/AddressBytesToStringRequest", + value: AddressBytesToStringRequest.toAmino(message) + }; + }, + fromProtoMsg(message: AddressBytesToStringRequestProtoMsg): AddressBytesToStringRequest { + return AddressBytesToStringRequest.decode(message.value); + }, + toProto(message: AddressBytesToStringRequest): Uint8Array { + return AddressBytesToStringRequest.encode(message).finish(); + }, + toProtoMsg(message: AddressBytesToStringRequest): AddressBytesToStringRequestProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.AddressBytesToStringRequest", + value: AddressBytesToStringRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(AddressBytesToStringRequest.typeUrl, AddressBytesToStringRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(AddressBytesToStringRequest.aminoType, AddressBytesToStringRequest.typeUrl); +function createBaseAddressBytesToStringResponse(): AddressBytesToStringResponse { + return { + addressString: "" + }; +} +export const AddressBytesToStringResponse = { + typeUrl: "/cosmos.auth.v1beta1.AddressBytesToStringResponse", + aminoType: "cosmos-sdk/AddressBytesToStringResponse", + is(o: any): o is AddressBytesToStringResponse { + return o && (o.$typeUrl === AddressBytesToStringResponse.typeUrl || typeof o.addressString === "string"); + }, + isAmino(o: any): o is AddressBytesToStringResponseAmino { + return o && (o.$typeUrl === AddressBytesToStringResponse.typeUrl || typeof o.address_string === "string"); + }, + encode(message: AddressBytesToStringResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.addressString !== "") { + writer.uint32(10).string(message.addressString); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AddressBytesToStringResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAddressBytesToStringResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.addressString = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): AddressBytesToStringResponse { + const message = createBaseAddressBytesToStringResponse(); + message.addressString = object.addressString ?? ""; + return message; + }, + fromAmino(object: AddressBytesToStringResponseAmino): AddressBytesToStringResponse { + const message = createBaseAddressBytesToStringResponse(); + if (object.address_string !== undefined && object.address_string !== null) { + message.addressString = object.address_string; + } + return message; + }, + toAmino(message: AddressBytesToStringResponse): AddressBytesToStringResponseAmino { + const obj: any = {}; + obj.address_string = message.addressString === "" ? undefined : message.addressString; + return obj; + }, + fromAminoMsg(object: AddressBytesToStringResponseAminoMsg): AddressBytesToStringResponse { + return AddressBytesToStringResponse.fromAmino(object.value); + }, + toAminoMsg(message: AddressBytesToStringResponse): AddressBytesToStringResponseAminoMsg { + return { + type: "cosmos-sdk/AddressBytesToStringResponse", + value: AddressBytesToStringResponse.toAmino(message) + }; + }, + fromProtoMsg(message: AddressBytesToStringResponseProtoMsg): AddressBytesToStringResponse { + return AddressBytesToStringResponse.decode(message.value); + }, + toProto(message: AddressBytesToStringResponse): Uint8Array { + return AddressBytesToStringResponse.encode(message).finish(); + }, + toProtoMsg(message: AddressBytesToStringResponse): AddressBytesToStringResponseProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.AddressBytesToStringResponse", + value: AddressBytesToStringResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(AddressBytesToStringResponse.typeUrl, AddressBytesToStringResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(AddressBytesToStringResponse.aminoType, AddressBytesToStringResponse.typeUrl); +function createBaseAddressStringToBytesRequest(): AddressStringToBytesRequest { + return { + addressString: "" + }; +} +export const AddressStringToBytesRequest = { + typeUrl: "/cosmos.auth.v1beta1.AddressStringToBytesRequest", + aminoType: "cosmos-sdk/AddressStringToBytesRequest", + is(o: any): o is AddressStringToBytesRequest { + return o && (o.$typeUrl === AddressStringToBytesRequest.typeUrl || typeof o.addressString === "string"); + }, + isAmino(o: any): o is AddressStringToBytesRequestAmino { + return o && (o.$typeUrl === AddressStringToBytesRequest.typeUrl || typeof o.address_string === "string"); + }, + encode(message: AddressStringToBytesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.addressString !== "") { + writer.uint32(10).string(message.addressString); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AddressStringToBytesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAddressStringToBytesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.addressString = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): AddressStringToBytesRequest { + const message = createBaseAddressStringToBytesRequest(); + message.addressString = object.addressString ?? ""; + return message; + }, + fromAmino(object: AddressStringToBytesRequestAmino): AddressStringToBytesRequest { + const message = createBaseAddressStringToBytesRequest(); + if (object.address_string !== undefined && object.address_string !== null) { + message.addressString = object.address_string; + } + return message; + }, + toAmino(message: AddressStringToBytesRequest): AddressStringToBytesRequestAmino { + const obj: any = {}; + obj.address_string = message.addressString === "" ? undefined : message.addressString; + return obj; + }, + fromAminoMsg(object: AddressStringToBytesRequestAminoMsg): AddressStringToBytesRequest { + return AddressStringToBytesRequest.fromAmino(object.value); + }, + toAminoMsg(message: AddressStringToBytesRequest): AddressStringToBytesRequestAminoMsg { + return { + type: "cosmos-sdk/AddressStringToBytesRequest", + value: AddressStringToBytesRequest.toAmino(message) + }; + }, + fromProtoMsg(message: AddressStringToBytesRequestProtoMsg): AddressStringToBytesRequest { + return AddressStringToBytesRequest.decode(message.value); + }, + toProto(message: AddressStringToBytesRequest): Uint8Array { + return AddressStringToBytesRequest.encode(message).finish(); + }, + toProtoMsg(message: AddressStringToBytesRequest): AddressStringToBytesRequestProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.AddressStringToBytesRequest", + value: AddressStringToBytesRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(AddressStringToBytesRequest.typeUrl, AddressStringToBytesRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(AddressStringToBytesRequest.aminoType, AddressStringToBytesRequest.typeUrl); +function createBaseAddressStringToBytesResponse(): AddressStringToBytesResponse { + return { + addressBytes: new Uint8Array() + }; +} +export const AddressStringToBytesResponse = { + typeUrl: "/cosmos.auth.v1beta1.AddressStringToBytesResponse", + aminoType: "cosmos-sdk/AddressStringToBytesResponse", + is(o: any): o is AddressStringToBytesResponse { + return o && (o.$typeUrl === AddressStringToBytesResponse.typeUrl || o.addressBytes instanceof Uint8Array || typeof o.addressBytes === "string"); + }, + isAmino(o: any): o is AddressStringToBytesResponseAmino { + return o && (o.$typeUrl === AddressStringToBytesResponse.typeUrl || o.address_bytes instanceof Uint8Array || typeof o.address_bytes === "string"); + }, + encode(message: AddressStringToBytesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.addressBytes.length !== 0) { + writer.uint32(10).bytes(message.addressBytes); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AddressStringToBytesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAddressStringToBytesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.addressBytes = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): AddressStringToBytesResponse { + const message = createBaseAddressStringToBytesResponse(); + message.addressBytes = object.addressBytes ?? new Uint8Array(); + return message; + }, + fromAmino(object: AddressStringToBytesResponseAmino): AddressStringToBytesResponse { + const message = createBaseAddressStringToBytesResponse(); + if (object.address_bytes !== undefined && object.address_bytes !== null) { + message.addressBytes = bytesFromBase64(object.address_bytes); + } + return message; + }, + toAmino(message: AddressStringToBytesResponse): AddressStringToBytesResponseAmino { + const obj: any = {}; + obj.address_bytes = message.addressBytes ? base64FromBytes(message.addressBytes) : undefined; + return obj; + }, + fromAminoMsg(object: AddressStringToBytesResponseAminoMsg): AddressStringToBytesResponse { + return AddressStringToBytesResponse.fromAmino(object.value); + }, + toAminoMsg(message: AddressStringToBytesResponse): AddressStringToBytesResponseAminoMsg { + return { + type: "cosmos-sdk/AddressStringToBytesResponse", + value: AddressStringToBytesResponse.toAmino(message) + }; + }, + fromProtoMsg(message: AddressStringToBytesResponseProtoMsg): AddressStringToBytesResponse { + return AddressStringToBytesResponse.decode(message.value); + }, + toProto(message: AddressStringToBytesResponse): Uint8Array { + return AddressStringToBytesResponse.encode(message).finish(); + }, + toProtoMsg(message: AddressStringToBytesResponse): AddressStringToBytesResponseProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.AddressStringToBytesResponse", + value: AddressStringToBytesResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(AddressStringToBytesResponse.typeUrl, AddressStringToBytesResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(AddressStringToBytesResponse.aminoType, AddressStringToBytesResponse.typeUrl); +function createBaseQueryAccountAddressByIDRequest(): QueryAccountAddressByIDRequest { + return { + id: BigInt(0), + accountId: BigInt(0) + }; +} +export const QueryAccountAddressByIDRequest = { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountAddressByIDRequest", + aminoType: "cosmos-sdk/QueryAccountAddressByIDRequest", + is(o: any): o is QueryAccountAddressByIDRequest { + return o && (o.$typeUrl === QueryAccountAddressByIDRequest.typeUrl || typeof o.id === "bigint" && typeof o.accountId === "bigint"); + }, + isAmino(o: any): o is QueryAccountAddressByIDRequestAmino { + return o && (o.$typeUrl === QueryAccountAddressByIDRequest.typeUrl || typeof o.id === "bigint" && typeof o.account_id === "bigint"); + }, + encode(message: QueryAccountAddressByIDRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.id !== BigInt(0)) { + writer.uint32(8).int64(message.id); + } + if (message.accountId !== BigInt(0)) { + writer.uint32(16).uint64(message.accountId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountAddressByIDRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountAddressByIDRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.int64(); + break; + case 2: + message.accountId = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryAccountAddressByIDRequest { + const message = createBaseQueryAccountAddressByIDRequest(); + message.id = object.id !== undefined && object.id !== null ? BigInt(object.id.toString()) : BigInt(0); + message.accountId = object.accountId !== undefined && object.accountId !== null ? BigInt(object.accountId.toString()) : BigInt(0); + return message; + }, + fromAmino(object: QueryAccountAddressByIDRequestAmino): QueryAccountAddressByIDRequest { + const message = createBaseQueryAccountAddressByIDRequest(); + if (object.id !== undefined && object.id !== null) { + message.id = BigInt(object.id); + } + if (object.account_id !== undefined && object.account_id !== null) { + message.accountId = BigInt(object.account_id); + } + return message; + }, + toAmino(message: QueryAccountAddressByIDRequest): QueryAccountAddressByIDRequestAmino { + const obj: any = {}; + obj.id = message.id !== BigInt(0) ? message.id?.toString() : undefined; + obj.account_id = message.accountId !== BigInt(0) ? message.accountId?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QueryAccountAddressByIDRequestAminoMsg): QueryAccountAddressByIDRequest { + return QueryAccountAddressByIDRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryAccountAddressByIDRequest): QueryAccountAddressByIDRequestAminoMsg { + return { + type: "cosmos-sdk/QueryAccountAddressByIDRequest", + value: QueryAccountAddressByIDRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAccountAddressByIDRequestProtoMsg): QueryAccountAddressByIDRequest { + return QueryAccountAddressByIDRequest.decode(message.value); + }, + toProto(message: QueryAccountAddressByIDRequest): Uint8Array { + return QueryAccountAddressByIDRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryAccountAddressByIDRequest): QueryAccountAddressByIDRequestProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountAddressByIDRequest", + value: QueryAccountAddressByIDRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryAccountAddressByIDRequest.typeUrl, QueryAccountAddressByIDRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryAccountAddressByIDRequest.aminoType, QueryAccountAddressByIDRequest.typeUrl); +function createBaseQueryAccountAddressByIDResponse(): QueryAccountAddressByIDResponse { + return { + accountAddress: "" + }; +} +export const QueryAccountAddressByIDResponse = { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountAddressByIDResponse", + aminoType: "cosmos-sdk/QueryAccountAddressByIDResponse", + is(o: any): o is QueryAccountAddressByIDResponse { + return o && (o.$typeUrl === QueryAccountAddressByIDResponse.typeUrl || typeof o.accountAddress === "string"); + }, + isAmino(o: any): o is QueryAccountAddressByIDResponseAmino { + return o && (o.$typeUrl === QueryAccountAddressByIDResponse.typeUrl || typeof o.account_address === "string"); + }, + encode(message: QueryAccountAddressByIDResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.accountAddress !== "") { + writer.uint32(10).string(message.accountAddress); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountAddressByIDResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountAddressByIDResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.accountAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryAccountAddressByIDResponse { + const message = createBaseQueryAccountAddressByIDResponse(); + message.accountAddress = object.accountAddress ?? ""; + return message; + }, + fromAmino(object: QueryAccountAddressByIDResponseAmino): QueryAccountAddressByIDResponse { + const message = createBaseQueryAccountAddressByIDResponse(); + if (object.account_address !== undefined && object.account_address !== null) { + message.accountAddress = object.account_address; + } + return message; + }, + toAmino(message: QueryAccountAddressByIDResponse): QueryAccountAddressByIDResponseAmino { + const obj: any = {}; + obj.account_address = message.accountAddress === "" ? undefined : message.accountAddress; + return obj; + }, + fromAminoMsg(object: QueryAccountAddressByIDResponseAminoMsg): QueryAccountAddressByIDResponse { + return QueryAccountAddressByIDResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryAccountAddressByIDResponse): QueryAccountAddressByIDResponseAminoMsg { + return { + type: "cosmos-sdk/QueryAccountAddressByIDResponse", + value: QueryAccountAddressByIDResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAccountAddressByIDResponseProtoMsg): QueryAccountAddressByIDResponse { + return QueryAccountAddressByIDResponse.decode(message.value); + }, + toProto(message: QueryAccountAddressByIDResponse): Uint8Array { + return QueryAccountAddressByIDResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryAccountAddressByIDResponse): QueryAccountAddressByIDResponseProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountAddressByIDResponse", + value: QueryAccountAddressByIDResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryAccountAddressByIDResponse.typeUrl, QueryAccountAddressByIDResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryAccountAddressByIDResponse.aminoType, QueryAccountAddressByIDResponse.typeUrl); +function createBaseQueryAccountInfoRequest(): QueryAccountInfoRequest { + return { + address: "" + }; +} +export const QueryAccountInfoRequest = { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountInfoRequest", + aminoType: "cosmos-sdk/QueryAccountInfoRequest", + is(o: any): o is QueryAccountInfoRequest { + return o && (o.$typeUrl === QueryAccountInfoRequest.typeUrl || typeof o.address === "string"); + }, + isAmino(o: any): o is QueryAccountInfoRequestAmino { + return o && (o.$typeUrl === QueryAccountInfoRequest.typeUrl || typeof o.address === "string"); + }, + encode(message: QueryAccountInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryAccountInfoRequest { + const message = createBaseQueryAccountInfoRequest(); + message.address = object.address ?? ""; + return message; + }, + fromAmino(object: QueryAccountInfoRequestAmino): QueryAccountInfoRequest { + const message = createBaseQueryAccountInfoRequest(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + return message; + }, + toAmino(message: QueryAccountInfoRequest): QueryAccountInfoRequestAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + return obj; + }, + fromAminoMsg(object: QueryAccountInfoRequestAminoMsg): QueryAccountInfoRequest { + return QueryAccountInfoRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryAccountInfoRequest): QueryAccountInfoRequestAminoMsg { + return { + type: "cosmos-sdk/QueryAccountInfoRequest", + value: QueryAccountInfoRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAccountInfoRequestProtoMsg): QueryAccountInfoRequest { + return QueryAccountInfoRequest.decode(message.value); + }, + toProto(message: QueryAccountInfoRequest): Uint8Array { + return QueryAccountInfoRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryAccountInfoRequest): QueryAccountInfoRequestProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountInfoRequest", + value: QueryAccountInfoRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryAccountInfoRequest.typeUrl, QueryAccountInfoRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryAccountInfoRequest.aminoType, QueryAccountInfoRequest.typeUrl); +function createBaseQueryAccountInfoResponse(): QueryAccountInfoResponse { + return { + info: undefined + }; +} +export const QueryAccountInfoResponse = { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountInfoResponse", + aminoType: "cosmos-sdk/QueryAccountInfoResponse", + is(o: any): o is QueryAccountInfoResponse { + return o && o.$typeUrl === QueryAccountInfoResponse.typeUrl; + }, + isAmino(o: any): o is QueryAccountInfoResponseAmino { + return o && o.$typeUrl === QueryAccountInfoResponse.typeUrl; + }, + encode(message: QueryAccountInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.info !== undefined) { + BaseAccount.encode(message.info, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryAccountInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAccountInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.info = BaseAccount.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryAccountInfoResponse { + const message = createBaseQueryAccountInfoResponse(); + message.info = object.info !== undefined && object.info !== null ? BaseAccount.fromPartial(object.info) : undefined; + return message; + }, + fromAmino(object: QueryAccountInfoResponseAmino): QueryAccountInfoResponse { + const message = createBaseQueryAccountInfoResponse(); + if (object.info !== undefined && object.info !== null) { + message.info = BaseAccount.fromAmino(object.info); + } + return message; + }, + toAmino(message: QueryAccountInfoResponse): QueryAccountInfoResponseAmino { + const obj: any = {}; + obj.info = message.info ? BaseAccount.toAmino(message.info) : undefined; + return obj; + }, + fromAminoMsg(object: QueryAccountInfoResponseAminoMsg): QueryAccountInfoResponse { + return QueryAccountInfoResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryAccountInfoResponse): QueryAccountInfoResponseAminoMsg { + return { + type: "cosmos-sdk/QueryAccountInfoResponse", + value: QueryAccountInfoResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAccountInfoResponseProtoMsg): QueryAccountInfoResponse { + return QueryAccountInfoResponse.decode(message.value); + }, + toProto(message: QueryAccountInfoResponse): Uint8Array { + return QueryAccountInfoResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryAccountInfoResponse): QueryAccountInfoResponseProtoMsg { + return { + typeUrl: "/cosmos.auth.v1beta1.QueryAccountInfoResponse", + value: QueryAccountInfoResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryAccountInfoResponse.typeUrl, QueryAccountInfoResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryAccountInfoResponse.aminoType, QueryAccountInfoResponse.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/authz/v1beta1/authz.ts b/libs/interchain-query/src/cosmos/authz/v1beta1/authz.ts new file mode 100644 index 00000000..e71c3fee --- /dev/null +++ b/libs/interchain-query/src/cosmos/authz/v1beta1/authz.ts @@ -0,0 +1,477 @@ +import { Any, AnyProtoMsg, AnyAmino } from "../../../google/protobuf/any"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; +/** + * GenericAuthorization gives the grantee unrestricted permissions to execute + * the provided method on behalf of the granter's account. + */ +export interface GenericAuthorization { + /** Msg, identified by it's type URL, to grant unrestricted permissions to execute */ + msg: string; +} +export interface GenericAuthorizationProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.GenericAuthorization"; + value: Uint8Array; +} +/** + * GenericAuthorization gives the grantee unrestricted permissions to execute + * the provided method on behalf of the granter's account. + */ +export interface GenericAuthorizationAmino { + /** Msg, identified by it's type URL, to grant unrestricted permissions to execute */ + msg: string; +} +export interface GenericAuthorizationAminoMsg { + type: "cosmos-sdk/GenericAuthorization"; + value: GenericAuthorizationAmino; +} +/** + * Grant gives permissions to execute + * the provide method with expiration time. + */ +export interface Grant { + authorization?: GenericAuthorization | Any | undefined; + /** + * time when the grant will expire and will be pruned. If null, then the grant + * doesn't have a time expiration (other conditions in `authorization` + * may apply to invalidate the grant) + */ + expiration?: Date; +} +export interface GrantProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.Grant"; + value: Uint8Array; +} +export type GrantEncoded = Omit & { + authorization?: GenericAuthorizationProtoMsg | AnyProtoMsg | undefined; +}; +/** + * Grant gives permissions to execute + * the provide method with expiration time. + */ +export interface GrantAmino { + authorization?: AnyAmino; + /** + * time when the grant will expire and will be pruned. If null, then the grant + * doesn't have a time expiration (other conditions in `authorization` + * may apply to invalidate the grant) + */ + expiration?: string; +} +export interface GrantAminoMsg { + type: "cosmos-sdk/Grant"; + value: GrantAmino; +} +/** + * GrantAuthorization extends a grant with both the addresses of the grantee and granter. + * It is used in genesis.proto and query.proto + */ +export interface GrantAuthorization { + granter: string; + grantee: string; + authorization?: GenericAuthorization | Any | undefined; + expiration?: Date; +} +export interface GrantAuthorizationProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.GrantAuthorization"; + value: Uint8Array; +} +export type GrantAuthorizationEncoded = Omit & { + authorization?: GenericAuthorizationProtoMsg | AnyProtoMsg | undefined; +}; +/** + * GrantAuthorization extends a grant with both the addresses of the grantee and granter. + * It is used in genesis.proto and query.proto + */ +export interface GrantAuthorizationAmino { + granter: string; + grantee: string; + authorization?: AnyAmino; + expiration?: string; +} +export interface GrantAuthorizationAminoMsg { + type: "cosmos-sdk/GrantAuthorization"; + value: GrantAuthorizationAmino; +} +/** GrantQueueItem contains the list of TypeURL of a sdk.Msg. */ +export interface GrantQueueItem { + /** msg_type_urls contains the list of TypeURL of a sdk.Msg. */ + msgTypeUrls: string[]; +} +export interface GrantQueueItemProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.GrantQueueItem"; + value: Uint8Array; +} +/** GrantQueueItem contains the list of TypeURL of a sdk.Msg. */ +export interface GrantQueueItemAmino { + /** msg_type_urls contains the list of TypeURL of a sdk.Msg. */ + msg_type_urls: string[]; +} +export interface GrantQueueItemAminoMsg { + type: "cosmos-sdk/GrantQueueItem"; + value: GrantQueueItemAmino; +} +function createBaseGenericAuthorization(): GenericAuthorization { + return { + msg: "" + }; +} +export const GenericAuthorization = { + typeUrl: "/cosmos.authz.v1beta1.GenericAuthorization", + aminoType: "cosmos-sdk/GenericAuthorization", + is(o: any): o is GenericAuthorization { + return o && (o.$typeUrl === GenericAuthorization.typeUrl || typeof o.msg === "string"); + }, + isAmino(o: any): o is GenericAuthorizationAmino { + return o && (o.$typeUrl === GenericAuthorization.typeUrl || typeof o.msg === "string"); + }, + encode(message: GenericAuthorization, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.msg !== "") { + writer.uint32(10).string(message.msg); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GenericAuthorization { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenericAuthorization(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.msg = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): GenericAuthorization { + const message = createBaseGenericAuthorization(); + message.msg = object.msg ?? ""; + return message; + }, + fromAmino(object: GenericAuthorizationAmino): GenericAuthorization { + const message = createBaseGenericAuthorization(); + if (object.msg !== undefined && object.msg !== null) { + message.msg = object.msg; + } + return message; + }, + toAmino(message: GenericAuthorization): GenericAuthorizationAmino { + const obj: any = {}; + obj.msg = message.msg === "" ? undefined : message.msg; + return obj; + }, + fromAminoMsg(object: GenericAuthorizationAminoMsg): GenericAuthorization { + return GenericAuthorization.fromAmino(object.value); + }, + toAminoMsg(message: GenericAuthorization): GenericAuthorizationAminoMsg { + return { + type: "cosmos-sdk/GenericAuthorization", + value: GenericAuthorization.toAmino(message) + }; + }, + fromProtoMsg(message: GenericAuthorizationProtoMsg): GenericAuthorization { + return GenericAuthorization.decode(message.value); + }, + toProto(message: GenericAuthorization): Uint8Array { + return GenericAuthorization.encode(message).finish(); + }, + toProtoMsg(message: GenericAuthorization): GenericAuthorizationProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.GenericAuthorization", + value: GenericAuthorization.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(GenericAuthorization.typeUrl, GenericAuthorization); +GlobalDecoderRegistry.registerAminoProtoMapping(GenericAuthorization.aminoType, GenericAuthorization.typeUrl); +function createBaseGrant(): Grant { + return { + authorization: undefined, + expiration: undefined + }; +} +export const Grant = { + typeUrl: "/cosmos.authz.v1beta1.Grant", + aminoType: "cosmos-sdk/Grant", + is(o: any): o is Grant { + return o && o.$typeUrl === Grant.typeUrl; + }, + isAmino(o: any): o is GrantAmino { + return o && o.$typeUrl === Grant.typeUrl; + }, + encode(message: Grant, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authorization !== undefined) { + Any.encode(GlobalDecoderRegistry.wrapAny(message.authorization), writer.uint32(10).fork()).ldelim(); + } + if (message.expiration !== undefined) { + Timestamp.encode(toTimestamp(message.expiration), writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Grant { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGrant(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authorization = GlobalDecoderRegistry.unwrapAny(reader); + break; + case 2: + message.expiration = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Grant { + const message = createBaseGrant(); + message.authorization = object.authorization !== undefined && object.authorization !== null ? GlobalDecoderRegistry.fromPartial(object.authorization) : undefined; + message.expiration = object.expiration ?? undefined; + return message; + }, + fromAmino(object: GrantAmino): Grant { + const message = createBaseGrant(); + if (object.authorization !== undefined && object.authorization !== null) { + message.authorization = GlobalDecoderRegistry.fromAminoMsg(object.authorization); + } + if (object.expiration !== undefined && object.expiration !== null) { + message.expiration = fromTimestamp(Timestamp.fromAmino(object.expiration)); + } + return message; + }, + toAmino(message: Grant): GrantAmino { + const obj: any = {}; + obj.authorization = message.authorization ? GlobalDecoderRegistry.toAminoMsg(message.authorization) : undefined; + obj.expiration = message.expiration ? Timestamp.toAmino(toTimestamp(message.expiration)) : undefined; + return obj; + }, + fromAminoMsg(object: GrantAminoMsg): Grant { + return Grant.fromAmino(object.value); + }, + toAminoMsg(message: Grant): GrantAminoMsg { + return { + type: "cosmos-sdk/Grant", + value: Grant.toAmino(message) + }; + }, + fromProtoMsg(message: GrantProtoMsg): Grant { + return Grant.decode(message.value); + }, + toProto(message: Grant): Uint8Array { + return Grant.encode(message).finish(); + }, + toProtoMsg(message: Grant): GrantProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.Grant", + value: Grant.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Grant.typeUrl, Grant); +GlobalDecoderRegistry.registerAminoProtoMapping(Grant.aminoType, Grant.typeUrl); +function createBaseGrantAuthorization(): GrantAuthorization { + return { + granter: "", + grantee: "", + authorization: undefined, + expiration: undefined + }; +} +export const GrantAuthorization = { + typeUrl: "/cosmos.authz.v1beta1.GrantAuthorization", + aminoType: "cosmos-sdk/GrantAuthorization", + is(o: any): o is GrantAuthorization { + return o && (o.$typeUrl === GrantAuthorization.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string"); + }, + isAmino(o: any): o is GrantAuthorizationAmino { + return o && (o.$typeUrl === GrantAuthorization.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string"); + }, + encode(message: GrantAuthorization, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.authorization !== undefined) { + Any.encode(GlobalDecoderRegistry.wrapAny(message.authorization), writer.uint32(26).fork()).ldelim(); + } + if (message.expiration !== undefined) { + Timestamp.encode(toTimestamp(message.expiration), writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GrantAuthorization { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGrantAuthorization(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.granter = reader.string(); + break; + case 2: + message.grantee = reader.string(); + break; + case 3: + message.authorization = GlobalDecoderRegistry.unwrapAny(reader); + break; + case 4: + message.expiration = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): GrantAuthorization { + const message = createBaseGrantAuthorization(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.authorization = object.authorization !== undefined && object.authorization !== null ? GlobalDecoderRegistry.fromPartial(object.authorization) : undefined; + message.expiration = object.expiration ?? undefined; + return message; + }, + fromAmino(object: GrantAuthorizationAmino): GrantAuthorization { + const message = createBaseGrantAuthorization(); + if (object.granter !== undefined && object.granter !== null) { + message.granter = object.granter; + } + if (object.grantee !== undefined && object.grantee !== null) { + message.grantee = object.grantee; + } + if (object.authorization !== undefined && object.authorization !== null) { + message.authorization = GlobalDecoderRegistry.fromAminoMsg(object.authorization); + } + if (object.expiration !== undefined && object.expiration !== null) { + message.expiration = fromTimestamp(Timestamp.fromAmino(object.expiration)); + } + return message; + }, + toAmino(message: GrantAuthorization): GrantAuthorizationAmino { + const obj: any = {}; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; + obj.authorization = message.authorization ? GlobalDecoderRegistry.toAminoMsg(message.authorization) : undefined; + obj.expiration = message.expiration ? Timestamp.toAmino(toTimestamp(message.expiration)) : undefined; + return obj; + }, + fromAminoMsg(object: GrantAuthorizationAminoMsg): GrantAuthorization { + return GrantAuthorization.fromAmino(object.value); + }, + toAminoMsg(message: GrantAuthorization): GrantAuthorizationAminoMsg { + return { + type: "cosmos-sdk/GrantAuthorization", + value: GrantAuthorization.toAmino(message) + }; + }, + fromProtoMsg(message: GrantAuthorizationProtoMsg): GrantAuthorization { + return GrantAuthorization.decode(message.value); + }, + toProto(message: GrantAuthorization): Uint8Array { + return GrantAuthorization.encode(message).finish(); + }, + toProtoMsg(message: GrantAuthorization): GrantAuthorizationProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.GrantAuthorization", + value: GrantAuthorization.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(GrantAuthorization.typeUrl, GrantAuthorization); +GlobalDecoderRegistry.registerAminoProtoMapping(GrantAuthorization.aminoType, GrantAuthorization.typeUrl); +function createBaseGrantQueueItem(): GrantQueueItem { + return { + msgTypeUrls: [] + }; +} +export const GrantQueueItem = { + typeUrl: "/cosmos.authz.v1beta1.GrantQueueItem", + aminoType: "cosmos-sdk/GrantQueueItem", + is(o: any): o is GrantQueueItem { + return o && (o.$typeUrl === GrantQueueItem.typeUrl || Array.isArray(o.msgTypeUrls) && (!o.msgTypeUrls.length || typeof o.msgTypeUrls[0] === "string")); + }, + isAmino(o: any): o is GrantQueueItemAmino { + return o && (o.$typeUrl === GrantQueueItem.typeUrl || Array.isArray(o.msg_type_urls) && (!o.msg_type_urls.length || typeof o.msg_type_urls[0] === "string")); + }, + encode(message: GrantQueueItem, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.msgTypeUrls) { + writer.uint32(10).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GrantQueueItem { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGrantQueueItem(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.msgTypeUrls.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): GrantQueueItem { + const message = createBaseGrantQueueItem(); + message.msgTypeUrls = object.msgTypeUrls?.map(e => e) || []; + return message; + }, + fromAmino(object: GrantQueueItemAmino): GrantQueueItem { + const message = createBaseGrantQueueItem(); + message.msgTypeUrls = object.msg_type_urls?.map(e => e) || []; + return message; + }, + toAmino(message: GrantQueueItem): GrantQueueItemAmino { + const obj: any = {}; + if (message.msgTypeUrls) { + obj.msg_type_urls = message.msgTypeUrls.map(e => e); + } else { + obj.msg_type_urls = message.msgTypeUrls; + } + return obj; + }, + fromAminoMsg(object: GrantQueueItemAminoMsg): GrantQueueItem { + return GrantQueueItem.fromAmino(object.value); + }, + toAminoMsg(message: GrantQueueItem): GrantQueueItemAminoMsg { + return { + type: "cosmos-sdk/GrantQueueItem", + value: GrantQueueItem.toAmino(message) + }; + }, + fromProtoMsg(message: GrantQueueItemProtoMsg): GrantQueueItem { + return GrantQueueItem.decode(message.value); + }, + toProto(message: GrantQueueItem): Uint8Array { + return GrantQueueItem.encode(message).finish(); + }, + toProtoMsg(message: GrantQueueItem): GrantQueueItemProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.GrantQueueItem", + value: GrantQueueItem.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(GrantQueueItem.typeUrl, GrantQueueItem); +GlobalDecoderRegistry.registerAminoProtoMapping(GrantQueueItem.aminoType, GrantQueueItem.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/authz/v1beta1/tx.rpc.func.ts b/libs/interchain-query/src/cosmos/authz/v1beta1/tx.rpc.func.ts new file mode 100644 index 00000000..de818f66 --- /dev/null +++ b/libs/interchain-query/src/cosmos/authz/v1beta1/tx.rpc.func.ts @@ -0,0 +1,31 @@ +import { buildTx, SigningClientResolver } from "../../../helper-func-types"; +import { buildUseMutation } from "../../../react-query"; +import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; +import { MsgGrant, MsgExec, MsgRevoke } from "./tx"; +export const createGrant = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgGrant.typeUrl, + encoders: toEncoders(MsgGrant), + converters: toConverters(MsgGrant) +}); +export const useGrant = buildUseMutation({ + builderMutationFn: createGrant +}); +export const createExec = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgExec.typeUrl, + encoders: toEncoders(MsgExec), + converters: toConverters(MsgExec) +}); +export const useExec = buildUseMutation({ + builderMutationFn: createExec +}); +export const createRevoke = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgRevoke.typeUrl, + encoders: toEncoders(MsgRevoke), + converters: toConverters(MsgRevoke) +}); +export const useRevoke = buildUseMutation({ + builderMutationFn: createRevoke +}); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/authz/v1beta1/tx.ts b/libs/interchain-query/src/cosmos/authz/v1beta1/tx.ts new file mode 100644 index 00000000..80640ebe --- /dev/null +++ b/libs/interchain-query/src/cosmos/authz/v1beta1/tx.ts @@ -0,0 +1,647 @@ +import { Grant, GrantAmino } from "./authz"; +import { Any, AnyProtoMsg, AnyAmino } from "../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; +/** + * MsgGrant is a request type for Grant method. It declares authorization to the grantee + * on behalf of the granter with the provided expiration time. + */ +export interface MsgGrant { + granter: string; + grantee: string; + grant: Grant; +} +export interface MsgGrantProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.MsgGrant"; + value: Uint8Array; +} +/** + * MsgGrant is a request type for Grant method. It declares authorization to the grantee + * on behalf of the granter with the provided expiration time. + */ +export interface MsgGrantAmino { + granter: string; + grantee: string; + grant: GrantAmino; +} +export interface MsgGrantAminoMsg { + type: "cosmos-sdk/MsgGrant"; + value: MsgGrantAmino; +} +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgGrantResponse {} +export interface MsgGrantResponseProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.MsgGrantResponse"; + value: Uint8Array; +} +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgGrantResponseAmino {} +export interface MsgGrantResponseAminoMsg { + type: "cosmos-sdk/MsgGrantResponse"; + value: MsgGrantResponseAmino; +} +/** + * MsgExec attempts to execute the provided messages using + * authorizations granted to the grantee. Each message should have only + * one signer corresponding to the granter of the authorization. + */ +export interface MsgExec { + grantee: string; + /** + * Execute Msg. + * The x/authz will try to find a grant matching (msg.signers[0], grantee, MsgTypeURL(msg)) + * triple and validate it. + */ + msgs: (Any)[] | Any[]; +} +export interface MsgExecProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.MsgExec"; + value: Uint8Array; +} +export type MsgExecEncoded = Omit & { + /** + * Execute Msg. + * The x/authz will try to find a grant matching (msg.signers[0], grantee, MsgTypeURL(msg)) + * triple and validate it. + */ + msgs: (AnyProtoMsg)[]; +}; +/** + * MsgExec attempts to execute the provided messages using + * authorizations granted to the grantee. Each message should have only + * one signer corresponding to the granter of the authorization. + */ +export interface MsgExecAmino { + grantee: string; + /** + * Execute Msg. + * The x/authz will try to find a grant matching (msg.signers[0], grantee, MsgTypeURL(msg)) + * triple and validate it. + */ + msgs: AnyAmino[]; +} +export interface MsgExecAminoMsg { + type: "cosmos-sdk/MsgExec"; + value: MsgExecAmino; +} +/** MsgExecResponse defines the Msg/MsgExecResponse response type. */ +export interface MsgExecResponse { + results: Uint8Array[]; +} +export interface MsgExecResponseProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.MsgExecResponse"; + value: Uint8Array; +} +/** MsgExecResponse defines the Msg/MsgExecResponse response type. */ +export interface MsgExecResponseAmino { + results: string[]; +} +export interface MsgExecResponseAminoMsg { + type: "cosmos-sdk/MsgExecResponse"; + value: MsgExecResponseAmino; +} +/** + * MsgRevoke revokes any authorization with the provided sdk.Msg type on the + * granter's account with that has been granted to the grantee. + */ +export interface MsgRevoke { + granter: string; + grantee: string; + msgTypeUrl: string; +} +export interface MsgRevokeProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.MsgRevoke"; + value: Uint8Array; +} +/** + * MsgRevoke revokes any authorization with the provided sdk.Msg type on the + * granter's account with that has been granted to the grantee. + */ +export interface MsgRevokeAmino { + granter: string; + grantee: string; + msg_type_url: string; +} +export interface MsgRevokeAminoMsg { + type: "cosmos-sdk/MsgRevoke"; + value: MsgRevokeAmino; +} +/** MsgRevokeResponse defines the Msg/MsgRevokeResponse response type. */ +export interface MsgRevokeResponse {} +export interface MsgRevokeResponseProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.MsgRevokeResponse"; + value: Uint8Array; +} +/** MsgRevokeResponse defines the Msg/MsgRevokeResponse response type. */ +export interface MsgRevokeResponseAmino {} +export interface MsgRevokeResponseAminoMsg { + type: "cosmos-sdk/MsgRevokeResponse"; + value: MsgRevokeResponseAmino; +} +function createBaseMsgGrant(): MsgGrant { + return { + granter: "", + grantee: "", + grant: Grant.fromPartial({}) + }; +} +export const MsgGrant = { + typeUrl: "/cosmos.authz.v1beta1.MsgGrant", + aminoType: "cosmos-sdk/MsgGrant", + is(o: any): o is MsgGrant { + return o && (o.$typeUrl === MsgGrant.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string" && Grant.is(o.grant)); + }, + isAmino(o: any): o is MsgGrantAmino { + return o && (o.$typeUrl === MsgGrant.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string" && Grant.isAmino(o.grant)); + }, + encode(message: MsgGrant, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.grant !== undefined) { + Grant.encode(message.grant, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgGrant { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGrant(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.granter = reader.string(); + break; + case 2: + message.grantee = reader.string(); + break; + case 3: + message.grant = Grant.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgGrant { + const message = createBaseMsgGrant(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.grant = object.grant !== undefined && object.grant !== null ? Grant.fromPartial(object.grant) : undefined; + return message; + }, + fromAmino(object: MsgGrantAmino): MsgGrant { + const message = createBaseMsgGrant(); + if (object.granter !== undefined && object.granter !== null) { + message.granter = object.granter; + } + if (object.grantee !== undefined && object.grantee !== null) { + message.grantee = object.grantee; + } + if (object.grant !== undefined && object.grant !== null) { + message.grant = Grant.fromAmino(object.grant); + } + return message; + }, + toAmino(message: MsgGrant): MsgGrantAmino { + const obj: any = {}; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; + obj.grant = message.grant ? Grant.toAmino(message.grant) : Grant.toAmino(Grant.fromPartial({})); + return obj; + }, + fromAminoMsg(object: MsgGrantAminoMsg): MsgGrant { + return MsgGrant.fromAmino(object.value); + }, + toAminoMsg(message: MsgGrant): MsgGrantAminoMsg { + return { + type: "cosmos-sdk/MsgGrant", + value: MsgGrant.toAmino(message) + }; + }, + fromProtoMsg(message: MsgGrantProtoMsg): MsgGrant { + return MsgGrant.decode(message.value); + }, + toProto(message: MsgGrant): Uint8Array { + return MsgGrant.encode(message).finish(); + }, + toProtoMsg(message: MsgGrant): MsgGrantProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgGrant", + value: MsgGrant.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgGrant.typeUrl, MsgGrant); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgGrant.aminoType, MsgGrant.typeUrl); +function createBaseMsgGrantResponse(): MsgGrantResponse { + return {}; +} +export const MsgGrantResponse = { + typeUrl: "/cosmos.authz.v1beta1.MsgGrantResponse", + aminoType: "cosmos-sdk/MsgGrantResponse", + is(o: any): o is MsgGrantResponse { + return o && o.$typeUrl === MsgGrantResponse.typeUrl; + }, + isAmino(o: any): o is MsgGrantResponseAmino { + return o && o.$typeUrl === MsgGrantResponse.typeUrl; + }, + encode(_: MsgGrantResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgGrantResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGrantResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgGrantResponse { + const message = createBaseMsgGrantResponse(); + return message; + }, + fromAmino(_: MsgGrantResponseAmino): MsgGrantResponse { + const message = createBaseMsgGrantResponse(); + return message; + }, + toAmino(_: MsgGrantResponse): MsgGrantResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgGrantResponseAminoMsg): MsgGrantResponse { + return MsgGrantResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgGrantResponse): MsgGrantResponseAminoMsg { + return { + type: "cosmos-sdk/MsgGrantResponse", + value: MsgGrantResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgGrantResponseProtoMsg): MsgGrantResponse { + return MsgGrantResponse.decode(message.value); + }, + toProto(message: MsgGrantResponse): Uint8Array { + return MsgGrantResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgGrantResponse): MsgGrantResponseProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgGrantResponse", + value: MsgGrantResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgGrantResponse.typeUrl, MsgGrantResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgGrantResponse.aminoType, MsgGrantResponse.typeUrl); +function createBaseMsgExec(): MsgExec { + return { + grantee: "", + msgs: [] + }; +} +export const MsgExec = { + typeUrl: "/cosmos.authz.v1beta1.MsgExec", + aminoType: "cosmos-sdk/MsgExec", + is(o: any): o is MsgExec { + return o && (o.$typeUrl === MsgExec.typeUrl || typeof o.grantee === "string" && Array.isArray(o.msgs) && (!o.msgs.length || Any.is(o.msgs[0]))); + }, + isAmino(o: any): o is MsgExecAmino { + return o && (o.$typeUrl === MsgExec.typeUrl || typeof o.grantee === "string" && Array.isArray(o.msgs) && (!o.msgs.length || Any.isAmino(o.msgs[0]))); + }, + encode(message: MsgExec, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.grantee !== "") { + writer.uint32(10).string(message.grantee); + } + for (const v of message.msgs) { + Any.encode(GlobalDecoderRegistry.wrapAny(v!), writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgExec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.grantee = reader.string(); + break; + case 2: + message.msgs.push(GlobalDecoderRegistry.unwrapAny(reader)); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgExec { + const message = createBaseMsgExec(); + message.grantee = object.grantee ?? ""; + message.msgs = object.msgs?.map(e => (GlobalDecoderRegistry.fromPartial(e) as any)) || []; + return message; + }, + fromAmino(object: MsgExecAmino): MsgExec { + const message = createBaseMsgExec(); + if (object.grantee !== undefined && object.grantee !== null) { + message.grantee = object.grantee; + } + message.msgs = object.msgs?.map(e => GlobalDecoderRegistry.fromAminoMsg(e)) || []; + return message; + }, + toAmino(message: MsgExec): MsgExecAmino { + const obj: any = {}; + obj.grantee = message.grantee === "" ? undefined : message.grantee; + if (message.msgs) { + obj.msgs = message.msgs.map(e => e ? GlobalDecoderRegistry.toAminoMsg(e) : undefined); + } else { + obj.msgs = message.msgs; + } + return obj; + }, + fromAminoMsg(object: MsgExecAminoMsg): MsgExec { + return MsgExec.fromAmino(object.value); + }, + toAminoMsg(message: MsgExec): MsgExecAminoMsg { + return { + type: "cosmos-sdk/MsgExec", + value: MsgExec.toAmino(message) + }; + }, + fromProtoMsg(message: MsgExecProtoMsg): MsgExec { + return MsgExec.decode(message.value); + }, + toProto(message: MsgExec): Uint8Array { + return MsgExec.encode(message).finish(); + }, + toProtoMsg(message: MsgExec): MsgExecProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgExec", + value: MsgExec.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgExec.typeUrl, MsgExec); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgExec.aminoType, MsgExec.typeUrl); +function createBaseMsgExecResponse(): MsgExecResponse { + return { + results: [] + }; +} +export const MsgExecResponse = { + typeUrl: "/cosmos.authz.v1beta1.MsgExecResponse", + aminoType: "cosmos-sdk/MsgExecResponse", + is(o: any): o is MsgExecResponse { + return o && (o.$typeUrl === MsgExecResponse.typeUrl || Array.isArray(o.results) && (!o.results.length || o.results[0] instanceof Uint8Array || typeof o.results[0] === "string")); + }, + isAmino(o: any): o is MsgExecResponseAmino { + return o && (o.$typeUrl === MsgExecResponse.typeUrl || Array.isArray(o.results) && (!o.results.length || o.results[0] instanceof Uint8Array || typeof o.results[0] === "string")); + }, + encode(message: MsgExecResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.results) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgExecResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExecResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.results.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgExecResponse { + const message = createBaseMsgExecResponse(); + message.results = object.results?.map(e => e) || []; + return message; + }, + fromAmino(object: MsgExecResponseAmino): MsgExecResponse { + const message = createBaseMsgExecResponse(); + message.results = object.results?.map(e => bytesFromBase64(e)) || []; + return message; + }, + toAmino(message: MsgExecResponse): MsgExecResponseAmino { + const obj: any = {}; + if (message.results) { + obj.results = message.results.map(e => base64FromBytes(e)); + } else { + obj.results = message.results; + } + return obj; + }, + fromAminoMsg(object: MsgExecResponseAminoMsg): MsgExecResponse { + return MsgExecResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgExecResponse): MsgExecResponseAminoMsg { + return { + type: "cosmos-sdk/MsgExecResponse", + value: MsgExecResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgExecResponseProtoMsg): MsgExecResponse { + return MsgExecResponse.decode(message.value); + }, + toProto(message: MsgExecResponse): Uint8Array { + return MsgExecResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgExecResponse): MsgExecResponseProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgExecResponse", + value: MsgExecResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgExecResponse.typeUrl, MsgExecResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgExecResponse.aminoType, MsgExecResponse.typeUrl); +function createBaseMsgRevoke(): MsgRevoke { + return { + granter: "", + grantee: "", + msgTypeUrl: "" + }; +} +export const MsgRevoke = { + typeUrl: "/cosmos.authz.v1beta1.MsgRevoke", + aminoType: "cosmos-sdk/MsgRevoke", + is(o: any): o is MsgRevoke { + return o && (o.$typeUrl === MsgRevoke.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string" && typeof o.msgTypeUrl === "string"); + }, + isAmino(o: any): o is MsgRevokeAmino { + return o && (o.$typeUrl === MsgRevoke.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string" && typeof o.msg_type_url === "string"); + }, + encode(message: MsgRevoke, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.msgTypeUrl !== "") { + writer.uint32(26).string(message.msgTypeUrl); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgRevoke { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRevoke(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.granter = reader.string(); + break; + case 2: + message.grantee = reader.string(); + break; + case 3: + message.msgTypeUrl = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgRevoke { + const message = createBaseMsgRevoke(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.msgTypeUrl = object.msgTypeUrl ?? ""; + return message; + }, + fromAmino(object: MsgRevokeAmino): MsgRevoke { + const message = createBaseMsgRevoke(); + if (object.granter !== undefined && object.granter !== null) { + message.granter = object.granter; + } + if (object.grantee !== undefined && object.grantee !== null) { + message.grantee = object.grantee; + } + if (object.msg_type_url !== undefined && object.msg_type_url !== null) { + message.msgTypeUrl = object.msg_type_url; + } + return message; + }, + toAmino(message: MsgRevoke): MsgRevokeAmino { + const obj: any = {}; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; + obj.msg_type_url = message.msgTypeUrl === "" ? undefined : message.msgTypeUrl; + return obj; + }, + fromAminoMsg(object: MsgRevokeAminoMsg): MsgRevoke { + return MsgRevoke.fromAmino(object.value); + }, + toAminoMsg(message: MsgRevoke): MsgRevokeAminoMsg { + return { + type: "cosmos-sdk/MsgRevoke", + value: MsgRevoke.toAmino(message) + }; + }, + fromProtoMsg(message: MsgRevokeProtoMsg): MsgRevoke { + return MsgRevoke.decode(message.value); + }, + toProto(message: MsgRevoke): Uint8Array { + return MsgRevoke.encode(message).finish(); + }, + toProtoMsg(message: MsgRevoke): MsgRevokeProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgRevoke", + value: MsgRevoke.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgRevoke.typeUrl, MsgRevoke); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgRevoke.aminoType, MsgRevoke.typeUrl); +function createBaseMsgRevokeResponse(): MsgRevokeResponse { + return {}; +} +export const MsgRevokeResponse = { + typeUrl: "/cosmos.authz.v1beta1.MsgRevokeResponse", + aminoType: "cosmos-sdk/MsgRevokeResponse", + is(o: any): o is MsgRevokeResponse { + return o && o.$typeUrl === MsgRevokeResponse.typeUrl; + }, + isAmino(o: any): o is MsgRevokeResponseAmino { + return o && o.$typeUrl === MsgRevokeResponse.typeUrl; + }, + encode(_: MsgRevokeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgRevokeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRevokeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgRevokeResponse { + const message = createBaseMsgRevokeResponse(); + return message; + }, + fromAmino(_: MsgRevokeResponseAmino): MsgRevokeResponse { + const message = createBaseMsgRevokeResponse(); + return message; + }, + toAmino(_: MsgRevokeResponse): MsgRevokeResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgRevokeResponseAminoMsg): MsgRevokeResponse { + return MsgRevokeResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgRevokeResponse): MsgRevokeResponseAminoMsg { + return { + type: "cosmos-sdk/MsgRevokeResponse", + value: MsgRevokeResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgRevokeResponseProtoMsg): MsgRevokeResponse { + return MsgRevokeResponse.decode(message.value); + }, + toProto(message: MsgRevokeResponse): Uint8Array { + return MsgRevokeResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgRevokeResponse): MsgRevokeResponseProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgRevokeResponse", + value: MsgRevokeResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgRevokeResponse.typeUrl, MsgRevokeResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgRevokeResponse.aminoType, MsgRevokeResponse.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/bank/v1beta1/bank.ts b/libs/interchain-query/src/cosmos/bank/v1beta1/bank.ts new file mode 100644 index 00000000..2c115ba3 --- /dev/null +++ b/libs/interchain-query/src/cosmos/bank/v1beta1/bank.ts @@ -0,0 +1,974 @@ +import { Coin, CoinAmino } from "../../base/v1beta1/coin"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; +/** Params defines the parameters for the bank module. */ +export interface Params { + /** + * Deprecated: Use of SendEnabled in params is deprecated. + * For genesis, use the newly added send_enabled field in the genesis object. + * Storage, lookup, and manipulation of this information is now in the keeper. + * + * As of cosmos-sdk 0.47, this only exists for backwards compatibility of genesis files. + */ + /** @deprecated */ + sendEnabled: SendEnabled[]; + defaultSendEnabled: boolean; +} +export interface ParamsProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.Params"; + value: Uint8Array; +} +/** Params defines the parameters for the bank module. */ +export interface ParamsAmino { + /** + * Deprecated: Use of SendEnabled in params is deprecated. + * For genesis, use the newly added send_enabled field in the genesis object. + * Storage, lookup, and manipulation of this information is now in the keeper. + * + * As of cosmos-sdk 0.47, this only exists for backwards compatibility of genesis files. + */ + /** @deprecated */ + send_enabled: SendEnabledAmino[]; + default_send_enabled: boolean; +} +export interface ParamsAminoMsg { + type: "cosmos-sdk/x/bank/Params"; + value: ParamsAmino; +} +/** + * SendEnabled maps coin denom to a send_enabled status (whether a denom is + * sendable). + */ +export interface SendEnabled { + denom: string; + enabled: boolean; +} +export interface SendEnabledProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.SendEnabled"; + value: Uint8Array; +} +/** + * SendEnabled maps coin denom to a send_enabled status (whether a denom is + * sendable). + */ +export interface SendEnabledAmino { + denom: string; + enabled: boolean; +} +export interface SendEnabledAminoMsg { + type: "cosmos-sdk/SendEnabled"; + value: SendEnabledAmino; +} +/** Input models transaction input. */ +export interface Input { + address: string; + coins: Coin[]; +} +export interface InputProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.Input"; + value: Uint8Array; +} +/** Input models transaction input. */ +export interface InputAmino { + address: string; + coins: CoinAmino[]; +} +export interface InputAminoMsg { + type: "cosmos-sdk/Input"; + value: InputAmino; +} +/** Output models transaction outputs. */ +export interface Output { + address: string; + coins: Coin[]; +} +export interface OutputProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.Output"; + value: Uint8Array; +} +/** Output models transaction outputs. */ +export interface OutputAmino { + address: string; + coins: CoinAmino[]; +} +export interface OutputAminoMsg { + type: "cosmos-sdk/Output"; + value: OutputAmino; +} +/** + * Supply represents a struct that passively keeps track of the total supply + * amounts in the network. + * This message is deprecated now that supply is indexed by denom. + */ +/** @deprecated */ +export interface Supply { + total: Coin[]; +} +export interface SupplyProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.Supply"; + value: Uint8Array; +} +/** + * Supply represents a struct that passively keeps track of the total supply + * amounts in the network. + * This message is deprecated now that supply is indexed by denom. + */ +/** @deprecated */ +export interface SupplyAmino { + total: CoinAmino[]; +} +export interface SupplyAminoMsg { + type: "cosmos-sdk/Supply"; + value: SupplyAmino; +} +/** + * DenomUnit represents a struct that describes a given + * denomination unit of the basic token. + */ +export interface DenomUnit { + /** denom represents the string name of the given denom unit (e.g uatom). */ + denom: string; + /** + * exponent represents power of 10 exponent that one must + * raise the base_denom to in order to equal the given DenomUnit's denom + * 1 denom = 10^exponent base_denom + * (e.g. with a base_denom of uatom, one can create a DenomUnit of 'atom' with + * exponent = 6, thus: 1 atom = 10^6 uatom). + */ + exponent: number; + /** aliases is a list of string aliases for the given denom */ + aliases: string[]; +} +export interface DenomUnitProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.DenomUnit"; + value: Uint8Array; +} +/** + * DenomUnit represents a struct that describes a given + * denomination unit of the basic token. + */ +export interface DenomUnitAmino { + /** denom represents the string name of the given denom unit (e.g uatom). */ + denom: string; + /** + * exponent represents power of 10 exponent that one must + * raise the base_denom to in order to equal the given DenomUnit's denom + * 1 denom = 10^exponent base_denom + * (e.g. with a base_denom of uatom, one can create a DenomUnit of 'atom' with + * exponent = 6, thus: 1 atom = 10^6 uatom). + */ + exponent: number; + /** aliases is a list of string aliases for the given denom */ + aliases: string[]; +} +export interface DenomUnitAminoMsg { + type: "cosmos-sdk/DenomUnit"; + value: DenomUnitAmino; +} +/** + * Metadata represents a struct that describes + * a basic token. + */ +export interface Metadata { + description: string; + /** denom_units represents the list of DenomUnit's for a given coin */ + denomUnits: DenomUnit[]; + /** base represents the base denom (should be the DenomUnit with exponent = 0). */ + base: string; + /** + * display indicates the suggested denom that should be + * displayed in clients. + */ + display: string; + /** + * name defines the name of the token (eg: Cosmos Atom) + * + * Since: cosmos-sdk 0.43 + */ + name: string; + /** + * symbol is the token symbol usually shown on exchanges (eg: ATOM). This can + * be the same as the display. + * + * Since: cosmos-sdk 0.43 + */ + symbol: string; + /** + * URI to a document (on or off-chain) that contains additional information. Optional. + * + * Since: cosmos-sdk 0.46 + */ + uri: string; + /** + * URIHash is a sha256 hash of a document pointed by URI. It's used to verify that + * the document didn't change. Optional. + * + * Since: cosmos-sdk 0.46 + */ + uriHash: string; +} +export interface MetadataProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.Metadata"; + value: Uint8Array; +} +/** + * Metadata represents a struct that describes + * a basic token. + */ +export interface MetadataAmino { + description: string; + /** denom_units represents the list of DenomUnit's for a given coin */ + denom_units: DenomUnitAmino[]; + /** base represents the base denom (should be the DenomUnit with exponent = 0). */ + base: string; + /** + * display indicates the suggested denom that should be + * displayed in clients. + */ + display: string; + /** + * name defines the name of the token (eg: Cosmos Atom) + * + * Since: cosmos-sdk 0.43 + */ + name: string; + /** + * symbol is the token symbol usually shown on exchanges (eg: ATOM). This can + * be the same as the display. + * + * Since: cosmos-sdk 0.43 + */ + symbol: string; + /** + * URI to a document (on or off-chain) that contains additional information. Optional. + * + * Since: cosmos-sdk 0.46 + */ + uri: string; + /** + * URIHash is a sha256 hash of a document pointed by URI. It's used to verify that + * the document didn't change. Optional. + * + * Since: cosmos-sdk 0.46 + */ + uri_hash: string; +} +export interface MetadataAminoMsg { + type: "cosmos-sdk/Metadata"; + value: MetadataAmino; +} +function createBaseParams(): Params { + return { + sendEnabled: [], + defaultSendEnabled: false + }; +} +export const Params = { + typeUrl: "/cosmos.bank.v1beta1.Params", + aminoType: "cosmos-sdk/x/bank/Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || Array.isArray(o.sendEnabled) && (!o.sendEnabled.length || SendEnabled.is(o.sendEnabled[0])) && typeof o.defaultSendEnabled === "boolean"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || Array.isArray(o.send_enabled) && (!o.send_enabled.length || SendEnabled.isAmino(o.send_enabled[0])) && typeof o.default_send_enabled === "boolean"); + }, + encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.sendEnabled) { + SendEnabled.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.defaultSendEnabled === true) { + writer.uint32(16).bool(message.defaultSendEnabled); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sendEnabled.push(SendEnabled.decode(reader, reader.uint32())); + break; + case 2: + message.defaultSendEnabled = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Params { + const message = createBaseParams(); + message.sendEnabled = object.sendEnabled?.map(e => SendEnabled.fromPartial(e)) || []; + message.defaultSendEnabled = object.defaultSendEnabled ?? false; + return message; + }, + fromAmino(object: ParamsAmino): Params { + const message = createBaseParams(); + message.sendEnabled = object.send_enabled?.map(e => SendEnabled.fromAmino(e)) || []; + if (object.default_send_enabled !== undefined && object.default_send_enabled !== null) { + message.defaultSendEnabled = object.default_send_enabled; + } + return message; + }, + toAmino(message: Params): ParamsAmino { + const obj: any = {}; + if (message.sendEnabled) { + obj.send_enabled = message.sendEnabled.map(e => e ? SendEnabled.toAmino(e) : undefined); + } else { + obj.send_enabled = message.sendEnabled; + } + obj.default_send_enabled = message.defaultSendEnabled === false ? undefined : message.defaultSendEnabled; + return obj; + }, + fromAminoMsg(object: ParamsAminoMsg): Params { + return Params.fromAmino(object.value); + }, + toAminoMsg(message: Params): ParamsAminoMsg { + return { + type: "cosmos-sdk/x/bank/Params", + value: Params.toAmino(message) + }; + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.Params", + value: Params.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Params.typeUrl, Params); +GlobalDecoderRegistry.registerAminoProtoMapping(Params.aminoType, Params.typeUrl); +function createBaseSendEnabled(): SendEnabled { + return { + denom: "", + enabled: false + }; +} +export const SendEnabled = { + typeUrl: "/cosmos.bank.v1beta1.SendEnabled", + aminoType: "cosmos-sdk/SendEnabled", + is(o: any): o is SendEnabled { + return o && (o.$typeUrl === SendEnabled.typeUrl || typeof o.denom === "string" && typeof o.enabled === "boolean"); + }, + isAmino(o: any): o is SendEnabledAmino { + return o && (o.$typeUrl === SendEnabled.typeUrl || typeof o.denom === "string" && typeof o.enabled === "boolean"); + }, + encode(message: SendEnabled, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.enabled === true) { + writer.uint32(16).bool(message.enabled); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SendEnabled { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSendEnabled(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + case 2: + message.enabled = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SendEnabled { + const message = createBaseSendEnabled(); + message.denom = object.denom ?? ""; + message.enabled = object.enabled ?? false; + return message; + }, + fromAmino(object: SendEnabledAmino): SendEnabled { + const message = createBaseSendEnabled(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + if (object.enabled !== undefined && object.enabled !== null) { + message.enabled = object.enabled; + } + return message; + }, + toAmino(message: SendEnabled): SendEnabledAmino { + const obj: any = {}; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.enabled = message.enabled === false ? undefined : message.enabled; + return obj; + }, + fromAminoMsg(object: SendEnabledAminoMsg): SendEnabled { + return SendEnabled.fromAmino(object.value); + }, + toAminoMsg(message: SendEnabled): SendEnabledAminoMsg { + return { + type: "cosmos-sdk/SendEnabled", + value: SendEnabled.toAmino(message) + }; + }, + fromProtoMsg(message: SendEnabledProtoMsg): SendEnabled { + return SendEnabled.decode(message.value); + }, + toProto(message: SendEnabled): Uint8Array { + return SendEnabled.encode(message).finish(); + }, + toProtoMsg(message: SendEnabled): SendEnabledProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.SendEnabled", + value: SendEnabled.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(SendEnabled.typeUrl, SendEnabled); +GlobalDecoderRegistry.registerAminoProtoMapping(SendEnabled.aminoType, SendEnabled.typeUrl); +function createBaseInput(): Input { + return { + address: "", + coins: [] + }; +} +export const Input = { + typeUrl: "/cosmos.bank.v1beta1.Input", + aminoType: "cosmos-sdk/Input", + is(o: any): o is Input { + return o && (o.$typeUrl === Input.typeUrl || typeof o.address === "string" && Array.isArray(o.coins) && (!o.coins.length || Coin.is(o.coins[0]))); + }, + isAmino(o: any): o is InputAmino { + return o && (o.$typeUrl === Input.typeUrl || typeof o.address === "string" && Array.isArray(o.coins) && (!o.coins.length || Coin.isAmino(o.coins[0]))); + }, + encode(message: Input, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + for (const v of message.coins) { + Coin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Input { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInput(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.coins.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Input { + const message = createBaseInput(); + message.address = object.address ?? ""; + message.coins = object.coins?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: InputAmino): Input { + const message = createBaseInput(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + message.coins = object.coins?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: Input): InputAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + if (message.coins) { + obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.coins = message.coins; + } + return obj; + }, + fromAminoMsg(object: InputAminoMsg): Input { + return Input.fromAmino(object.value); + }, + toAminoMsg(message: Input): InputAminoMsg { + return { + type: "cosmos-sdk/Input", + value: Input.toAmino(message) + }; + }, + fromProtoMsg(message: InputProtoMsg): Input { + return Input.decode(message.value); + }, + toProto(message: Input): Uint8Array { + return Input.encode(message).finish(); + }, + toProtoMsg(message: Input): InputProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.Input", + value: Input.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Input.typeUrl, Input); +GlobalDecoderRegistry.registerAminoProtoMapping(Input.aminoType, Input.typeUrl); +function createBaseOutput(): Output { + return { + address: "", + coins: [] + }; +} +export const Output = { + typeUrl: "/cosmos.bank.v1beta1.Output", + aminoType: "cosmos-sdk/Output", + is(o: any): o is Output { + return o && (o.$typeUrl === Output.typeUrl || typeof o.address === "string" && Array.isArray(o.coins) && (!o.coins.length || Coin.is(o.coins[0]))); + }, + isAmino(o: any): o is OutputAmino { + return o && (o.$typeUrl === Output.typeUrl || typeof o.address === "string" && Array.isArray(o.coins) && (!o.coins.length || Coin.isAmino(o.coins[0]))); + }, + encode(message: Output, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + for (const v of message.coins) { + Coin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Output { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOutput(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.coins.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Output { + const message = createBaseOutput(); + message.address = object.address ?? ""; + message.coins = object.coins?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: OutputAmino): Output { + const message = createBaseOutput(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + message.coins = object.coins?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: Output): OutputAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + if (message.coins) { + obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.coins = message.coins; + } + return obj; + }, + fromAminoMsg(object: OutputAminoMsg): Output { + return Output.fromAmino(object.value); + }, + toAminoMsg(message: Output): OutputAminoMsg { + return { + type: "cosmos-sdk/Output", + value: Output.toAmino(message) + }; + }, + fromProtoMsg(message: OutputProtoMsg): Output { + return Output.decode(message.value); + }, + toProto(message: Output): Uint8Array { + return Output.encode(message).finish(); + }, + toProtoMsg(message: Output): OutputProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.Output", + value: Output.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Output.typeUrl, Output); +GlobalDecoderRegistry.registerAminoProtoMapping(Output.aminoType, Output.typeUrl); +function createBaseSupply(): Supply { + return { + total: [] + }; +} +export const Supply = { + typeUrl: "/cosmos.bank.v1beta1.Supply", + aminoType: "cosmos-sdk/Supply", + is(o: any): o is Supply { + return o && (o.$typeUrl === Supply.typeUrl || Array.isArray(o.total) && (!o.total.length || Coin.is(o.total[0]))); + }, + isAmino(o: any): o is SupplyAmino { + return o && (o.$typeUrl === Supply.typeUrl || Array.isArray(o.total) && (!o.total.length || Coin.isAmino(o.total[0]))); + }, + encode(message: Supply, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.total) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Supply { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSupply(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.total.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Supply { + const message = createBaseSupply(); + message.total = object.total?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: SupplyAmino): Supply { + const message = createBaseSupply(); + message.total = object.total?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: Supply): SupplyAmino { + const obj: any = {}; + if (message.total) { + obj.total = message.total.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.total = message.total; + } + return obj; + }, + fromAminoMsg(object: SupplyAminoMsg): Supply { + return Supply.fromAmino(object.value); + }, + toAminoMsg(message: Supply): SupplyAminoMsg { + return { + type: "cosmos-sdk/Supply", + value: Supply.toAmino(message) + }; + }, + fromProtoMsg(message: SupplyProtoMsg): Supply { + return Supply.decode(message.value); + }, + toProto(message: Supply): Uint8Array { + return Supply.encode(message).finish(); + }, + toProtoMsg(message: Supply): SupplyProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.Supply", + value: Supply.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Supply.typeUrl, Supply); +GlobalDecoderRegistry.registerAminoProtoMapping(Supply.aminoType, Supply.typeUrl); +function createBaseDenomUnit(): DenomUnit { + return { + denom: "", + exponent: 0, + aliases: [] + }; +} +export const DenomUnit = { + typeUrl: "/cosmos.bank.v1beta1.DenomUnit", + aminoType: "cosmos-sdk/DenomUnit", + is(o: any): o is DenomUnit { + return o && (o.$typeUrl === DenomUnit.typeUrl || typeof o.denom === "string" && typeof o.exponent === "number" && Array.isArray(o.aliases) && (!o.aliases.length || typeof o.aliases[0] === "string")); + }, + isAmino(o: any): o is DenomUnitAmino { + return o && (o.$typeUrl === DenomUnit.typeUrl || typeof o.denom === "string" && typeof o.exponent === "number" && Array.isArray(o.aliases) && (!o.aliases.length || typeof o.aliases[0] === "string")); + }, + encode(message: DenomUnit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.exponent !== 0) { + writer.uint32(16).uint32(message.exponent); + } + for (const v of message.aliases) { + writer.uint32(26).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DenomUnit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDenomUnit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + case 2: + message.exponent = reader.uint32(); + break; + case 3: + message.aliases.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): DenomUnit { + const message = createBaseDenomUnit(); + message.denom = object.denom ?? ""; + message.exponent = object.exponent ?? 0; + message.aliases = object.aliases?.map(e => e) || []; + return message; + }, + fromAmino(object: DenomUnitAmino): DenomUnit { + const message = createBaseDenomUnit(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + if (object.exponent !== undefined && object.exponent !== null) { + message.exponent = object.exponent; + } + message.aliases = object.aliases?.map(e => e) || []; + return message; + }, + toAmino(message: DenomUnit): DenomUnitAmino { + const obj: any = {}; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.exponent = message.exponent === 0 ? undefined : message.exponent; + if (message.aliases) { + obj.aliases = message.aliases.map(e => e); + } else { + obj.aliases = message.aliases; + } + return obj; + }, + fromAminoMsg(object: DenomUnitAminoMsg): DenomUnit { + return DenomUnit.fromAmino(object.value); + }, + toAminoMsg(message: DenomUnit): DenomUnitAminoMsg { + return { + type: "cosmos-sdk/DenomUnit", + value: DenomUnit.toAmino(message) + }; + }, + fromProtoMsg(message: DenomUnitProtoMsg): DenomUnit { + return DenomUnit.decode(message.value); + }, + toProto(message: DenomUnit): Uint8Array { + return DenomUnit.encode(message).finish(); + }, + toProtoMsg(message: DenomUnit): DenomUnitProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.DenomUnit", + value: DenomUnit.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(DenomUnit.typeUrl, DenomUnit); +GlobalDecoderRegistry.registerAminoProtoMapping(DenomUnit.aminoType, DenomUnit.typeUrl); +function createBaseMetadata(): Metadata { + return { + description: "", + denomUnits: [], + base: "", + display: "", + name: "", + symbol: "", + uri: "", + uriHash: "" + }; +} +export const Metadata = { + typeUrl: "/cosmos.bank.v1beta1.Metadata", + aminoType: "cosmos-sdk/Metadata", + is(o: any): o is Metadata { + return o && (o.$typeUrl === Metadata.typeUrl || typeof o.description === "string" && Array.isArray(o.denomUnits) && (!o.denomUnits.length || DenomUnit.is(o.denomUnits[0])) && typeof o.base === "string" && typeof o.display === "string" && typeof o.name === "string" && typeof o.symbol === "string" && typeof o.uri === "string" && typeof o.uriHash === "string"); + }, + isAmino(o: any): o is MetadataAmino { + return o && (o.$typeUrl === Metadata.typeUrl || typeof o.description === "string" && Array.isArray(o.denom_units) && (!o.denom_units.length || DenomUnit.isAmino(o.denom_units[0])) && typeof o.base === "string" && typeof o.display === "string" && typeof o.name === "string" && typeof o.symbol === "string" && typeof o.uri === "string" && typeof o.uri_hash === "string"); + }, + encode(message: Metadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.description !== "") { + writer.uint32(10).string(message.description); + } + for (const v of message.denomUnits) { + DenomUnit.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.base !== "") { + writer.uint32(26).string(message.base); + } + if (message.display !== "") { + writer.uint32(34).string(message.display); + } + if (message.name !== "") { + writer.uint32(42).string(message.name); + } + if (message.symbol !== "") { + writer.uint32(50).string(message.symbol); + } + if (message.uri !== "") { + writer.uint32(58).string(message.uri); + } + if (message.uriHash !== "") { + writer.uint32(66).string(message.uriHash); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Metadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.description = reader.string(); + break; + case 2: + message.denomUnits.push(DenomUnit.decode(reader, reader.uint32())); + break; + case 3: + message.base = reader.string(); + break; + case 4: + message.display = reader.string(); + break; + case 5: + message.name = reader.string(); + break; + case 6: + message.symbol = reader.string(); + break; + case 7: + message.uri = reader.string(); + break; + case 8: + message.uriHash = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Metadata { + const message = createBaseMetadata(); + message.description = object.description ?? ""; + message.denomUnits = object.denomUnits?.map(e => DenomUnit.fromPartial(e)) || []; + message.base = object.base ?? ""; + message.display = object.display ?? ""; + message.name = object.name ?? ""; + message.symbol = object.symbol ?? ""; + message.uri = object.uri ?? ""; + message.uriHash = object.uriHash ?? ""; + return message; + }, + fromAmino(object: MetadataAmino): Metadata { + const message = createBaseMetadata(); + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + message.denomUnits = object.denom_units?.map(e => DenomUnit.fromAmino(e)) || []; + if (object.base !== undefined && object.base !== null) { + message.base = object.base; + } + if (object.display !== undefined && object.display !== null) { + message.display = object.display; + } + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.symbol !== undefined && object.symbol !== null) { + message.symbol = object.symbol; + } + if (object.uri !== undefined && object.uri !== null) { + message.uri = object.uri; + } + if (object.uri_hash !== undefined && object.uri_hash !== null) { + message.uriHash = object.uri_hash; + } + return message; + }, + toAmino(message: Metadata): MetadataAmino { + const obj: any = {}; + obj.description = message.description === "" ? undefined : message.description; + if (message.denomUnits) { + obj.denom_units = message.denomUnits.map(e => e ? DenomUnit.toAmino(e) : undefined); + } else { + obj.denom_units = message.denomUnits; + } + obj.base = message.base === "" ? undefined : message.base; + obj.display = message.display === "" ? undefined : message.display; + obj.name = message.name === "" ? undefined : message.name; + obj.symbol = message.symbol === "" ? undefined : message.symbol; + obj.uri = message.uri === "" ? undefined : message.uri; + obj.uri_hash = message.uriHash === "" ? undefined : message.uriHash; + return obj; + }, + fromAminoMsg(object: MetadataAminoMsg): Metadata { + return Metadata.fromAmino(object.value); + }, + toAminoMsg(message: Metadata): MetadataAminoMsg { + return { + type: "cosmos-sdk/Metadata", + value: Metadata.toAmino(message) + }; + }, + fromProtoMsg(message: MetadataProtoMsg): Metadata { + return Metadata.decode(message.value); + }, + toProto(message: Metadata): Uint8Array { + return Metadata.encode(message).finish(); + }, + toProtoMsg(message: Metadata): MetadataProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.Metadata", + value: Metadata.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Metadata.typeUrl, Metadata); +GlobalDecoderRegistry.registerAminoProtoMapping(Metadata.aminoType, Metadata.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/bank/v1beta1/query.rpc.func.ts b/libs/interchain-query/src/cosmos/bank/v1beta1/query.rpc.func.ts new file mode 100644 index 00000000..3ba6a682 --- /dev/null +++ b/libs/interchain-query/src/cosmos/bank/v1beta1/query.rpc.func.ts @@ -0,0 +1,146 @@ +import { RpcResolver, buildQuery } from "../../../helper-func-types"; +import { buildUseQuery } from "../../../react-query"; +import { QueryBalanceRequest, QueryBalanceResponse, QueryAllBalancesRequest, QueryAllBalancesResponse, QuerySpendableBalancesRequest, QuerySpendableBalancesResponse, QuerySpendableBalanceByDenomRequest, QuerySpendableBalanceByDenomResponse, QueryTotalSupplyRequest, QueryTotalSupplyResponse, QuerySupplyOfRequest, QuerySupplyOfResponse, QueryParamsRequest, QueryParamsResponse, QueryDenomMetadataRequest, QueryDenomMetadataResponse, QueryDenomMetadataByQueryStringRequest, QueryDenomMetadataByQueryStringResponse, QueryDenomsMetadataRequest, QueryDenomsMetadataResponse, QueryDenomOwnersRequest, QueryDenomOwnersResponse, QueryDenomOwnersByQueryRequest, QueryDenomOwnersByQueryResponse, QuerySendEnabledRequest, QuerySendEnabledResponse } from "./query"; +export const createGetBalance = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryBalanceRequest.encode, + decode: QueryBalanceResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "Balance", + clientResolver +}); +export const useGetBalance = buildUseQuery({ + builderQueryFn: createGetBalance, + queryKeyPrefix: "BalanceQuery" +}); +export const createGetAllBalances = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryAllBalancesRequest.encode, + decode: QueryAllBalancesResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "AllBalances", + clientResolver +}); +export const useGetAllBalances = buildUseQuery({ + builderQueryFn: createGetAllBalances, + queryKeyPrefix: "AllBalancesQuery" +}); +export const createGetSpendableBalances = (clientResolver?: RpcResolver) => buildQuery({ + encode: QuerySpendableBalancesRequest.encode, + decode: QuerySpendableBalancesResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "SpendableBalances", + clientResolver +}); +export const useGetSpendableBalances = buildUseQuery({ + builderQueryFn: createGetSpendableBalances, + queryKeyPrefix: "SpendableBalancesQuery" +}); +export const createGetSpendableBalanceByDenom = (clientResolver?: RpcResolver) => buildQuery({ + encode: QuerySpendableBalanceByDenomRequest.encode, + decode: QuerySpendableBalanceByDenomResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "SpendableBalanceByDenom", + clientResolver +}); +export const useGetSpendableBalanceByDenom = buildUseQuery({ + builderQueryFn: createGetSpendableBalanceByDenom, + queryKeyPrefix: "SpendableBalanceByDenomQuery" +}); +export const createGetTotalSupply = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryTotalSupplyRequest.encode, + decode: QueryTotalSupplyResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "TotalSupply", + clientResolver +}); +export const useGetTotalSupply = buildUseQuery({ + builderQueryFn: createGetTotalSupply, + queryKeyPrefix: "TotalSupplyQuery" +}); +export const createGetSupplyOf = (clientResolver?: RpcResolver) => buildQuery({ + encode: QuerySupplyOfRequest.encode, + decode: QuerySupplyOfResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "SupplyOf", + clientResolver +}); +export const useGetSupplyOf = buildUseQuery({ + builderQueryFn: createGetSupplyOf, + queryKeyPrefix: "SupplyOfQuery" +}); +export const createGetParams = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "Params", + clientResolver +}); +export const useGetParams = buildUseQuery({ + builderQueryFn: createGetParams, + queryKeyPrefix: "ParamsQuery" +}); +export const createGetDenomMetadata = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryDenomMetadataRequest.encode, + decode: QueryDenomMetadataResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "DenomMetadata", + clientResolver +}); +export const useGetDenomMetadata = buildUseQuery({ + builderQueryFn: createGetDenomMetadata, + queryKeyPrefix: "DenomMetadataQuery" +}); +export const createGetDenomMetadataByQueryString = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryDenomMetadataByQueryStringRequest.encode, + decode: QueryDenomMetadataByQueryStringResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "DenomMetadataByQueryString", + clientResolver +}); +export const useGetDenomMetadataByQueryString = buildUseQuery({ + builderQueryFn: createGetDenomMetadataByQueryString, + queryKeyPrefix: "DenomMetadataByQueryStringQuery" +}); +export const createGetDenomsMetadata = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryDenomsMetadataRequest.encode, + decode: QueryDenomsMetadataResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "DenomsMetadata", + clientResolver +}); +export const useGetDenomsMetadata = buildUseQuery({ + builderQueryFn: createGetDenomsMetadata, + queryKeyPrefix: "DenomsMetadataQuery" +}); +export const createGetDenomOwners = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryDenomOwnersRequest.encode, + decode: QueryDenomOwnersResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "DenomOwners", + clientResolver +}); +export const useGetDenomOwners = buildUseQuery({ + builderQueryFn: createGetDenomOwners, + queryKeyPrefix: "DenomOwnersQuery" +}); +export const createGetDenomOwnersByQuery = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryDenomOwnersByQueryRequest.encode, + decode: QueryDenomOwnersByQueryResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "DenomOwnersByQuery", + clientResolver +}); +export const useGetDenomOwnersByQuery = buildUseQuery({ + builderQueryFn: createGetDenomOwnersByQuery, + queryKeyPrefix: "DenomOwnersByQueryQuery" +}); +export const createGetSendEnabled = (clientResolver?: RpcResolver) => buildQuery({ + encode: QuerySendEnabledRequest.encode, + decode: QuerySendEnabledResponse.decode, + service: "cosmos.bank.v1beta1.Query", + method: "SendEnabled", + clientResolver +}); +export const useGetSendEnabled = buildUseQuery({ + builderQueryFn: createGetSendEnabled, + queryKeyPrefix: "SendEnabledQuery" +}); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/bank/v1beta1/query.ts b/libs/interchain-query/src/cosmos/bank/v1beta1/query.ts new file mode 100644 index 00000000..45f3fa82 --- /dev/null +++ b/libs/interchain-query/src/cosmos/bank/v1beta1/query.ts @@ -0,0 +1,3027 @@ +import { PageRequest, PageRequestAmino, PageResponse, PageResponseAmino } from "../../base/query/v1beta1/pagination"; +import { Coin, CoinAmino } from "../../base/v1beta1/coin"; +import { Params, ParamsAmino, Metadata, MetadataAmino, SendEnabled, SendEnabledAmino } from "./bank"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; +/** QueryBalanceRequest is the request type for the Query/Balance RPC method. */ +export interface QueryBalanceRequest { + /** address is the address to query balances for. */ + address: string; + /** denom is the coin denom to query balances for. */ + denom: string; +} +export interface QueryBalanceRequestProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryBalanceRequest"; + value: Uint8Array; +} +/** QueryBalanceRequest is the request type for the Query/Balance RPC method. */ +export interface QueryBalanceRequestAmino { + /** address is the address to query balances for. */ + address: string; + /** denom is the coin denom to query balances for. */ + denom: string; +} +export interface QueryBalanceRequestAminoMsg { + type: "cosmos-sdk/QueryBalanceRequest"; + value: QueryBalanceRequestAmino; +} +/** QueryBalanceResponse is the response type for the Query/Balance RPC method. */ +export interface QueryBalanceResponse { + /** balance is the balance of the coin. */ + balance?: Coin; +} +export interface QueryBalanceResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryBalanceResponse"; + value: Uint8Array; +} +/** QueryBalanceResponse is the response type for the Query/Balance RPC method. */ +export interface QueryBalanceResponseAmino { + /** balance is the balance of the coin. */ + balance?: CoinAmino; +} +export interface QueryBalanceResponseAminoMsg { + type: "cosmos-sdk/QueryBalanceResponse"; + value: QueryBalanceResponseAmino; +} +/** QueryBalanceRequest is the request type for the Query/AllBalances RPC method. */ +export interface QueryAllBalancesRequest { + /** address is the address to query balances for. */ + address: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; + /** + * resolve_denom is the flag to resolve the denom into a human-readable form from the metadata. + * + * Since: cosmos-sdk 0.50 + */ + resolveDenom: boolean; +} +export interface QueryAllBalancesRequestProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryAllBalancesRequest"; + value: Uint8Array; +} +/** QueryBalanceRequest is the request type for the Query/AllBalances RPC method. */ +export interface QueryAllBalancesRequestAmino { + /** address is the address to query balances for. */ + address: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; + /** + * resolve_denom is the flag to resolve the denom into a human-readable form from the metadata. + * + * Since: cosmos-sdk 0.50 + */ + resolve_denom: boolean; +} +export interface QueryAllBalancesRequestAminoMsg { + type: "cosmos-sdk/QueryAllBalancesRequest"; + value: QueryAllBalancesRequestAmino; +} +/** + * QueryAllBalancesResponse is the response type for the Query/AllBalances RPC + * method. + */ +export interface QueryAllBalancesResponse { + /** balances is the balances of all the coins. */ + balances: Coin[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryAllBalancesResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryAllBalancesResponse"; + value: Uint8Array; +} +/** + * QueryAllBalancesResponse is the response type for the Query/AllBalances RPC + * method. + */ +export interface QueryAllBalancesResponseAmino { + /** balances is the balances of all the coins. */ + balances: CoinAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryAllBalancesResponseAminoMsg { + type: "cosmos-sdk/QueryAllBalancesResponse"; + value: QueryAllBalancesResponseAmino; +} +/** + * QuerySpendableBalancesRequest defines the gRPC request structure for querying + * an account's spendable balances. + * + * Since: cosmos-sdk 0.46 + */ +export interface QuerySpendableBalancesRequest { + /** address is the address to query spendable balances for. */ + address: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QuerySpendableBalancesRequestProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalancesRequest"; + value: Uint8Array; +} +/** + * QuerySpendableBalancesRequest defines the gRPC request structure for querying + * an account's spendable balances. + * + * Since: cosmos-sdk 0.46 + */ +export interface QuerySpendableBalancesRequestAmino { + /** address is the address to query spendable balances for. */ + address: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QuerySpendableBalancesRequestAminoMsg { + type: "cosmos-sdk/QuerySpendableBalancesRequest"; + value: QuerySpendableBalancesRequestAmino; +} +/** + * QuerySpendableBalancesResponse defines the gRPC response structure for querying + * an account's spendable balances. + * + * Since: cosmos-sdk 0.46 + */ +export interface QuerySpendableBalancesResponse { + /** balances is the spendable balances of all the coins. */ + balances: Coin[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QuerySpendableBalancesResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalancesResponse"; + value: Uint8Array; +} +/** + * QuerySpendableBalancesResponse defines the gRPC response structure for querying + * an account's spendable balances. + * + * Since: cosmos-sdk 0.46 + */ +export interface QuerySpendableBalancesResponseAmino { + /** balances is the spendable balances of all the coins. */ + balances: CoinAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QuerySpendableBalancesResponseAminoMsg { + type: "cosmos-sdk/QuerySpendableBalancesResponse"; + value: QuerySpendableBalancesResponseAmino; +} +/** + * QuerySpendableBalanceByDenomRequest defines the gRPC request structure for + * querying an account's spendable balance for a specific denom. + * + * Since: cosmos-sdk 0.47 + */ +export interface QuerySpendableBalanceByDenomRequest { + /** address is the address to query balances for. */ + address: string; + /** denom is the coin denom to query balances for. */ + denom: string; +} +export interface QuerySpendableBalanceByDenomRequestProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalanceByDenomRequest"; + value: Uint8Array; +} +/** + * QuerySpendableBalanceByDenomRequest defines the gRPC request structure for + * querying an account's spendable balance for a specific denom. + * + * Since: cosmos-sdk 0.47 + */ +export interface QuerySpendableBalanceByDenomRequestAmino { + /** address is the address to query balances for. */ + address: string; + /** denom is the coin denom to query balances for. */ + denom: string; +} +export interface QuerySpendableBalanceByDenomRequestAminoMsg { + type: "cosmos-sdk/QuerySpendableBalanceByDenomRequest"; + value: QuerySpendableBalanceByDenomRequestAmino; +} +/** + * QuerySpendableBalanceByDenomResponse defines the gRPC response structure for + * querying an account's spendable balance for a specific denom. + * + * Since: cosmos-sdk 0.47 + */ +export interface QuerySpendableBalanceByDenomResponse { + /** balance is the balance of the coin. */ + balance?: Coin; +} +export interface QuerySpendableBalanceByDenomResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalanceByDenomResponse"; + value: Uint8Array; +} +/** + * QuerySpendableBalanceByDenomResponse defines the gRPC response structure for + * querying an account's spendable balance for a specific denom. + * + * Since: cosmos-sdk 0.47 + */ +export interface QuerySpendableBalanceByDenomResponseAmino { + /** balance is the balance of the coin. */ + balance?: CoinAmino; +} +export interface QuerySpendableBalanceByDenomResponseAminoMsg { + type: "cosmos-sdk/QuerySpendableBalanceByDenomResponse"; + value: QuerySpendableBalanceByDenomResponseAmino; +} +/** + * QueryTotalSupplyRequest is the request type for the Query/TotalSupply RPC + * method. + */ +export interface QueryTotalSupplyRequest { + /** + * pagination defines an optional pagination for the request. + * + * Since: cosmos-sdk 0.43 + */ + pagination?: PageRequest; +} +export interface QueryTotalSupplyRequestProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryTotalSupplyRequest"; + value: Uint8Array; +} +/** + * QueryTotalSupplyRequest is the request type for the Query/TotalSupply RPC + * method. + */ +export interface QueryTotalSupplyRequestAmino { + /** + * pagination defines an optional pagination for the request. + * + * Since: cosmos-sdk 0.43 + */ + pagination?: PageRequestAmino; +} +export interface QueryTotalSupplyRequestAminoMsg { + type: "cosmos-sdk/QueryTotalSupplyRequest"; + value: QueryTotalSupplyRequestAmino; +} +/** + * QueryTotalSupplyResponse is the response type for the Query/TotalSupply RPC + * method + */ +export interface QueryTotalSupplyResponse { + /** supply is the supply of the coins */ + supply: Coin[]; + /** + * pagination defines the pagination in the response. + * + * Since: cosmos-sdk 0.43 + */ + pagination?: PageResponse; +} +export interface QueryTotalSupplyResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryTotalSupplyResponse"; + value: Uint8Array; +} +/** + * QueryTotalSupplyResponse is the response type for the Query/TotalSupply RPC + * method + */ +export interface QueryTotalSupplyResponseAmino { + /** supply is the supply of the coins */ + supply: CoinAmino[]; + /** + * pagination defines the pagination in the response. + * + * Since: cosmos-sdk 0.43 + */ + pagination?: PageResponseAmino; +} +export interface QueryTotalSupplyResponseAminoMsg { + type: "cosmos-sdk/QueryTotalSupplyResponse"; + value: QueryTotalSupplyResponseAmino; +} +/** QuerySupplyOfRequest is the request type for the Query/SupplyOf RPC method. */ +export interface QuerySupplyOfRequest { + /** denom is the coin denom to query balances for. */ + denom: string; +} +export interface QuerySupplyOfRequestProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QuerySupplyOfRequest"; + value: Uint8Array; +} +/** QuerySupplyOfRequest is the request type for the Query/SupplyOf RPC method. */ +export interface QuerySupplyOfRequestAmino { + /** denom is the coin denom to query balances for. */ + denom: string; +} +export interface QuerySupplyOfRequestAminoMsg { + type: "cosmos-sdk/QuerySupplyOfRequest"; + value: QuerySupplyOfRequestAmino; +} +/** QuerySupplyOfResponse is the response type for the Query/SupplyOf RPC method. */ +export interface QuerySupplyOfResponse { + /** amount is the supply of the coin. */ + amount: Coin; +} +export interface QuerySupplyOfResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QuerySupplyOfResponse"; + value: Uint8Array; +} +/** QuerySupplyOfResponse is the response type for the Query/SupplyOf RPC method. */ +export interface QuerySupplyOfResponseAmino { + /** amount is the supply of the coin. */ + amount: CoinAmino; +} +export interface QuerySupplyOfResponseAminoMsg { + type: "cosmos-sdk/QuerySupplyOfResponse"; + value: QuerySupplyOfResponseAmino; +} +/** QueryParamsRequest defines the request type for querying x/bank parameters. */ +export interface QueryParamsRequest {} +export interface QueryParamsRequestProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryParamsRequest"; + value: Uint8Array; +} +/** QueryParamsRequest defines the request type for querying x/bank parameters. */ +export interface QueryParamsRequestAmino {} +export interface QueryParamsRequestAminoMsg { + type: "cosmos-sdk/QueryParamsRequest"; + value: QueryParamsRequestAmino; +} +/** QueryParamsResponse defines the response type for querying x/bank parameters. */ +export interface QueryParamsResponse { + /** params provides the parameters of the bank module. */ + params: Params; +} +export interface QueryParamsResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryParamsResponse"; + value: Uint8Array; +} +/** QueryParamsResponse defines the response type for querying x/bank parameters. */ +export interface QueryParamsResponseAmino { + /** params provides the parameters of the bank module. */ + params: ParamsAmino; +} +export interface QueryParamsResponseAminoMsg { + type: "cosmos-sdk/QueryParamsResponse"; + value: QueryParamsResponseAmino; +} +/** QueryDenomsMetadataRequest is the request type for the Query/DenomsMetadata RPC method. */ +export interface QueryDenomsMetadataRequest { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryDenomsMetadataRequestProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomsMetadataRequest"; + value: Uint8Array; +} +/** QueryDenomsMetadataRequest is the request type for the Query/DenomsMetadata RPC method. */ +export interface QueryDenomsMetadataRequestAmino { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryDenomsMetadataRequestAminoMsg { + type: "cosmos-sdk/QueryDenomsMetadataRequest"; + value: QueryDenomsMetadataRequestAmino; +} +/** + * QueryDenomsMetadataResponse is the response type for the Query/DenomsMetadata RPC + * method. + */ +export interface QueryDenomsMetadataResponse { + /** metadata provides the client information for all the registered tokens. */ + metadatas: Metadata[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryDenomsMetadataResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomsMetadataResponse"; + value: Uint8Array; +} +/** + * QueryDenomsMetadataResponse is the response type for the Query/DenomsMetadata RPC + * method. + */ +export interface QueryDenomsMetadataResponseAmino { + /** metadata provides the client information for all the registered tokens. */ + metadatas: MetadataAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryDenomsMetadataResponseAminoMsg { + type: "cosmos-sdk/QueryDenomsMetadataResponse"; + value: QueryDenomsMetadataResponseAmino; +} +/** QueryDenomMetadataRequest is the request type for the Query/DenomMetadata RPC method. */ +export interface QueryDenomMetadataRequest { + /** denom is the coin denom to query the metadata for. */ + denom: string; +} +export interface QueryDenomMetadataRequestProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataRequest"; + value: Uint8Array; +} +/** QueryDenomMetadataRequest is the request type for the Query/DenomMetadata RPC method. */ +export interface QueryDenomMetadataRequestAmino { + /** denom is the coin denom to query the metadata for. */ + denom: string; +} +export interface QueryDenomMetadataRequestAminoMsg { + type: "cosmos-sdk/QueryDenomMetadataRequest"; + value: QueryDenomMetadataRequestAmino; +} +/** + * QueryDenomMetadataResponse is the response type for the Query/DenomMetadata RPC + * method. + */ +export interface QueryDenomMetadataResponse { + /** metadata describes and provides all the client information for the requested token. */ + metadata: Metadata; +} +export interface QueryDenomMetadataResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataResponse"; + value: Uint8Array; +} +/** + * QueryDenomMetadataResponse is the response type for the Query/DenomMetadata RPC + * method. + */ +export interface QueryDenomMetadataResponseAmino { + /** metadata describes and provides all the client information for the requested token. */ + metadata: MetadataAmino; +} +export interface QueryDenomMetadataResponseAminoMsg { + type: "cosmos-sdk/QueryDenomMetadataResponse"; + value: QueryDenomMetadataResponseAmino; +} +/** + * QueryDenomMetadataByQueryStringRequest is the request type for the Query/DenomMetadata RPC method. + * Identical with QueryDenomMetadataRequest but receives denom as query string. + */ +export interface QueryDenomMetadataByQueryStringRequest { + /** denom is the coin denom to query the metadata for. */ + denom: string; +} +export interface QueryDenomMetadataByQueryStringRequestProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataByQueryStringRequest"; + value: Uint8Array; +} +/** + * QueryDenomMetadataByQueryStringRequest is the request type for the Query/DenomMetadata RPC method. + * Identical with QueryDenomMetadataRequest but receives denom as query string. + */ +export interface QueryDenomMetadataByQueryStringRequestAmino { + /** denom is the coin denom to query the metadata for. */ + denom: string; +} +export interface QueryDenomMetadataByQueryStringRequestAminoMsg { + type: "cosmos-sdk/QueryDenomMetadataByQueryStringRequest"; + value: QueryDenomMetadataByQueryStringRequestAmino; +} +/** + * QueryDenomMetadataByQueryStringResponse is the response type for the Query/DenomMetadata RPC + * method. Identical with QueryDenomMetadataResponse but receives denom as query string in request. + */ +export interface QueryDenomMetadataByQueryStringResponse { + /** metadata describes and provides all the client information for the requested token. */ + metadata: Metadata; +} +export interface QueryDenomMetadataByQueryStringResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataByQueryStringResponse"; + value: Uint8Array; +} +/** + * QueryDenomMetadataByQueryStringResponse is the response type for the Query/DenomMetadata RPC + * method. Identical with QueryDenomMetadataResponse but receives denom as query string in request. + */ +export interface QueryDenomMetadataByQueryStringResponseAmino { + /** metadata describes and provides all the client information for the requested token. */ + metadata: MetadataAmino; +} +export interface QueryDenomMetadataByQueryStringResponseAminoMsg { + type: "cosmos-sdk/QueryDenomMetadataByQueryStringResponse"; + value: QueryDenomMetadataByQueryStringResponseAmino; +} +/** + * QueryDenomOwnersRequest defines the request type for the DenomOwners RPC query, + * which queries for a paginated set of all account holders of a particular + * denomination. + */ +export interface QueryDenomOwnersRequest { + /** denom defines the coin denomination to query all account holders for. */ + denom: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryDenomOwnersRequestProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersRequest"; + value: Uint8Array; +} +/** + * QueryDenomOwnersRequest defines the request type for the DenomOwners RPC query, + * which queries for a paginated set of all account holders of a particular + * denomination. + */ +export interface QueryDenomOwnersRequestAmino { + /** denom defines the coin denomination to query all account holders for. */ + denom: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryDenomOwnersRequestAminoMsg { + type: "cosmos-sdk/QueryDenomOwnersRequest"; + value: QueryDenomOwnersRequestAmino; +} +/** + * DenomOwner defines structure representing an account that owns or holds a + * particular denominated token. It contains the account address and account + * balance of the denominated token. + * + * Since: cosmos-sdk 0.46 + */ +export interface DenomOwner { + /** address defines the address that owns a particular denomination. */ + address: string; + /** balance is the balance of the denominated coin for an account. */ + balance: Coin; +} +export interface DenomOwnerProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.DenomOwner"; + value: Uint8Array; +} +/** + * DenomOwner defines structure representing an account that owns or holds a + * particular denominated token. It contains the account address and account + * balance of the denominated token. + * + * Since: cosmos-sdk 0.46 + */ +export interface DenomOwnerAmino { + /** address defines the address that owns a particular denomination. */ + address: string; + /** balance is the balance of the denominated coin for an account. */ + balance: CoinAmino; +} +export interface DenomOwnerAminoMsg { + type: "cosmos-sdk/DenomOwner"; + value: DenomOwnerAmino; +} +/** + * QueryDenomOwnersResponse defines the RPC response of a DenomOwners RPC query. + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryDenomOwnersResponse { + denomOwners: DenomOwner[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryDenomOwnersResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersResponse"; + value: Uint8Array; +} +/** + * QueryDenomOwnersResponse defines the RPC response of a DenomOwners RPC query. + * + * Since: cosmos-sdk 0.46 + */ +export interface QueryDenomOwnersResponseAmino { + denom_owners: DenomOwnerAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryDenomOwnersResponseAminoMsg { + type: "cosmos-sdk/QueryDenomOwnersResponse"; + value: QueryDenomOwnersResponseAmino; +} +/** + * QueryDenomOwnersByQueryRequest defines the request type for the DenomOwnersByQuery RPC query, + * which queries for a paginated set of all account holders of a particular + * denomination. + * + * Since: cosmos-sdk 0.50.3 + */ +export interface QueryDenomOwnersByQueryRequest { + /** denom defines the coin denomination to query all account holders for. */ + denom: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryDenomOwnersByQueryRequestProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersByQueryRequest"; + value: Uint8Array; +} +/** + * QueryDenomOwnersByQueryRequest defines the request type for the DenomOwnersByQuery RPC query, + * which queries for a paginated set of all account holders of a particular + * denomination. + * + * Since: cosmos-sdk 0.50.3 + */ +export interface QueryDenomOwnersByQueryRequestAmino { + /** denom defines the coin denomination to query all account holders for. */ + denom: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryDenomOwnersByQueryRequestAminoMsg { + type: "cosmos-sdk/QueryDenomOwnersByQueryRequest"; + value: QueryDenomOwnersByQueryRequestAmino; +} +/** + * QueryDenomOwnersByQueryResponse defines the RPC response of a DenomOwnersByQuery RPC query. + * + * Since: cosmos-sdk 0.50.3 + */ +export interface QueryDenomOwnersByQueryResponse { + denomOwners: DenomOwner[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryDenomOwnersByQueryResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersByQueryResponse"; + value: Uint8Array; +} +/** + * QueryDenomOwnersByQueryResponse defines the RPC response of a DenomOwnersByQuery RPC query. + * + * Since: cosmos-sdk 0.50.3 + */ +export interface QueryDenomOwnersByQueryResponseAmino { + denom_owners: DenomOwnerAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryDenomOwnersByQueryResponseAminoMsg { + type: "cosmos-sdk/QueryDenomOwnersByQueryResponse"; + value: QueryDenomOwnersByQueryResponseAmino; +} +/** + * QuerySendEnabledRequest defines the RPC request for looking up SendEnabled entries. + * + * Since: cosmos-sdk 0.47 + */ +export interface QuerySendEnabledRequest { + /** denoms is the specific denoms you want look up. Leave empty to get all entries. */ + denoms: string[]; + /** + * pagination defines an optional pagination for the request. This field is + * only read if the denoms field is empty. + */ + pagination?: PageRequest; +} +export interface QuerySendEnabledRequestProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QuerySendEnabledRequest"; + value: Uint8Array; +} +/** + * QuerySendEnabledRequest defines the RPC request for looking up SendEnabled entries. + * + * Since: cosmos-sdk 0.47 + */ +export interface QuerySendEnabledRequestAmino { + /** denoms is the specific denoms you want look up. Leave empty to get all entries. */ + denoms: string[]; + /** + * pagination defines an optional pagination for the request. This field is + * only read if the denoms field is empty. + */ + pagination?: PageRequestAmino; +} +export interface QuerySendEnabledRequestAminoMsg { + type: "cosmos-sdk/QuerySendEnabledRequest"; + value: QuerySendEnabledRequestAmino; +} +/** + * QuerySendEnabledResponse defines the RPC response of a SendEnable query. + * + * Since: cosmos-sdk 0.47 + */ +export interface QuerySendEnabledResponse { + sendEnabled: SendEnabled[]; + /** + * pagination defines the pagination in the response. This field is only + * populated if the denoms field in the request is empty. + */ + pagination?: PageResponse; +} +export interface QuerySendEnabledResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.QuerySendEnabledResponse"; + value: Uint8Array; +} +/** + * QuerySendEnabledResponse defines the RPC response of a SendEnable query. + * + * Since: cosmos-sdk 0.47 + */ +export interface QuerySendEnabledResponseAmino { + send_enabled: SendEnabledAmino[]; + /** + * pagination defines the pagination in the response. This field is only + * populated if the denoms field in the request is empty. + */ + pagination?: PageResponseAmino; +} +export interface QuerySendEnabledResponseAminoMsg { + type: "cosmos-sdk/QuerySendEnabledResponse"; + value: QuerySendEnabledResponseAmino; +} +function createBaseQueryBalanceRequest(): QueryBalanceRequest { + return { + address: "", + denom: "" + }; +} +export const QueryBalanceRequest = { + typeUrl: "/cosmos.bank.v1beta1.QueryBalanceRequest", + aminoType: "cosmos-sdk/QueryBalanceRequest", + is(o: any): o is QueryBalanceRequest { + return o && (o.$typeUrl === QueryBalanceRequest.typeUrl || typeof o.address === "string" && typeof o.denom === "string"); + }, + isAmino(o: any): o is QueryBalanceRequestAmino { + return o && (o.$typeUrl === QueryBalanceRequest.typeUrl || typeof o.address === "string" && typeof o.denom === "string"); + }, + encode(message: QueryBalanceRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryBalanceRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBalanceRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.denom = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryBalanceRequest { + const message = createBaseQueryBalanceRequest(); + message.address = object.address ?? ""; + message.denom = object.denom ?? ""; + return message; + }, + fromAmino(object: QueryBalanceRequestAmino): QueryBalanceRequest { + const message = createBaseQueryBalanceRequest(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + return message; + }, + toAmino(message: QueryBalanceRequest): QueryBalanceRequestAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + obj.denom = message.denom === "" ? undefined : message.denom; + return obj; + }, + fromAminoMsg(object: QueryBalanceRequestAminoMsg): QueryBalanceRequest { + return QueryBalanceRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryBalanceRequest): QueryBalanceRequestAminoMsg { + return { + type: "cosmos-sdk/QueryBalanceRequest", + value: QueryBalanceRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryBalanceRequestProtoMsg): QueryBalanceRequest { + return QueryBalanceRequest.decode(message.value); + }, + toProto(message: QueryBalanceRequest): Uint8Array { + return QueryBalanceRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryBalanceRequest): QueryBalanceRequestProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryBalanceRequest", + value: QueryBalanceRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryBalanceRequest.typeUrl, QueryBalanceRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryBalanceRequest.aminoType, QueryBalanceRequest.typeUrl); +function createBaseQueryBalanceResponse(): QueryBalanceResponse { + return { + balance: undefined + }; +} +export const QueryBalanceResponse = { + typeUrl: "/cosmos.bank.v1beta1.QueryBalanceResponse", + aminoType: "cosmos-sdk/QueryBalanceResponse", + is(o: any): o is QueryBalanceResponse { + return o && o.$typeUrl === QueryBalanceResponse.typeUrl; + }, + isAmino(o: any): o is QueryBalanceResponseAmino { + return o && o.$typeUrl === QueryBalanceResponse.typeUrl; + }, + encode(message: QueryBalanceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.balance !== undefined) { + Coin.encode(message.balance, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryBalanceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBalanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.balance = Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryBalanceResponse { + const message = createBaseQueryBalanceResponse(); + message.balance = object.balance !== undefined && object.balance !== null ? Coin.fromPartial(object.balance) : undefined; + return message; + }, + fromAmino(object: QueryBalanceResponseAmino): QueryBalanceResponse { + const message = createBaseQueryBalanceResponse(); + if (object.balance !== undefined && object.balance !== null) { + message.balance = Coin.fromAmino(object.balance); + } + return message; + }, + toAmino(message: QueryBalanceResponse): QueryBalanceResponseAmino { + const obj: any = {}; + obj.balance = message.balance ? Coin.toAmino(message.balance) : undefined; + return obj; + }, + fromAminoMsg(object: QueryBalanceResponseAminoMsg): QueryBalanceResponse { + return QueryBalanceResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryBalanceResponse): QueryBalanceResponseAminoMsg { + return { + type: "cosmos-sdk/QueryBalanceResponse", + value: QueryBalanceResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryBalanceResponseProtoMsg): QueryBalanceResponse { + return QueryBalanceResponse.decode(message.value); + }, + toProto(message: QueryBalanceResponse): Uint8Array { + return QueryBalanceResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryBalanceResponse): QueryBalanceResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryBalanceResponse", + value: QueryBalanceResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryBalanceResponse.typeUrl, QueryBalanceResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryBalanceResponse.aminoType, QueryBalanceResponse.typeUrl); +function createBaseQueryAllBalancesRequest(): QueryAllBalancesRequest { + return { + address: "", + pagination: undefined, + resolveDenom: false + }; +} +export const QueryAllBalancesRequest = { + typeUrl: "/cosmos.bank.v1beta1.QueryAllBalancesRequest", + aminoType: "cosmos-sdk/QueryAllBalancesRequest", + is(o: any): o is QueryAllBalancesRequest { + return o && (o.$typeUrl === QueryAllBalancesRequest.typeUrl || typeof o.address === "string" && typeof o.resolveDenom === "boolean"); + }, + isAmino(o: any): o is QueryAllBalancesRequestAmino { + return o && (o.$typeUrl === QueryAllBalancesRequest.typeUrl || typeof o.address === "string" && typeof o.resolve_denom === "boolean"); + }, + encode(message: QueryAllBalancesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + if (message.resolveDenom === true) { + writer.uint32(24).bool(message.resolveDenom); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllBalancesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllBalancesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + case 3: + message.resolveDenom = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryAllBalancesRequest { + const message = createBaseQueryAllBalancesRequest(); + message.address = object.address ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + message.resolveDenom = object.resolveDenom ?? false; + return message; + }, + fromAmino(object: QueryAllBalancesRequestAmino): QueryAllBalancesRequest { + const message = createBaseQueryAllBalancesRequest(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + if (object.resolve_denom !== undefined && object.resolve_denom !== null) { + message.resolveDenom = object.resolve_denom; + } + return message; + }, + toAmino(message: QueryAllBalancesRequest): QueryAllBalancesRequestAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + obj.resolve_denom = message.resolveDenom === false ? undefined : message.resolveDenom; + return obj; + }, + fromAminoMsg(object: QueryAllBalancesRequestAminoMsg): QueryAllBalancesRequest { + return QueryAllBalancesRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryAllBalancesRequest): QueryAllBalancesRequestAminoMsg { + return { + type: "cosmos-sdk/QueryAllBalancesRequest", + value: QueryAllBalancesRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAllBalancesRequestProtoMsg): QueryAllBalancesRequest { + return QueryAllBalancesRequest.decode(message.value); + }, + toProto(message: QueryAllBalancesRequest): Uint8Array { + return QueryAllBalancesRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryAllBalancesRequest): QueryAllBalancesRequestProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryAllBalancesRequest", + value: QueryAllBalancesRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryAllBalancesRequest.typeUrl, QueryAllBalancesRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryAllBalancesRequest.aminoType, QueryAllBalancesRequest.typeUrl); +function createBaseQueryAllBalancesResponse(): QueryAllBalancesResponse { + return { + balances: [], + pagination: undefined + }; +} +export const QueryAllBalancesResponse = { + typeUrl: "/cosmos.bank.v1beta1.QueryAllBalancesResponse", + aminoType: "cosmos-sdk/QueryAllBalancesResponse", + is(o: any): o is QueryAllBalancesResponse { + return o && (o.$typeUrl === QueryAllBalancesResponse.typeUrl || Array.isArray(o.balances) && (!o.balances.length || Coin.is(o.balances[0]))); + }, + isAmino(o: any): o is QueryAllBalancesResponseAmino { + return o && (o.$typeUrl === QueryAllBalancesResponse.typeUrl || Array.isArray(o.balances) && (!o.balances.length || Coin.isAmino(o.balances[0]))); + }, + encode(message: QueryAllBalancesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.balances) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllBalancesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllBalancesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.balances.push(Coin.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryAllBalancesResponse { + const message = createBaseQueryAllBalancesResponse(); + message.balances = object.balances?.map(e => Coin.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryAllBalancesResponseAmino): QueryAllBalancesResponse { + const message = createBaseQueryAllBalancesResponse(); + message.balances = object.balances?.map(e => Coin.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryAllBalancesResponse): QueryAllBalancesResponseAmino { + const obj: any = {}; + if (message.balances) { + obj.balances = message.balances.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.balances = message.balances; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryAllBalancesResponseAminoMsg): QueryAllBalancesResponse { + return QueryAllBalancesResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryAllBalancesResponse): QueryAllBalancesResponseAminoMsg { + return { + type: "cosmos-sdk/QueryAllBalancesResponse", + value: QueryAllBalancesResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAllBalancesResponseProtoMsg): QueryAllBalancesResponse { + return QueryAllBalancesResponse.decode(message.value); + }, + toProto(message: QueryAllBalancesResponse): Uint8Array { + return QueryAllBalancesResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryAllBalancesResponse): QueryAllBalancesResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryAllBalancesResponse", + value: QueryAllBalancesResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryAllBalancesResponse.typeUrl, QueryAllBalancesResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryAllBalancesResponse.aminoType, QueryAllBalancesResponse.typeUrl); +function createBaseQuerySpendableBalancesRequest(): QuerySpendableBalancesRequest { + return { + address: "", + pagination: undefined + }; +} +export const QuerySpendableBalancesRequest = { + typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalancesRequest", + aminoType: "cosmos-sdk/QuerySpendableBalancesRequest", + is(o: any): o is QuerySpendableBalancesRequest { + return o && (o.$typeUrl === QuerySpendableBalancesRequest.typeUrl || typeof o.address === "string"); + }, + isAmino(o: any): o is QuerySpendableBalancesRequestAmino { + return o && (o.$typeUrl === QuerySpendableBalancesRequest.typeUrl || typeof o.address === "string"); + }, + encode(message: QuerySpendableBalancesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QuerySpendableBalancesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySpendableBalancesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QuerySpendableBalancesRequest { + const message = createBaseQuerySpendableBalancesRequest(); + message.address = object.address ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QuerySpendableBalancesRequestAmino): QuerySpendableBalancesRequest { + const message = createBaseQuerySpendableBalancesRequest(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QuerySpendableBalancesRequest): QuerySpendableBalancesRequestAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QuerySpendableBalancesRequestAminoMsg): QuerySpendableBalancesRequest { + return QuerySpendableBalancesRequest.fromAmino(object.value); + }, + toAminoMsg(message: QuerySpendableBalancesRequest): QuerySpendableBalancesRequestAminoMsg { + return { + type: "cosmos-sdk/QuerySpendableBalancesRequest", + value: QuerySpendableBalancesRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QuerySpendableBalancesRequestProtoMsg): QuerySpendableBalancesRequest { + return QuerySpendableBalancesRequest.decode(message.value); + }, + toProto(message: QuerySpendableBalancesRequest): Uint8Array { + return QuerySpendableBalancesRequest.encode(message).finish(); + }, + toProtoMsg(message: QuerySpendableBalancesRequest): QuerySpendableBalancesRequestProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalancesRequest", + value: QuerySpendableBalancesRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QuerySpendableBalancesRequest.typeUrl, QuerySpendableBalancesRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QuerySpendableBalancesRequest.aminoType, QuerySpendableBalancesRequest.typeUrl); +function createBaseQuerySpendableBalancesResponse(): QuerySpendableBalancesResponse { + return { + balances: [], + pagination: undefined + }; +} +export const QuerySpendableBalancesResponse = { + typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalancesResponse", + aminoType: "cosmos-sdk/QuerySpendableBalancesResponse", + is(o: any): o is QuerySpendableBalancesResponse { + return o && (o.$typeUrl === QuerySpendableBalancesResponse.typeUrl || Array.isArray(o.balances) && (!o.balances.length || Coin.is(o.balances[0]))); + }, + isAmino(o: any): o is QuerySpendableBalancesResponseAmino { + return o && (o.$typeUrl === QuerySpendableBalancesResponse.typeUrl || Array.isArray(o.balances) && (!o.balances.length || Coin.isAmino(o.balances[0]))); + }, + encode(message: QuerySpendableBalancesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.balances) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QuerySpendableBalancesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySpendableBalancesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.balances.push(Coin.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QuerySpendableBalancesResponse { + const message = createBaseQuerySpendableBalancesResponse(); + message.balances = object.balances?.map(e => Coin.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QuerySpendableBalancesResponseAmino): QuerySpendableBalancesResponse { + const message = createBaseQuerySpendableBalancesResponse(); + message.balances = object.balances?.map(e => Coin.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QuerySpendableBalancesResponse): QuerySpendableBalancesResponseAmino { + const obj: any = {}; + if (message.balances) { + obj.balances = message.balances.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.balances = message.balances; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QuerySpendableBalancesResponseAminoMsg): QuerySpendableBalancesResponse { + return QuerySpendableBalancesResponse.fromAmino(object.value); + }, + toAminoMsg(message: QuerySpendableBalancesResponse): QuerySpendableBalancesResponseAminoMsg { + return { + type: "cosmos-sdk/QuerySpendableBalancesResponse", + value: QuerySpendableBalancesResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QuerySpendableBalancesResponseProtoMsg): QuerySpendableBalancesResponse { + return QuerySpendableBalancesResponse.decode(message.value); + }, + toProto(message: QuerySpendableBalancesResponse): Uint8Array { + return QuerySpendableBalancesResponse.encode(message).finish(); + }, + toProtoMsg(message: QuerySpendableBalancesResponse): QuerySpendableBalancesResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalancesResponse", + value: QuerySpendableBalancesResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QuerySpendableBalancesResponse.typeUrl, QuerySpendableBalancesResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QuerySpendableBalancesResponse.aminoType, QuerySpendableBalancesResponse.typeUrl); +function createBaseQuerySpendableBalanceByDenomRequest(): QuerySpendableBalanceByDenomRequest { + return { + address: "", + denom: "" + }; +} +export const QuerySpendableBalanceByDenomRequest = { + typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalanceByDenomRequest", + aminoType: "cosmos-sdk/QuerySpendableBalanceByDenomRequest", + is(o: any): o is QuerySpendableBalanceByDenomRequest { + return o && (o.$typeUrl === QuerySpendableBalanceByDenomRequest.typeUrl || typeof o.address === "string" && typeof o.denom === "string"); + }, + isAmino(o: any): o is QuerySpendableBalanceByDenomRequestAmino { + return o && (o.$typeUrl === QuerySpendableBalanceByDenomRequest.typeUrl || typeof o.address === "string" && typeof o.denom === "string"); + }, + encode(message: QuerySpendableBalanceByDenomRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.denom !== "") { + writer.uint32(18).string(message.denom); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QuerySpendableBalanceByDenomRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySpendableBalanceByDenomRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.denom = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QuerySpendableBalanceByDenomRequest { + const message = createBaseQuerySpendableBalanceByDenomRequest(); + message.address = object.address ?? ""; + message.denom = object.denom ?? ""; + return message; + }, + fromAmino(object: QuerySpendableBalanceByDenomRequestAmino): QuerySpendableBalanceByDenomRequest { + const message = createBaseQuerySpendableBalanceByDenomRequest(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + return message; + }, + toAmino(message: QuerySpendableBalanceByDenomRequest): QuerySpendableBalanceByDenomRequestAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + obj.denom = message.denom === "" ? undefined : message.denom; + return obj; + }, + fromAminoMsg(object: QuerySpendableBalanceByDenomRequestAminoMsg): QuerySpendableBalanceByDenomRequest { + return QuerySpendableBalanceByDenomRequest.fromAmino(object.value); + }, + toAminoMsg(message: QuerySpendableBalanceByDenomRequest): QuerySpendableBalanceByDenomRequestAminoMsg { + return { + type: "cosmos-sdk/QuerySpendableBalanceByDenomRequest", + value: QuerySpendableBalanceByDenomRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QuerySpendableBalanceByDenomRequestProtoMsg): QuerySpendableBalanceByDenomRequest { + return QuerySpendableBalanceByDenomRequest.decode(message.value); + }, + toProto(message: QuerySpendableBalanceByDenomRequest): Uint8Array { + return QuerySpendableBalanceByDenomRequest.encode(message).finish(); + }, + toProtoMsg(message: QuerySpendableBalanceByDenomRequest): QuerySpendableBalanceByDenomRequestProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalanceByDenomRequest", + value: QuerySpendableBalanceByDenomRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QuerySpendableBalanceByDenomRequest.typeUrl, QuerySpendableBalanceByDenomRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QuerySpendableBalanceByDenomRequest.aminoType, QuerySpendableBalanceByDenomRequest.typeUrl); +function createBaseQuerySpendableBalanceByDenomResponse(): QuerySpendableBalanceByDenomResponse { + return { + balance: undefined + }; +} +export const QuerySpendableBalanceByDenomResponse = { + typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalanceByDenomResponse", + aminoType: "cosmos-sdk/QuerySpendableBalanceByDenomResponse", + is(o: any): o is QuerySpendableBalanceByDenomResponse { + return o && o.$typeUrl === QuerySpendableBalanceByDenomResponse.typeUrl; + }, + isAmino(o: any): o is QuerySpendableBalanceByDenomResponseAmino { + return o && o.$typeUrl === QuerySpendableBalanceByDenomResponse.typeUrl; + }, + encode(message: QuerySpendableBalanceByDenomResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.balance !== undefined) { + Coin.encode(message.balance, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QuerySpendableBalanceByDenomResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySpendableBalanceByDenomResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.balance = Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QuerySpendableBalanceByDenomResponse { + const message = createBaseQuerySpendableBalanceByDenomResponse(); + message.balance = object.balance !== undefined && object.balance !== null ? Coin.fromPartial(object.balance) : undefined; + return message; + }, + fromAmino(object: QuerySpendableBalanceByDenomResponseAmino): QuerySpendableBalanceByDenomResponse { + const message = createBaseQuerySpendableBalanceByDenomResponse(); + if (object.balance !== undefined && object.balance !== null) { + message.balance = Coin.fromAmino(object.balance); + } + return message; + }, + toAmino(message: QuerySpendableBalanceByDenomResponse): QuerySpendableBalanceByDenomResponseAmino { + const obj: any = {}; + obj.balance = message.balance ? Coin.toAmino(message.balance) : undefined; + return obj; + }, + fromAminoMsg(object: QuerySpendableBalanceByDenomResponseAminoMsg): QuerySpendableBalanceByDenomResponse { + return QuerySpendableBalanceByDenomResponse.fromAmino(object.value); + }, + toAminoMsg(message: QuerySpendableBalanceByDenomResponse): QuerySpendableBalanceByDenomResponseAminoMsg { + return { + type: "cosmos-sdk/QuerySpendableBalanceByDenomResponse", + value: QuerySpendableBalanceByDenomResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QuerySpendableBalanceByDenomResponseProtoMsg): QuerySpendableBalanceByDenomResponse { + return QuerySpendableBalanceByDenomResponse.decode(message.value); + }, + toProto(message: QuerySpendableBalanceByDenomResponse): Uint8Array { + return QuerySpendableBalanceByDenomResponse.encode(message).finish(); + }, + toProtoMsg(message: QuerySpendableBalanceByDenomResponse): QuerySpendableBalanceByDenomResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QuerySpendableBalanceByDenomResponse", + value: QuerySpendableBalanceByDenomResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QuerySpendableBalanceByDenomResponse.typeUrl, QuerySpendableBalanceByDenomResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QuerySpendableBalanceByDenomResponse.aminoType, QuerySpendableBalanceByDenomResponse.typeUrl); +function createBaseQueryTotalSupplyRequest(): QueryTotalSupplyRequest { + return { + pagination: undefined + }; +} +export const QueryTotalSupplyRequest = { + typeUrl: "/cosmos.bank.v1beta1.QueryTotalSupplyRequest", + aminoType: "cosmos-sdk/QueryTotalSupplyRequest", + is(o: any): o is QueryTotalSupplyRequest { + return o && o.$typeUrl === QueryTotalSupplyRequest.typeUrl; + }, + isAmino(o: any): o is QueryTotalSupplyRequestAmino { + return o && o.$typeUrl === QueryTotalSupplyRequest.typeUrl; + }, + encode(message: QueryTotalSupplyRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryTotalSupplyRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTotalSupplyRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryTotalSupplyRequest { + const message = createBaseQueryTotalSupplyRequest(); + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryTotalSupplyRequestAmino): QueryTotalSupplyRequest { + const message = createBaseQueryTotalSupplyRequest(); + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryTotalSupplyRequest): QueryTotalSupplyRequestAmino { + const obj: any = {}; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryTotalSupplyRequestAminoMsg): QueryTotalSupplyRequest { + return QueryTotalSupplyRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryTotalSupplyRequest): QueryTotalSupplyRequestAminoMsg { + return { + type: "cosmos-sdk/QueryTotalSupplyRequest", + value: QueryTotalSupplyRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryTotalSupplyRequestProtoMsg): QueryTotalSupplyRequest { + return QueryTotalSupplyRequest.decode(message.value); + }, + toProto(message: QueryTotalSupplyRequest): Uint8Array { + return QueryTotalSupplyRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryTotalSupplyRequest): QueryTotalSupplyRequestProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryTotalSupplyRequest", + value: QueryTotalSupplyRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryTotalSupplyRequest.typeUrl, QueryTotalSupplyRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryTotalSupplyRequest.aminoType, QueryTotalSupplyRequest.typeUrl); +function createBaseQueryTotalSupplyResponse(): QueryTotalSupplyResponse { + return { + supply: [], + pagination: undefined + }; +} +export const QueryTotalSupplyResponse = { + typeUrl: "/cosmos.bank.v1beta1.QueryTotalSupplyResponse", + aminoType: "cosmos-sdk/QueryTotalSupplyResponse", + is(o: any): o is QueryTotalSupplyResponse { + return o && (o.$typeUrl === QueryTotalSupplyResponse.typeUrl || Array.isArray(o.supply) && (!o.supply.length || Coin.is(o.supply[0]))); + }, + isAmino(o: any): o is QueryTotalSupplyResponseAmino { + return o && (o.$typeUrl === QueryTotalSupplyResponse.typeUrl || Array.isArray(o.supply) && (!o.supply.length || Coin.isAmino(o.supply[0]))); + }, + encode(message: QueryTotalSupplyResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.supply) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryTotalSupplyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTotalSupplyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.supply.push(Coin.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryTotalSupplyResponse { + const message = createBaseQueryTotalSupplyResponse(); + message.supply = object.supply?.map(e => Coin.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryTotalSupplyResponseAmino): QueryTotalSupplyResponse { + const message = createBaseQueryTotalSupplyResponse(); + message.supply = object.supply?.map(e => Coin.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryTotalSupplyResponse): QueryTotalSupplyResponseAmino { + const obj: any = {}; + if (message.supply) { + obj.supply = message.supply.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.supply = message.supply; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryTotalSupplyResponseAminoMsg): QueryTotalSupplyResponse { + return QueryTotalSupplyResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryTotalSupplyResponse): QueryTotalSupplyResponseAminoMsg { + return { + type: "cosmos-sdk/QueryTotalSupplyResponse", + value: QueryTotalSupplyResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryTotalSupplyResponseProtoMsg): QueryTotalSupplyResponse { + return QueryTotalSupplyResponse.decode(message.value); + }, + toProto(message: QueryTotalSupplyResponse): Uint8Array { + return QueryTotalSupplyResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryTotalSupplyResponse): QueryTotalSupplyResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryTotalSupplyResponse", + value: QueryTotalSupplyResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryTotalSupplyResponse.typeUrl, QueryTotalSupplyResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryTotalSupplyResponse.aminoType, QueryTotalSupplyResponse.typeUrl); +function createBaseQuerySupplyOfRequest(): QuerySupplyOfRequest { + return { + denom: "" + }; +} +export const QuerySupplyOfRequest = { + typeUrl: "/cosmos.bank.v1beta1.QuerySupplyOfRequest", + aminoType: "cosmos-sdk/QuerySupplyOfRequest", + is(o: any): o is QuerySupplyOfRequest { + return o && (o.$typeUrl === QuerySupplyOfRequest.typeUrl || typeof o.denom === "string"); + }, + isAmino(o: any): o is QuerySupplyOfRequestAmino { + return o && (o.$typeUrl === QuerySupplyOfRequest.typeUrl || typeof o.denom === "string"); + }, + encode(message: QuerySupplyOfRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QuerySupplyOfRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySupplyOfRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QuerySupplyOfRequest { + const message = createBaseQuerySupplyOfRequest(); + message.denom = object.denom ?? ""; + return message; + }, + fromAmino(object: QuerySupplyOfRequestAmino): QuerySupplyOfRequest { + const message = createBaseQuerySupplyOfRequest(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + return message; + }, + toAmino(message: QuerySupplyOfRequest): QuerySupplyOfRequestAmino { + const obj: any = {}; + obj.denom = message.denom === "" ? undefined : message.denom; + return obj; + }, + fromAminoMsg(object: QuerySupplyOfRequestAminoMsg): QuerySupplyOfRequest { + return QuerySupplyOfRequest.fromAmino(object.value); + }, + toAminoMsg(message: QuerySupplyOfRequest): QuerySupplyOfRequestAminoMsg { + return { + type: "cosmos-sdk/QuerySupplyOfRequest", + value: QuerySupplyOfRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QuerySupplyOfRequestProtoMsg): QuerySupplyOfRequest { + return QuerySupplyOfRequest.decode(message.value); + }, + toProto(message: QuerySupplyOfRequest): Uint8Array { + return QuerySupplyOfRequest.encode(message).finish(); + }, + toProtoMsg(message: QuerySupplyOfRequest): QuerySupplyOfRequestProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QuerySupplyOfRequest", + value: QuerySupplyOfRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QuerySupplyOfRequest.typeUrl, QuerySupplyOfRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QuerySupplyOfRequest.aminoType, QuerySupplyOfRequest.typeUrl); +function createBaseQuerySupplyOfResponse(): QuerySupplyOfResponse { + return { + amount: Coin.fromPartial({}) + }; +} +export const QuerySupplyOfResponse = { + typeUrl: "/cosmos.bank.v1beta1.QuerySupplyOfResponse", + aminoType: "cosmos-sdk/QuerySupplyOfResponse", + is(o: any): o is QuerySupplyOfResponse { + return o && (o.$typeUrl === QuerySupplyOfResponse.typeUrl || Coin.is(o.amount)); + }, + isAmino(o: any): o is QuerySupplyOfResponseAmino { + return o && (o.$typeUrl === QuerySupplyOfResponse.typeUrl || Coin.isAmino(o.amount)); + }, + encode(message: QuerySupplyOfResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QuerySupplyOfResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySupplyOfResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.amount = Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QuerySupplyOfResponse { + const message = createBaseQuerySupplyOfResponse(); + message.amount = object.amount !== undefined && object.amount !== null ? Coin.fromPartial(object.amount) : undefined; + return message; + }, + fromAmino(object: QuerySupplyOfResponseAmino): QuerySupplyOfResponse { + const message = createBaseQuerySupplyOfResponse(); + if (object.amount !== undefined && object.amount !== null) { + message.amount = Coin.fromAmino(object.amount); + } + return message; + }, + toAmino(message: QuerySupplyOfResponse): QuerySupplyOfResponseAmino { + const obj: any = {}; + obj.amount = message.amount ? Coin.toAmino(message.amount) : Coin.toAmino(Coin.fromPartial({})); + return obj; + }, + fromAminoMsg(object: QuerySupplyOfResponseAminoMsg): QuerySupplyOfResponse { + return QuerySupplyOfResponse.fromAmino(object.value); + }, + toAminoMsg(message: QuerySupplyOfResponse): QuerySupplyOfResponseAminoMsg { + return { + type: "cosmos-sdk/QuerySupplyOfResponse", + value: QuerySupplyOfResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QuerySupplyOfResponseProtoMsg): QuerySupplyOfResponse { + return QuerySupplyOfResponse.decode(message.value); + }, + toProto(message: QuerySupplyOfResponse): Uint8Array { + return QuerySupplyOfResponse.encode(message).finish(); + }, + toProtoMsg(message: QuerySupplyOfResponse): QuerySupplyOfResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QuerySupplyOfResponse", + value: QuerySupplyOfResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QuerySupplyOfResponse.typeUrl, QuerySupplyOfResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QuerySupplyOfResponse.aminoType, QuerySupplyOfResponse.typeUrl); +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} +export const QueryParamsRequest = { + typeUrl: "/cosmos.bank.v1beta1.QueryParamsRequest", + aminoType: "cosmos-sdk/QueryParamsRequest", + is(o: any): o is QueryParamsRequest { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, + fromAmino(_: QueryParamsRequestAmino): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, + toAmino(_: QueryParamsRequest): QueryParamsRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { + return QueryParamsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsRequest): QueryParamsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryParamsRequest", + value: QueryParamsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsRequestProtoMsg): QueryParamsRequest { + return QueryParamsRequest.decode(message.value); + }, + toProto(message: QueryParamsRequest): Uint8Array { + return QueryParamsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsRequest): QueryParamsRequestProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryParamsRequest", + value: QueryParamsRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryParamsRequest.typeUrl, QueryParamsRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryParamsRequest.aminoType, QueryParamsRequest.typeUrl); +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { + params: Params.fromPartial({}) + }; +} +export const QueryParamsResponse = { + typeUrl: "/cosmos.bank.v1beta1.QueryParamsResponse", + aminoType: "cosmos-sdk/QueryParamsResponse", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.is(o.params)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isAmino(o.params)); + }, + encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: QueryParamsResponseAmino): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); + return obj; + }, + fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { + return QueryParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsResponse): QueryParamsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryParamsResponse", + value: QueryParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsResponseProtoMsg): QueryParamsResponse { + return QueryParamsResponse.decode(message.value); + }, + toProto(message: QueryParamsResponse): Uint8Array { + return QueryParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsResponse): QueryParamsResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryParamsResponse", + value: QueryParamsResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryParamsResponse.typeUrl, QueryParamsResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryParamsResponse.aminoType, QueryParamsResponse.typeUrl); +function createBaseQueryDenomsMetadataRequest(): QueryDenomsMetadataRequest { + return { + pagination: undefined + }; +} +export const QueryDenomsMetadataRequest = { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomsMetadataRequest", + aminoType: "cosmos-sdk/QueryDenomsMetadataRequest", + is(o: any): o is QueryDenomsMetadataRequest { + return o && o.$typeUrl === QueryDenomsMetadataRequest.typeUrl; + }, + isAmino(o: any): o is QueryDenomsMetadataRequestAmino { + return o && o.$typeUrl === QueryDenomsMetadataRequest.typeUrl; + }, + encode(message: QueryDenomsMetadataRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomsMetadataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomsMetadataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDenomsMetadataRequest { + const message = createBaseQueryDenomsMetadataRequest(); + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryDenomsMetadataRequestAmino): QueryDenomsMetadataRequest { + const message = createBaseQueryDenomsMetadataRequest(); + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDenomsMetadataRequest): QueryDenomsMetadataRequestAmino { + const obj: any = {}; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDenomsMetadataRequestAminoMsg): QueryDenomsMetadataRequest { + return QueryDenomsMetadataRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDenomsMetadataRequest): QueryDenomsMetadataRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDenomsMetadataRequest", + value: QueryDenomsMetadataRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDenomsMetadataRequestProtoMsg): QueryDenomsMetadataRequest { + return QueryDenomsMetadataRequest.decode(message.value); + }, + toProto(message: QueryDenomsMetadataRequest): Uint8Array { + return QueryDenomsMetadataRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDenomsMetadataRequest): QueryDenomsMetadataRequestProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomsMetadataRequest", + value: QueryDenomsMetadataRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryDenomsMetadataRequest.typeUrl, QueryDenomsMetadataRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryDenomsMetadataRequest.aminoType, QueryDenomsMetadataRequest.typeUrl); +function createBaseQueryDenomsMetadataResponse(): QueryDenomsMetadataResponse { + return { + metadatas: [], + pagination: undefined + }; +} +export const QueryDenomsMetadataResponse = { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomsMetadataResponse", + aminoType: "cosmos-sdk/QueryDenomsMetadataResponse", + is(o: any): o is QueryDenomsMetadataResponse { + return o && (o.$typeUrl === QueryDenomsMetadataResponse.typeUrl || Array.isArray(o.metadatas) && (!o.metadatas.length || Metadata.is(o.metadatas[0]))); + }, + isAmino(o: any): o is QueryDenomsMetadataResponseAmino { + return o && (o.$typeUrl === QueryDenomsMetadataResponse.typeUrl || Array.isArray(o.metadatas) && (!o.metadatas.length || Metadata.isAmino(o.metadatas[0]))); + }, + encode(message: QueryDenomsMetadataResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.metadatas) { + Metadata.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomsMetadataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomsMetadataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.metadatas.push(Metadata.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDenomsMetadataResponse { + const message = createBaseQueryDenomsMetadataResponse(); + message.metadatas = object.metadatas?.map(e => Metadata.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryDenomsMetadataResponseAmino): QueryDenomsMetadataResponse { + const message = createBaseQueryDenomsMetadataResponse(); + message.metadatas = object.metadatas?.map(e => Metadata.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDenomsMetadataResponse): QueryDenomsMetadataResponseAmino { + const obj: any = {}; + if (message.metadatas) { + obj.metadatas = message.metadatas.map(e => e ? Metadata.toAmino(e) : undefined); + } else { + obj.metadatas = message.metadatas; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDenomsMetadataResponseAminoMsg): QueryDenomsMetadataResponse { + return QueryDenomsMetadataResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDenomsMetadataResponse): QueryDenomsMetadataResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDenomsMetadataResponse", + value: QueryDenomsMetadataResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDenomsMetadataResponseProtoMsg): QueryDenomsMetadataResponse { + return QueryDenomsMetadataResponse.decode(message.value); + }, + toProto(message: QueryDenomsMetadataResponse): Uint8Array { + return QueryDenomsMetadataResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDenomsMetadataResponse): QueryDenomsMetadataResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomsMetadataResponse", + value: QueryDenomsMetadataResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryDenomsMetadataResponse.typeUrl, QueryDenomsMetadataResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryDenomsMetadataResponse.aminoType, QueryDenomsMetadataResponse.typeUrl); +function createBaseQueryDenomMetadataRequest(): QueryDenomMetadataRequest { + return { + denom: "" + }; +} +export const QueryDenomMetadataRequest = { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataRequest", + aminoType: "cosmos-sdk/QueryDenomMetadataRequest", + is(o: any): o is QueryDenomMetadataRequest { + return o && (o.$typeUrl === QueryDenomMetadataRequest.typeUrl || typeof o.denom === "string"); + }, + isAmino(o: any): o is QueryDenomMetadataRequestAmino { + return o && (o.$typeUrl === QueryDenomMetadataRequest.typeUrl || typeof o.denom === "string"); + }, + encode(message: QueryDenomMetadataRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomMetadataRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomMetadataRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDenomMetadataRequest { + const message = createBaseQueryDenomMetadataRequest(); + message.denom = object.denom ?? ""; + return message; + }, + fromAmino(object: QueryDenomMetadataRequestAmino): QueryDenomMetadataRequest { + const message = createBaseQueryDenomMetadataRequest(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + return message; + }, + toAmino(message: QueryDenomMetadataRequest): QueryDenomMetadataRequestAmino { + const obj: any = {}; + obj.denom = message.denom === "" ? undefined : message.denom; + return obj; + }, + fromAminoMsg(object: QueryDenomMetadataRequestAminoMsg): QueryDenomMetadataRequest { + return QueryDenomMetadataRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDenomMetadataRequest): QueryDenomMetadataRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDenomMetadataRequest", + value: QueryDenomMetadataRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDenomMetadataRequestProtoMsg): QueryDenomMetadataRequest { + return QueryDenomMetadataRequest.decode(message.value); + }, + toProto(message: QueryDenomMetadataRequest): Uint8Array { + return QueryDenomMetadataRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDenomMetadataRequest): QueryDenomMetadataRequestProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataRequest", + value: QueryDenomMetadataRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryDenomMetadataRequest.typeUrl, QueryDenomMetadataRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryDenomMetadataRequest.aminoType, QueryDenomMetadataRequest.typeUrl); +function createBaseQueryDenomMetadataResponse(): QueryDenomMetadataResponse { + return { + metadata: Metadata.fromPartial({}) + }; +} +export const QueryDenomMetadataResponse = { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataResponse", + aminoType: "cosmos-sdk/QueryDenomMetadataResponse", + is(o: any): o is QueryDenomMetadataResponse { + return o && (o.$typeUrl === QueryDenomMetadataResponse.typeUrl || Metadata.is(o.metadata)); + }, + isAmino(o: any): o is QueryDenomMetadataResponseAmino { + return o && (o.$typeUrl === QueryDenomMetadataResponse.typeUrl || Metadata.isAmino(o.metadata)); + }, + encode(message: QueryDenomMetadataResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.metadata !== undefined) { + Metadata.encode(message.metadata, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomMetadataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomMetadataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.metadata = Metadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDenomMetadataResponse { + const message = createBaseQueryDenomMetadataResponse(); + message.metadata = object.metadata !== undefined && object.metadata !== null ? Metadata.fromPartial(object.metadata) : undefined; + return message; + }, + fromAmino(object: QueryDenomMetadataResponseAmino): QueryDenomMetadataResponse { + const message = createBaseQueryDenomMetadataResponse(); + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = Metadata.fromAmino(object.metadata); + } + return message; + }, + toAmino(message: QueryDenomMetadataResponse): QueryDenomMetadataResponseAmino { + const obj: any = {}; + obj.metadata = message.metadata ? Metadata.toAmino(message.metadata) : Metadata.toAmino(Metadata.fromPartial({})); + return obj; + }, + fromAminoMsg(object: QueryDenomMetadataResponseAminoMsg): QueryDenomMetadataResponse { + return QueryDenomMetadataResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDenomMetadataResponse): QueryDenomMetadataResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDenomMetadataResponse", + value: QueryDenomMetadataResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDenomMetadataResponseProtoMsg): QueryDenomMetadataResponse { + return QueryDenomMetadataResponse.decode(message.value); + }, + toProto(message: QueryDenomMetadataResponse): Uint8Array { + return QueryDenomMetadataResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDenomMetadataResponse): QueryDenomMetadataResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataResponse", + value: QueryDenomMetadataResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryDenomMetadataResponse.typeUrl, QueryDenomMetadataResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryDenomMetadataResponse.aminoType, QueryDenomMetadataResponse.typeUrl); +function createBaseQueryDenomMetadataByQueryStringRequest(): QueryDenomMetadataByQueryStringRequest { + return { + denom: "" + }; +} +export const QueryDenomMetadataByQueryStringRequest = { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataByQueryStringRequest", + aminoType: "cosmos-sdk/QueryDenomMetadataByQueryStringRequest", + is(o: any): o is QueryDenomMetadataByQueryStringRequest { + return o && (o.$typeUrl === QueryDenomMetadataByQueryStringRequest.typeUrl || typeof o.denom === "string"); + }, + isAmino(o: any): o is QueryDenomMetadataByQueryStringRequestAmino { + return o && (o.$typeUrl === QueryDenomMetadataByQueryStringRequest.typeUrl || typeof o.denom === "string"); + }, + encode(message: QueryDenomMetadataByQueryStringRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomMetadataByQueryStringRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomMetadataByQueryStringRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDenomMetadataByQueryStringRequest { + const message = createBaseQueryDenomMetadataByQueryStringRequest(); + message.denom = object.denom ?? ""; + return message; + }, + fromAmino(object: QueryDenomMetadataByQueryStringRequestAmino): QueryDenomMetadataByQueryStringRequest { + const message = createBaseQueryDenomMetadataByQueryStringRequest(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + return message; + }, + toAmino(message: QueryDenomMetadataByQueryStringRequest): QueryDenomMetadataByQueryStringRequestAmino { + const obj: any = {}; + obj.denom = message.denom === "" ? undefined : message.denom; + return obj; + }, + fromAminoMsg(object: QueryDenomMetadataByQueryStringRequestAminoMsg): QueryDenomMetadataByQueryStringRequest { + return QueryDenomMetadataByQueryStringRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDenomMetadataByQueryStringRequest): QueryDenomMetadataByQueryStringRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDenomMetadataByQueryStringRequest", + value: QueryDenomMetadataByQueryStringRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDenomMetadataByQueryStringRequestProtoMsg): QueryDenomMetadataByQueryStringRequest { + return QueryDenomMetadataByQueryStringRequest.decode(message.value); + }, + toProto(message: QueryDenomMetadataByQueryStringRequest): Uint8Array { + return QueryDenomMetadataByQueryStringRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDenomMetadataByQueryStringRequest): QueryDenomMetadataByQueryStringRequestProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataByQueryStringRequest", + value: QueryDenomMetadataByQueryStringRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryDenomMetadataByQueryStringRequest.typeUrl, QueryDenomMetadataByQueryStringRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryDenomMetadataByQueryStringRequest.aminoType, QueryDenomMetadataByQueryStringRequest.typeUrl); +function createBaseQueryDenomMetadataByQueryStringResponse(): QueryDenomMetadataByQueryStringResponse { + return { + metadata: Metadata.fromPartial({}) + }; +} +export const QueryDenomMetadataByQueryStringResponse = { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataByQueryStringResponse", + aminoType: "cosmos-sdk/QueryDenomMetadataByQueryStringResponse", + is(o: any): o is QueryDenomMetadataByQueryStringResponse { + return o && (o.$typeUrl === QueryDenomMetadataByQueryStringResponse.typeUrl || Metadata.is(o.metadata)); + }, + isAmino(o: any): o is QueryDenomMetadataByQueryStringResponseAmino { + return o && (o.$typeUrl === QueryDenomMetadataByQueryStringResponse.typeUrl || Metadata.isAmino(o.metadata)); + }, + encode(message: QueryDenomMetadataByQueryStringResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.metadata !== undefined) { + Metadata.encode(message.metadata, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomMetadataByQueryStringResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomMetadataByQueryStringResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.metadata = Metadata.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDenomMetadataByQueryStringResponse { + const message = createBaseQueryDenomMetadataByQueryStringResponse(); + message.metadata = object.metadata !== undefined && object.metadata !== null ? Metadata.fromPartial(object.metadata) : undefined; + return message; + }, + fromAmino(object: QueryDenomMetadataByQueryStringResponseAmino): QueryDenomMetadataByQueryStringResponse { + const message = createBaseQueryDenomMetadataByQueryStringResponse(); + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = Metadata.fromAmino(object.metadata); + } + return message; + }, + toAmino(message: QueryDenomMetadataByQueryStringResponse): QueryDenomMetadataByQueryStringResponseAmino { + const obj: any = {}; + obj.metadata = message.metadata ? Metadata.toAmino(message.metadata) : Metadata.toAmino(Metadata.fromPartial({})); + return obj; + }, + fromAminoMsg(object: QueryDenomMetadataByQueryStringResponseAminoMsg): QueryDenomMetadataByQueryStringResponse { + return QueryDenomMetadataByQueryStringResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDenomMetadataByQueryStringResponse): QueryDenomMetadataByQueryStringResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDenomMetadataByQueryStringResponse", + value: QueryDenomMetadataByQueryStringResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDenomMetadataByQueryStringResponseProtoMsg): QueryDenomMetadataByQueryStringResponse { + return QueryDenomMetadataByQueryStringResponse.decode(message.value); + }, + toProto(message: QueryDenomMetadataByQueryStringResponse): Uint8Array { + return QueryDenomMetadataByQueryStringResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDenomMetadataByQueryStringResponse): QueryDenomMetadataByQueryStringResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomMetadataByQueryStringResponse", + value: QueryDenomMetadataByQueryStringResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryDenomMetadataByQueryStringResponse.typeUrl, QueryDenomMetadataByQueryStringResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryDenomMetadataByQueryStringResponse.aminoType, QueryDenomMetadataByQueryStringResponse.typeUrl); +function createBaseQueryDenomOwnersRequest(): QueryDenomOwnersRequest { + return { + denom: "", + pagination: undefined + }; +} +export const QueryDenomOwnersRequest = { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersRequest", + aminoType: "cosmos-sdk/QueryDenomOwnersRequest", + is(o: any): o is QueryDenomOwnersRequest { + return o && (o.$typeUrl === QueryDenomOwnersRequest.typeUrl || typeof o.denom === "string"); + }, + isAmino(o: any): o is QueryDenomOwnersRequestAmino { + return o && (o.$typeUrl === QueryDenomOwnersRequest.typeUrl || typeof o.denom === "string"); + }, + encode(message: QueryDenomOwnersRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomOwnersRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomOwnersRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDenomOwnersRequest { + const message = createBaseQueryDenomOwnersRequest(); + message.denom = object.denom ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryDenomOwnersRequestAmino): QueryDenomOwnersRequest { + const message = createBaseQueryDenomOwnersRequest(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDenomOwnersRequest): QueryDenomOwnersRequestAmino { + const obj: any = {}; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDenomOwnersRequestAminoMsg): QueryDenomOwnersRequest { + return QueryDenomOwnersRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDenomOwnersRequest): QueryDenomOwnersRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDenomOwnersRequest", + value: QueryDenomOwnersRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDenomOwnersRequestProtoMsg): QueryDenomOwnersRequest { + return QueryDenomOwnersRequest.decode(message.value); + }, + toProto(message: QueryDenomOwnersRequest): Uint8Array { + return QueryDenomOwnersRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDenomOwnersRequest): QueryDenomOwnersRequestProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersRequest", + value: QueryDenomOwnersRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryDenomOwnersRequest.typeUrl, QueryDenomOwnersRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryDenomOwnersRequest.aminoType, QueryDenomOwnersRequest.typeUrl); +function createBaseDenomOwner(): DenomOwner { + return { + address: "", + balance: Coin.fromPartial({}) + }; +} +export const DenomOwner = { + typeUrl: "/cosmos.bank.v1beta1.DenomOwner", + aminoType: "cosmos-sdk/DenomOwner", + is(o: any): o is DenomOwner { + return o && (o.$typeUrl === DenomOwner.typeUrl || typeof o.address === "string" && Coin.is(o.balance)); + }, + isAmino(o: any): o is DenomOwnerAmino { + return o && (o.$typeUrl === DenomOwner.typeUrl || typeof o.address === "string" && Coin.isAmino(o.balance)); + }, + encode(message: DenomOwner, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.balance !== undefined) { + Coin.encode(message.balance, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DenomOwner { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDenomOwner(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.balance = Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): DenomOwner { + const message = createBaseDenomOwner(); + message.address = object.address ?? ""; + message.balance = object.balance !== undefined && object.balance !== null ? Coin.fromPartial(object.balance) : undefined; + return message; + }, + fromAmino(object: DenomOwnerAmino): DenomOwner { + const message = createBaseDenomOwner(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.balance !== undefined && object.balance !== null) { + message.balance = Coin.fromAmino(object.balance); + } + return message; + }, + toAmino(message: DenomOwner): DenomOwnerAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + obj.balance = message.balance ? Coin.toAmino(message.balance) : Coin.toAmino(Coin.fromPartial({})); + return obj; + }, + fromAminoMsg(object: DenomOwnerAminoMsg): DenomOwner { + return DenomOwner.fromAmino(object.value); + }, + toAminoMsg(message: DenomOwner): DenomOwnerAminoMsg { + return { + type: "cosmos-sdk/DenomOwner", + value: DenomOwner.toAmino(message) + }; + }, + fromProtoMsg(message: DenomOwnerProtoMsg): DenomOwner { + return DenomOwner.decode(message.value); + }, + toProto(message: DenomOwner): Uint8Array { + return DenomOwner.encode(message).finish(); + }, + toProtoMsg(message: DenomOwner): DenomOwnerProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.DenomOwner", + value: DenomOwner.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(DenomOwner.typeUrl, DenomOwner); +GlobalDecoderRegistry.registerAminoProtoMapping(DenomOwner.aminoType, DenomOwner.typeUrl); +function createBaseQueryDenomOwnersResponse(): QueryDenomOwnersResponse { + return { + denomOwners: [], + pagination: undefined + }; +} +export const QueryDenomOwnersResponse = { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersResponse", + aminoType: "cosmos-sdk/QueryDenomOwnersResponse", + is(o: any): o is QueryDenomOwnersResponse { + return o && (o.$typeUrl === QueryDenomOwnersResponse.typeUrl || Array.isArray(o.denomOwners) && (!o.denomOwners.length || DenomOwner.is(o.denomOwners[0]))); + }, + isAmino(o: any): o is QueryDenomOwnersResponseAmino { + return o && (o.$typeUrl === QueryDenomOwnersResponse.typeUrl || Array.isArray(o.denom_owners) && (!o.denom_owners.length || DenomOwner.isAmino(o.denom_owners[0]))); + }, + encode(message: QueryDenomOwnersResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.denomOwners) { + DenomOwner.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomOwnersResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomOwnersResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denomOwners.push(DenomOwner.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDenomOwnersResponse { + const message = createBaseQueryDenomOwnersResponse(); + message.denomOwners = object.denomOwners?.map(e => DenomOwner.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryDenomOwnersResponseAmino): QueryDenomOwnersResponse { + const message = createBaseQueryDenomOwnersResponse(); + message.denomOwners = object.denom_owners?.map(e => DenomOwner.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDenomOwnersResponse): QueryDenomOwnersResponseAmino { + const obj: any = {}; + if (message.denomOwners) { + obj.denom_owners = message.denomOwners.map(e => e ? DenomOwner.toAmino(e) : undefined); + } else { + obj.denom_owners = message.denomOwners; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDenomOwnersResponseAminoMsg): QueryDenomOwnersResponse { + return QueryDenomOwnersResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDenomOwnersResponse): QueryDenomOwnersResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDenomOwnersResponse", + value: QueryDenomOwnersResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDenomOwnersResponseProtoMsg): QueryDenomOwnersResponse { + return QueryDenomOwnersResponse.decode(message.value); + }, + toProto(message: QueryDenomOwnersResponse): Uint8Array { + return QueryDenomOwnersResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDenomOwnersResponse): QueryDenomOwnersResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersResponse", + value: QueryDenomOwnersResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryDenomOwnersResponse.typeUrl, QueryDenomOwnersResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryDenomOwnersResponse.aminoType, QueryDenomOwnersResponse.typeUrl); +function createBaseQueryDenomOwnersByQueryRequest(): QueryDenomOwnersByQueryRequest { + return { + denom: "", + pagination: undefined + }; +} +export const QueryDenomOwnersByQueryRequest = { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersByQueryRequest", + aminoType: "cosmos-sdk/QueryDenomOwnersByQueryRequest", + is(o: any): o is QueryDenomOwnersByQueryRequest { + return o && (o.$typeUrl === QueryDenomOwnersByQueryRequest.typeUrl || typeof o.denom === "string"); + }, + isAmino(o: any): o is QueryDenomOwnersByQueryRequestAmino { + return o && (o.$typeUrl === QueryDenomOwnersByQueryRequest.typeUrl || typeof o.denom === "string"); + }, + encode(message: QueryDenomOwnersByQueryRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomOwnersByQueryRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomOwnersByQueryRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDenomOwnersByQueryRequest { + const message = createBaseQueryDenomOwnersByQueryRequest(); + message.denom = object.denom ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryDenomOwnersByQueryRequestAmino): QueryDenomOwnersByQueryRequest { + const message = createBaseQueryDenomOwnersByQueryRequest(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDenomOwnersByQueryRequest): QueryDenomOwnersByQueryRequestAmino { + const obj: any = {}; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDenomOwnersByQueryRequestAminoMsg): QueryDenomOwnersByQueryRequest { + return QueryDenomOwnersByQueryRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDenomOwnersByQueryRequest): QueryDenomOwnersByQueryRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDenomOwnersByQueryRequest", + value: QueryDenomOwnersByQueryRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDenomOwnersByQueryRequestProtoMsg): QueryDenomOwnersByQueryRequest { + return QueryDenomOwnersByQueryRequest.decode(message.value); + }, + toProto(message: QueryDenomOwnersByQueryRequest): Uint8Array { + return QueryDenomOwnersByQueryRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDenomOwnersByQueryRequest): QueryDenomOwnersByQueryRequestProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersByQueryRequest", + value: QueryDenomOwnersByQueryRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryDenomOwnersByQueryRequest.typeUrl, QueryDenomOwnersByQueryRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryDenomOwnersByQueryRequest.aminoType, QueryDenomOwnersByQueryRequest.typeUrl); +function createBaseQueryDenomOwnersByQueryResponse(): QueryDenomOwnersByQueryResponse { + return { + denomOwners: [], + pagination: undefined + }; +} +export const QueryDenomOwnersByQueryResponse = { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersByQueryResponse", + aminoType: "cosmos-sdk/QueryDenomOwnersByQueryResponse", + is(o: any): o is QueryDenomOwnersByQueryResponse { + return o && (o.$typeUrl === QueryDenomOwnersByQueryResponse.typeUrl || Array.isArray(o.denomOwners) && (!o.denomOwners.length || DenomOwner.is(o.denomOwners[0]))); + }, + isAmino(o: any): o is QueryDenomOwnersByQueryResponseAmino { + return o && (o.$typeUrl === QueryDenomOwnersByQueryResponse.typeUrl || Array.isArray(o.denom_owners) && (!o.denom_owners.length || DenomOwner.isAmino(o.denom_owners[0]))); + }, + encode(message: QueryDenomOwnersByQueryResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.denomOwners) { + DenomOwner.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDenomOwnersByQueryResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDenomOwnersByQueryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denomOwners.push(DenomOwner.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDenomOwnersByQueryResponse { + const message = createBaseQueryDenomOwnersByQueryResponse(); + message.denomOwners = object.denomOwners?.map(e => DenomOwner.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryDenomOwnersByQueryResponseAmino): QueryDenomOwnersByQueryResponse { + const message = createBaseQueryDenomOwnersByQueryResponse(); + message.denomOwners = object.denom_owners?.map(e => DenomOwner.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDenomOwnersByQueryResponse): QueryDenomOwnersByQueryResponseAmino { + const obj: any = {}; + if (message.denomOwners) { + obj.denom_owners = message.denomOwners.map(e => e ? DenomOwner.toAmino(e) : undefined); + } else { + obj.denom_owners = message.denomOwners; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDenomOwnersByQueryResponseAminoMsg): QueryDenomOwnersByQueryResponse { + return QueryDenomOwnersByQueryResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDenomOwnersByQueryResponse): QueryDenomOwnersByQueryResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDenomOwnersByQueryResponse", + value: QueryDenomOwnersByQueryResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDenomOwnersByQueryResponseProtoMsg): QueryDenomOwnersByQueryResponse { + return QueryDenomOwnersByQueryResponse.decode(message.value); + }, + toProto(message: QueryDenomOwnersByQueryResponse): Uint8Array { + return QueryDenomOwnersByQueryResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDenomOwnersByQueryResponse): QueryDenomOwnersByQueryResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QueryDenomOwnersByQueryResponse", + value: QueryDenomOwnersByQueryResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryDenomOwnersByQueryResponse.typeUrl, QueryDenomOwnersByQueryResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryDenomOwnersByQueryResponse.aminoType, QueryDenomOwnersByQueryResponse.typeUrl); +function createBaseQuerySendEnabledRequest(): QuerySendEnabledRequest { + return { + denoms: [], + pagination: undefined + }; +} +export const QuerySendEnabledRequest = { + typeUrl: "/cosmos.bank.v1beta1.QuerySendEnabledRequest", + aminoType: "cosmos-sdk/QuerySendEnabledRequest", + is(o: any): o is QuerySendEnabledRequest { + return o && (o.$typeUrl === QuerySendEnabledRequest.typeUrl || Array.isArray(o.denoms) && (!o.denoms.length || typeof o.denoms[0] === "string")); + }, + isAmino(o: any): o is QuerySendEnabledRequestAmino { + return o && (o.$typeUrl === QuerySendEnabledRequest.typeUrl || Array.isArray(o.denoms) && (!o.denoms.length || typeof o.denoms[0] === "string")); + }, + encode(message: QuerySendEnabledRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.denoms) { + writer.uint32(10).string(v!); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(794).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QuerySendEnabledRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySendEnabledRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denoms.push(reader.string()); + break; + case 99: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QuerySendEnabledRequest { + const message = createBaseQuerySendEnabledRequest(); + message.denoms = object.denoms?.map(e => e) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QuerySendEnabledRequestAmino): QuerySendEnabledRequest { + const message = createBaseQuerySendEnabledRequest(); + message.denoms = object.denoms?.map(e => e) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QuerySendEnabledRequest): QuerySendEnabledRequestAmino { + const obj: any = {}; + if (message.denoms) { + obj.denoms = message.denoms.map(e => e); + } else { + obj.denoms = message.denoms; + } + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QuerySendEnabledRequestAminoMsg): QuerySendEnabledRequest { + return QuerySendEnabledRequest.fromAmino(object.value); + }, + toAminoMsg(message: QuerySendEnabledRequest): QuerySendEnabledRequestAminoMsg { + return { + type: "cosmos-sdk/QuerySendEnabledRequest", + value: QuerySendEnabledRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QuerySendEnabledRequestProtoMsg): QuerySendEnabledRequest { + return QuerySendEnabledRequest.decode(message.value); + }, + toProto(message: QuerySendEnabledRequest): Uint8Array { + return QuerySendEnabledRequest.encode(message).finish(); + }, + toProtoMsg(message: QuerySendEnabledRequest): QuerySendEnabledRequestProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QuerySendEnabledRequest", + value: QuerySendEnabledRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QuerySendEnabledRequest.typeUrl, QuerySendEnabledRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QuerySendEnabledRequest.aminoType, QuerySendEnabledRequest.typeUrl); +function createBaseQuerySendEnabledResponse(): QuerySendEnabledResponse { + return { + sendEnabled: [], + pagination: undefined + }; +} +export const QuerySendEnabledResponse = { + typeUrl: "/cosmos.bank.v1beta1.QuerySendEnabledResponse", + aminoType: "cosmos-sdk/QuerySendEnabledResponse", + is(o: any): o is QuerySendEnabledResponse { + return o && (o.$typeUrl === QuerySendEnabledResponse.typeUrl || Array.isArray(o.sendEnabled) && (!o.sendEnabled.length || SendEnabled.is(o.sendEnabled[0]))); + }, + isAmino(o: any): o is QuerySendEnabledResponseAmino { + return o && (o.$typeUrl === QuerySendEnabledResponse.typeUrl || Array.isArray(o.send_enabled) && (!o.send_enabled.length || SendEnabled.isAmino(o.send_enabled[0]))); + }, + encode(message: QuerySendEnabledResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.sendEnabled) { + SendEnabled.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(794).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QuerySendEnabledResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySendEnabledResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sendEnabled.push(SendEnabled.decode(reader, reader.uint32())); + break; + case 99: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QuerySendEnabledResponse { + const message = createBaseQuerySendEnabledResponse(); + message.sendEnabled = object.sendEnabled?.map(e => SendEnabled.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QuerySendEnabledResponseAmino): QuerySendEnabledResponse { + const message = createBaseQuerySendEnabledResponse(); + message.sendEnabled = object.send_enabled?.map(e => SendEnabled.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QuerySendEnabledResponse): QuerySendEnabledResponseAmino { + const obj: any = {}; + if (message.sendEnabled) { + obj.send_enabled = message.sendEnabled.map(e => e ? SendEnabled.toAmino(e) : undefined); + } else { + obj.send_enabled = message.sendEnabled; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QuerySendEnabledResponseAminoMsg): QuerySendEnabledResponse { + return QuerySendEnabledResponse.fromAmino(object.value); + }, + toAminoMsg(message: QuerySendEnabledResponse): QuerySendEnabledResponseAminoMsg { + return { + type: "cosmos-sdk/QuerySendEnabledResponse", + value: QuerySendEnabledResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QuerySendEnabledResponseProtoMsg): QuerySendEnabledResponse { + return QuerySendEnabledResponse.decode(message.value); + }, + toProto(message: QuerySendEnabledResponse): Uint8Array { + return QuerySendEnabledResponse.encode(message).finish(); + }, + toProtoMsg(message: QuerySendEnabledResponse): QuerySendEnabledResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.QuerySendEnabledResponse", + value: QuerySendEnabledResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QuerySendEnabledResponse.typeUrl, QuerySendEnabledResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QuerySendEnabledResponse.aminoType, QuerySendEnabledResponse.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/bank/v1beta1/tx.rpc.func.ts b/libs/interchain-query/src/cosmos/bank/v1beta1/tx.rpc.func.ts new file mode 100644 index 00000000..aa76bfe3 --- /dev/null +++ b/libs/interchain-query/src/cosmos/bank/v1beta1/tx.rpc.func.ts @@ -0,0 +1,40 @@ +import { buildTx, SigningClientResolver } from "../../../helper-func-types"; +import { buildUseMutation } from "../../../react-query"; +import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; +import { MsgSend, MsgMultiSend, MsgUpdateParams, MsgSetSendEnabled } from "./tx"; +export const createSend = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgSend.typeUrl, + encoders: toEncoders(MsgSend), + converters: toConverters(MsgSend) +}); +export const useSend = buildUseMutation({ + builderMutationFn: createSend +}); +export const createMultiSend = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgMultiSend.typeUrl, + encoders: toEncoders(MsgMultiSend), + converters: toConverters(MsgMultiSend) +}); +export const useMultiSend = buildUseMutation({ + builderMutationFn: createMultiSend +}); +export const createUpdateParams = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgUpdateParams.typeUrl, + encoders: toEncoders(MsgUpdateParams), + converters: toConverters(MsgUpdateParams) +}); +export const useUpdateParams = buildUseMutation({ + builderMutationFn: createUpdateParams +}); +export const createSetSendEnabled = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgSetSendEnabled.typeUrl, + encoders: toEncoders(MsgSetSendEnabled), + converters: toConverters(MsgSetSendEnabled) +}); +export const useSetSendEnabled = buildUseMutation({ + builderMutationFn: createSetSendEnabled +}); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/bank/v1beta1/tx.ts b/libs/interchain-query/src/cosmos/bank/v1beta1/tx.ts new file mode 100644 index 00000000..afc67365 --- /dev/null +++ b/libs/interchain-query/src/cosmos/bank/v1beta1/tx.ts @@ -0,0 +1,861 @@ +import { Coin, CoinAmino } from "../../base/v1beta1/coin"; +import { Input, InputAmino, Output, OutputAmino, Params, ParamsAmino, SendEnabled, SendEnabledAmino } from "./bank"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; +/** MsgSend represents a message to send coins from one account to another. */ +export interface MsgSend { + fromAddress: string; + toAddress: string; + amount: Coin[]; +} +export interface MsgSendProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.MsgSend"; + value: Uint8Array; +} +/** MsgSend represents a message to send coins from one account to another. */ +export interface MsgSendAmino { + from_address: string; + to_address: string; + amount: CoinAmino[]; +} +export interface MsgSendAminoMsg { + type: "cosmos-sdk/MsgSend"; + value: MsgSendAmino; +} +/** MsgSendResponse defines the Msg/Send response type. */ +export interface MsgSendResponse {} +export interface MsgSendResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.MsgSendResponse"; + value: Uint8Array; +} +/** MsgSendResponse defines the Msg/Send response type. */ +export interface MsgSendResponseAmino {} +export interface MsgSendResponseAminoMsg { + type: "cosmos-sdk/MsgSendResponse"; + value: MsgSendResponseAmino; +} +/** MsgMultiSend represents an arbitrary multi-in, multi-out send message. */ +export interface MsgMultiSend { + /** + * Inputs, despite being `repeated`, only allows one sender input. This is + * checked in MsgMultiSend's ValidateBasic. + */ + inputs: Input[]; + outputs: Output[]; +} +export interface MsgMultiSendProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.MsgMultiSend"; + value: Uint8Array; +} +/** MsgMultiSend represents an arbitrary multi-in, multi-out send message. */ +export interface MsgMultiSendAmino { + /** + * Inputs, despite being `repeated`, only allows one sender input. This is + * checked in MsgMultiSend's ValidateBasic. + */ + inputs: InputAmino[]; + outputs: OutputAmino[]; +} +export interface MsgMultiSendAminoMsg { + type: "cosmos-sdk/MsgMultiSend"; + value: MsgMultiSendAmino; +} +/** MsgMultiSendResponse defines the Msg/MultiSend response type. */ +export interface MsgMultiSendResponse {} +export interface MsgMultiSendResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.MsgMultiSendResponse"; + value: Uint8Array; +} +/** MsgMultiSendResponse defines the Msg/MultiSend response type. */ +export interface MsgMultiSendResponseAmino {} +export interface MsgMultiSendResponseAminoMsg { + type: "cosmos-sdk/MsgMultiSendResponse"; + value: MsgMultiSendResponseAmino; +} +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/bank parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params; +} +export interface MsgUpdateParamsProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.MsgUpdateParams"; + value: Uint8Array; +} +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsAmino { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/bank parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: ParamsAmino; +} +export interface MsgUpdateParamsAminoMsg { + type: "cosmos-sdk/x/bank/MsgUpdateParams"; + value: MsgUpdateParamsAmino; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse {} +export interface MsgUpdateParamsResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.MsgUpdateParamsResponse"; + value: Uint8Array; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponseAmino {} +export interface MsgUpdateParamsResponseAminoMsg { + type: "cosmos-sdk/MsgUpdateParamsResponse"; + value: MsgUpdateParamsResponseAmino; +} +/** + * MsgSetSendEnabled is the Msg/SetSendEnabled request type. + * + * Only entries to add/update/delete need to be included. + * Existing SendEnabled entries that are not included in this + * message are left unchanged. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgSetSendEnabled { + /** authority is the address that controls the module. */ + authority: string; + /** send_enabled is the list of entries to add or update. */ + sendEnabled: SendEnabled[]; + /** + * use_default_for is a list of denoms that should use the params.default_send_enabled value. + * Denoms listed here will have their SendEnabled entries deleted. + * If a denom is included that doesn't have a SendEnabled entry, + * it will be ignored. + */ + useDefaultFor: string[]; +} +export interface MsgSetSendEnabledProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.MsgSetSendEnabled"; + value: Uint8Array; +} +/** + * MsgSetSendEnabled is the Msg/SetSendEnabled request type. + * + * Only entries to add/update/delete need to be included. + * Existing SendEnabled entries that are not included in this + * message are left unchanged. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgSetSendEnabledAmino { + /** authority is the address that controls the module. */ + authority: string; + /** send_enabled is the list of entries to add or update. */ + send_enabled: SendEnabledAmino[]; + /** + * use_default_for is a list of denoms that should use the params.default_send_enabled value. + * Denoms listed here will have their SendEnabled entries deleted. + * If a denom is included that doesn't have a SendEnabled entry, + * it will be ignored. + */ + use_default_for: string[]; +} +export interface MsgSetSendEnabledAminoMsg { + type: "cosmos-sdk/MsgSetSendEnabled"; + value: MsgSetSendEnabledAmino; +} +/** + * MsgSetSendEnabledResponse defines the Msg/SetSendEnabled response type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgSetSendEnabledResponse {} +export interface MsgSetSendEnabledResponseProtoMsg { + typeUrl: "/cosmos.bank.v1beta1.MsgSetSendEnabledResponse"; + value: Uint8Array; +} +/** + * MsgSetSendEnabledResponse defines the Msg/SetSendEnabled response type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgSetSendEnabledResponseAmino {} +export interface MsgSetSendEnabledResponseAminoMsg { + type: "cosmos-sdk/MsgSetSendEnabledResponse"; + value: MsgSetSendEnabledResponseAmino; +} +function createBaseMsgSend(): MsgSend { + return { + fromAddress: "", + toAddress: "", + amount: [] + }; +} +export const MsgSend = { + typeUrl: "/cosmos.bank.v1beta1.MsgSend", + aminoType: "cosmos-sdk/MsgSend", + is(o: any): o is MsgSend { + return o && (o.$typeUrl === MsgSend.typeUrl || typeof o.fromAddress === "string" && typeof o.toAddress === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0]))); + }, + isAmino(o: any): o is MsgSendAmino { + return o && (o.$typeUrl === MsgSend.typeUrl || typeof o.from_address === "string" && typeof o.to_address === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0]))); + }, + encode(message: MsgSend, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.fromAddress !== "") { + writer.uint32(10).string(message.fromAddress); + } + if (message.toAddress !== "") { + writer.uint32(18).string(message.toAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSend { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.fromAddress = reader.string(); + break; + case 2: + message.toAddress = reader.string(); + break; + case 3: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgSend { + const message = createBaseMsgSend(); + message.fromAddress = object.fromAddress ?? ""; + message.toAddress = object.toAddress ?? ""; + message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MsgSendAmino): MsgSend { + const message = createBaseMsgSend(); + if (object.from_address !== undefined && object.from_address !== null) { + message.fromAddress = object.from_address; + } + if (object.to_address !== undefined && object.to_address !== null) { + message.toAddress = object.to_address; + } + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgSend): MsgSendAmino { + const obj: any = {}; + obj.from_address = message.fromAddress === "" ? undefined : message.fromAddress; + obj.to_address = message.toAddress === "" ? undefined : message.toAddress; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = message.amount; + } + return obj; + }, + fromAminoMsg(object: MsgSendAminoMsg): MsgSend { + return MsgSend.fromAmino(object.value); + }, + toAminoMsg(message: MsgSend): MsgSendAminoMsg { + return { + type: "cosmos-sdk/MsgSend", + value: MsgSend.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSendProtoMsg): MsgSend { + return MsgSend.decode(message.value); + }, + toProto(message: MsgSend): Uint8Array { + return MsgSend.encode(message).finish(); + }, + toProtoMsg(message: MsgSend): MsgSendProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.MsgSend", + value: MsgSend.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgSend.typeUrl, MsgSend); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgSend.aminoType, MsgSend.typeUrl); +function createBaseMsgSendResponse(): MsgSendResponse { + return {}; +} +export const MsgSendResponse = { + typeUrl: "/cosmos.bank.v1beta1.MsgSendResponse", + aminoType: "cosmos-sdk/MsgSendResponse", + is(o: any): o is MsgSendResponse { + return o && o.$typeUrl === MsgSendResponse.typeUrl; + }, + isAmino(o: any): o is MsgSendResponseAmino { + return o && o.$typeUrl === MsgSendResponse.typeUrl; + }, + encode(_: MsgSendResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSendResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgSendResponse { + const message = createBaseMsgSendResponse(); + return message; + }, + fromAmino(_: MsgSendResponseAmino): MsgSendResponse { + const message = createBaseMsgSendResponse(); + return message; + }, + toAmino(_: MsgSendResponse): MsgSendResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgSendResponseAminoMsg): MsgSendResponse { + return MsgSendResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgSendResponse): MsgSendResponseAminoMsg { + return { + type: "cosmos-sdk/MsgSendResponse", + value: MsgSendResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSendResponseProtoMsg): MsgSendResponse { + return MsgSendResponse.decode(message.value); + }, + toProto(message: MsgSendResponse): Uint8Array { + return MsgSendResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgSendResponse): MsgSendResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.MsgSendResponse", + value: MsgSendResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgSendResponse.typeUrl, MsgSendResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgSendResponse.aminoType, MsgSendResponse.typeUrl); +function createBaseMsgMultiSend(): MsgMultiSend { + return { + inputs: [], + outputs: [] + }; +} +export const MsgMultiSend = { + typeUrl: "/cosmos.bank.v1beta1.MsgMultiSend", + aminoType: "cosmos-sdk/MsgMultiSend", + is(o: any): o is MsgMultiSend { + return o && (o.$typeUrl === MsgMultiSend.typeUrl || Array.isArray(o.inputs) && (!o.inputs.length || Input.is(o.inputs[0])) && Array.isArray(o.outputs) && (!o.outputs.length || Output.is(o.outputs[0]))); + }, + isAmino(o: any): o is MsgMultiSendAmino { + return o && (o.$typeUrl === MsgMultiSend.typeUrl || Array.isArray(o.inputs) && (!o.inputs.length || Input.isAmino(o.inputs[0])) && Array.isArray(o.outputs) && (!o.outputs.length || Output.isAmino(o.outputs[0]))); + }, + encode(message: MsgMultiSend, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.inputs) { + Input.encode(v!, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.outputs) { + Output.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgMultiSend { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgMultiSend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.inputs.push(Input.decode(reader, reader.uint32())); + break; + case 2: + message.outputs.push(Output.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgMultiSend { + const message = createBaseMsgMultiSend(); + message.inputs = object.inputs?.map(e => Input.fromPartial(e)) || []; + message.outputs = object.outputs?.map(e => Output.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MsgMultiSendAmino): MsgMultiSend { + const message = createBaseMsgMultiSend(); + message.inputs = object.inputs?.map(e => Input.fromAmino(e)) || []; + message.outputs = object.outputs?.map(e => Output.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgMultiSend): MsgMultiSendAmino { + const obj: any = {}; + if (message.inputs) { + obj.inputs = message.inputs.map(e => e ? Input.toAmino(e) : undefined); + } else { + obj.inputs = message.inputs; + } + if (message.outputs) { + obj.outputs = message.outputs.map(e => e ? Output.toAmino(e) : undefined); + } else { + obj.outputs = message.outputs; + } + return obj; + }, + fromAminoMsg(object: MsgMultiSendAminoMsg): MsgMultiSend { + return MsgMultiSend.fromAmino(object.value); + }, + toAminoMsg(message: MsgMultiSend): MsgMultiSendAminoMsg { + return { + type: "cosmos-sdk/MsgMultiSend", + value: MsgMultiSend.toAmino(message) + }; + }, + fromProtoMsg(message: MsgMultiSendProtoMsg): MsgMultiSend { + return MsgMultiSend.decode(message.value); + }, + toProto(message: MsgMultiSend): Uint8Array { + return MsgMultiSend.encode(message).finish(); + }, + toProtoMsg(message: MsgMultiSend): MsgMultiSendProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.MsgMultiSend", + value: MsgMultiSend.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgMultiSend.typeUrl, MsgMultiSend); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgMultiSend.aminoType, MsgMultiSend.typeUrl); +function createBaseMsgMultiSendResponse(): MsgMultiSendResponse { + return {}; +} +export const MsgMultiSendResponse = { + typeUrl: "/cosmos.bank.v1beta1.MsgMultiSendResponse", + aminoType: "cosmos-sdk/MsgMultiSendResponse", + is(o: any): o is MsgMultiSendResponse { + return o && o.$typeUrl === MsgMultiSendResponse.typeUrl; + }, + isAmino(o: any): o is MsgMultiSendResponseAmino { + return o && o.$typeUrl === MsgMultiSendResponse.typeUrl; + }, + encode(_: MsgMultiSendResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgMultiSendResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgMultiSendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgMultiSendResponse { + const message = createBaseMsgMultiSendResponse(); + return message; + }, + fromAmino(_: MsgMultiSendResponseAmino): MsgMultiSendResponse { + const message = createBaseMsgMultiSendResponse(); + return message; + }, + toAmino(_: MsgMultiSendResponse): MsgMultiSendResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgMultiSendResponseAminoMsg): MsgMultiSendResponse { + return MsgMultiSendResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgMultiSendResponse): MsgMultiSendResponseAminoMsg { + return { + type: "cosmos-sdk/MsgMultiSendResponse", + value: MsgMultiSendResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgMultiSendResponseProtoMsg): MsgMultiSendResponse { + return MsgMultiSendResponse.decode(message.value); + }, + toProto(message: MsgMultiSendResponse): Uint8Array { + return MsgMultiSendResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgMultiSendResponse): MsgMultiSendResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.MsgMultiSendResponse", + value: MsgMultiSendResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgMultiSendResponse.typeUrl, MsgMultiSendResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgMultiSendResponse.aminoType, MsgMultiSendResponse.typeUrl); +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { + authority: "", + params: Params.fromPartial({}) + }; +} +export const MsgUpdateParams = { + typeUrl: "/cosmos.bank.v1beta1.MsgUpdateParams", + aminoType: "cosmos-sdk/x/bank/MsgUpdateParams", + is(o: any): o is MsgUpdateParams { + return o && (o.$typeUrl === MsgUpdateParams.typeUrl || typeof o.authority === "string" && Params.is(o.params)); + }, + isAmino(o: any): o is MsgUpdateParamsAmino { + return o && (o.$typeUrl === MsgUpdateParams.typeUrl || typeof o.authority === "string" && Params.isAmino(o.params)); + }, + encode(message: MsgUpdateParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + message.authority = object.authority ?? ""; + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: MsgUpdateParamsAmino): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: MsgUpdateParams): MsgUpdateParamsAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsAminoMsg): MsgUpdateParams { + return MsgUpdateParams.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParams): MsgUpdateParamsAminoMsg { + return { + type: "cosmos-sdk/x/bank/MsgUpdateParams", + value: MsgUpdateParams.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsProtoMsg): MsgUpdateParams { + return MsgUpdateParams.decode(message.value); + }, + toProto(message: MsgUpdateParams): Uint8Array { + return MsgUpdateParams.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParams): MsgUpdateParamsProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.MsgUpdateParams", + value: MsgUpdateParams.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgUpdateParams.typeUrl, MsgUpdateParams); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgUpdateParams.aminoType, MsgUpdateParams.typeUrl); +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} +export const MsgUpdateParamsResponse = { + typeUrl: "/cosmos.bank.v1beta1.MsgUpdateParamsResponse", + aminoType: "cosmos-sdk/MsgUpdateParamsResponse", + is(o: any): o is MsgUpdateParamsResponse { + return o && o.$typeUrl === MsgUpdateParamsResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateParamsResponseAmino { + return o && o.$typeUrl === MsgUpdateParamsResponse.typeUrl; + }, + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + fromAmino(_: MsgUpdateParamsResponseAmino): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + toAmino(_: MsgUpdateParamsResponse): MsgUpdateParamsResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsResponseAminoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsResponseProtoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.decode(message.value); + }, + toProto(message: MsgUpdateParamsResponse): Uint8Array { + return MsgUpdateParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgUpdateParamsResponse.typeUrl, MsgUpdateParamsResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgUpdateParamsResponse.aminoType, MsgUpdateParamsResponse.typeUrl); +function createBaseMsgSetSendEnabled(): MsgSetSendEnabled { + return { + authority: "", + sendEnabled: [], + useDefaultFor: [] + }; +} +export const MsgSetSendEnabled = { + typeUrl: "/cosmos.bank.v1beta1.MsgSetSendEnabled", + aminoType: "cosmos-sdk/MsgSetSendEnabled", + is(o: any): o is MsgSetSendEnabled { + return o && (o.$typeUrl === MsgSetSendEnabled.typeUrl || typeof o.authority === "string" && Array.isArray(o.sendEnabled) && (!o.sendEnabled.length || SendEnabled.is(o.sendEnabled[0])) && Array.isArray(o.useDefaultFor) && (!o.useDefaultFor.length || typeof o.useDefaultFor[0] === "string")); + }, + isAmino(o: any): o is MsgSetSendEnabledAmino { + return o && (o.$typeUrl === MsgSetSendEnabled.typeUrl || typeof o.authority === "string" && Array.isArray(o.send_enabled) && (!o.send_enabled.length || SendEnabled.isAmino(o.send_enabled[0])) && Array.isArray(o.use_default_for) && (!o.use_default_for.length || typeof o.use_default_for[0] === "string")); + }, + encode(message: MsgSetSendEnabled, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + for (const v of message.sendEnabled) { + SendEnabled.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.useDefaultFor) { + writer.uint32(26).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSetSendEnabled { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetSendEnabled(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.sendEnabled.push(SendEnabled.decode(reader, reader.uint32())); + break; + case 3: + message.useDefaultFor.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgSetSendEnabled { + const message = createBaseMsgSetSendEnabled(); + message.authority = object.authority ?? ""; + message.sendEnabled = object.sendEnabled?.map(e => SendEnabled.fromPartial(e)) || []; + message.useDefaultFor = object.useDefaultFor?.map(e => e) || []; + return message; + }, + fromAmino(object: MsgSetSendEnabledAmino): MsgSetSendEnabled { + const message = createBaseMsgSetSendEnabled(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + message.sendEnabled = object.send_enabled?.map(e => SendEnabled.fromAmino(e)) || []; + message.useDefaultFor = object.use_default_for?.map(e => e) || []; + return message; + }, + toAmino(message: MsgSetSendEnabled): MsgSetSendEnabledAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + if (message.sendEnabled) { + obj.send_enabled = message.sendEnabled.map(e => e ? SendEnabled.toAmino(e) : undefined); + } else { + obj.send_enabled = message.sendEnabled; + } + if (message.useDefaultFor) { + obj.use_default_for = message.useDefaultFor.map(e => e); + } else { + obj.use_default_for = message.useDefaultFor; + } + return obj; + }, + fromAminoMsg(object: MsgSetSendEnabledAminoMsg): MsgSetSendEnabled { + return MsgSetSendEnabled.fromAmino(object.value); + }, + toAminoMsg(message: MsgSetSendEnabled): MsgSetSendEnabledAminoMsg { + return { + type: "cosmos-sdk/MsgSetSendEnabled", + value: MsgSetSendEnabled.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSetSendEnabledProtoMsg): MsgSetSendEnabled { + return MsgSetSendEnabled.decode(message.value); + }, + toProto(message: MsgSetSendEnabled): Uint8Array { + return MsgSetSendEnabled.encode(message).finish(); + }, + toProtoMsg(message: MsgSetSendEnabled): MsgSetSendEnabledProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.MsgSetSendEnabled", + value: MsgSetSendEnabled.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgSetSendEnabled.typeUrl, MsgSetSendEnabled); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgSetSendEnabled.aminoType, MsgSetSendEnabled.typeUrl); +function createBaseMsgSetSendEnabledResponse(): MsgSetSendEnabledResponse { + return {}; +} +export const MsgSetSendEnabledResponse = { + typeUrl: "/cosmos.bank.v1beta1.MsgSetSendEnabledResponse", + aminoType: "cosmos-sdk/MsgSetSendEnabledResponse", + is(o: any): o is MsgSetSendEnabledResponse { + return o && o.$typeUrl === MsgSetSendEnabledResponse.typeUrl; + }, + isAmino(o: any): o is MsgSetSendEnabledResponseAmino { + return o && o.$typeUrl === MsgSetSendEnabledResponse.typeUrl; + }, + encode(_: MsgSetSendEnabledResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSetSendEnabledResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetSendEnabledResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgSetSendEnabledResponse { + const message = createBaseMsgSetSendEnabledResponse(); + return message; + }, + fromAmino(_: MsgSetSendEnabledResponseAmino): MsgSetSendEnabledResponse { + const message = createBaseMsgSetSendEnabledResponse(); + return message; + }, + toAmino(_: MsgSetSendEnabledResponse): MsgSetSendEnabledResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgSetSendEnabledResponseAminoMsg): MsgSetSendEnabledResponse { + return MsgSetSendEnabledResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgSetSendEnabledResponse): MsgSetSendEnabledResponseAminoMsg { + return { + type: "cosmos-sdk/MsgSetSendEnabledResponse", + value: MsgSetSendEnabledResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSetSendEnabledResponseProtoMsg): MsgSetSendEnabledResponse { + return MsgSetSendEnabledResponse.decode(message.value); + }, + toProto(message: MsgSetSendEnabledResponse): Uint8Array { + return MsgSetSendEnabledResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgSetSendEnabledResponse): MsgSetSendEnabledResponseProtoMsg { + return { + typeUrl: "/cosmos.bank.v1beta1.MsgSetSendEnabledResponse", + value: MsgSetSendEnabledResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgSetSendEnabledResponse.typeUrl, MsgSetSendEnabledResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgSetSendEnabledResponse.aminoType, MsgSetSendEnabledResponse.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/base/abci/v1beta1/abci.ts b/libs/interchain-query/src/cosmos/base/abci/v1beta1/abci.ts new file mode 100644 index 00000000..06316ec9 --- /dev/null +++ b/libs/interchain-query/src/cosmos/base/abci/v1beta1/abci.ts @@ -0,0 +1,1698 @@ +import { Any, AnyAmino } from "../../../../google/protobuf/any"; +import { Event, EventAmino } from "../../../../tendermint/abci/types"; +import { Block, BlockAmino } from "../../../../tendermint/types/block"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { GlobalDecoderRegistry } from "../../../../registry"; +/** + * TxResponse defines a structure containing relevant tx data and metadata. The + * tags are stringified and the log is JSON decoded. + */ +export interface TxResponse { + /** The block height */ + height: bigint; + /** The transaction hash. */ + txhash: string; + /** Namespace for the Code */ + codespace: string; + /** Response code. */ + code: number; + /** Result bytes, if any. */ + data: string; + /** + * The output of the application's logger (raw string). May be + * non-deterministic. + */ + rawLog: string; + /** The output of the application's logger (typed). May be non-deterministic. */ + logs: ABCIMessageLog[]; + /** Additional information. May be non-deterministic. */ + info: string; + /** Amount of gas requested for transaction. */ + gasWanted: bigint; + /** Amount of gas consumed by transaction. */ + gasUsed: bigint; + /** The request transaction bytes. */ + tx?: Any; + /** + * Time of the previous block. For heights > 1, it's the weighted median of + * the timestamps of the valid votes in the block.LastCommit. For height == 1, + * it's genesis time. + */ + timestamp: string; + /** + * Events defines all the events emitted by processing a transaction. Note, + * these events include those emitted by processing all the messages and those + * emitted from the ante. Whereas Logs contains the events, with + * additional metadata, emitted only by processing the messages. + * + * Since: cosmos-sdk 0.42.11, 0.44.5, 0.45 + */ + events: Event[]; +} +export interface TxResponseProtoMsg { + typeUrl: "/cosmos.base.abci.v1beta1.TxResponse"; + value: Uint8Array; +} +/** + * TxResponse defines a structure containing relevant tx data and metadata. The + * tags are stringified and the log is JSON decoded. + */ +export interface TxResponseAmino { + /** The block height */ + height: string; + /** The transaction hash. */ + txhash: string; + /** Namespace for the Code */ + codespace: string; + /** Response code. */ + code: number; + /** Result bytes, if any. */ + data: string; + /** + * The output of the application's logger (raw string). May be + * non-deterministic. + */ + raw_log: string; + /** The output of the application's logger (typed). May be non-deterministic. */ + logs: ABCIMessageLogAmino[]; + /** Additional information. May be non-deterministic. */ + info: string; + /** Amount of gas requested for transaction. */ + gas_wanted: string; + /** Amount of gas consumed by transaction. */ + gas_used: string; + /** The request transaction bytes. */ + tx?: AnyAmino; + /** + * Time of the previous block. For heights > 1, it's the weighted median of + * the timestamps of the valid votes in the block.LastCommit. For height == 1, + * it's genesis time. + */ + timestamp: string; + /** + * Events defines all the events emitted by processing a transaction. Note, + * these events include those emitted by processing all the messages and those + * emitted from the ante. Whereas Logs contains the events, with + * additional metadata, emitted only by processing the messages. + * + * Since: cosmos-sdk 0.42.11, 0.44.5, 0.45 + */ + events: EventAmino[]; +} +export interface TxResponseAminoMsg { + type: "cosmos-sdk/TxResponse"; + value: TxResponseAmino; +} +/** ABCIMessageLog defines a structure containing an indexed tx ABCI message log. */ +export interface ABCIMessageLog { + msgIndex: number; + log: string; + /** + * Events contains a slice of Event objects that were emitted during some + * execution. + */ + events: StringEvent[]; +} +export interface ABCIMessageLogProtoMsg { + typeUrl: "/cosmos.base.abci.v1beta1.ABCIMessageLog"; + value: Uint8Array; +} +/** ABCIMessageLog defines a structure containing an indexed tx ABCI message log. */ +export interface ABCIMessageLogAmino { + msg_index: number; + log: string; + /** + * Events contains a slice of Event objects that were emitted during some + * execution. + */ + events: StringEventAmino[]; +} +export interface ABCIMessageLogAminoMsg { + type: "cosmos-sdk/ABCIMessageLog"; + value: ABCIMessageLogAmino; +} +/** + * StringEvent defines en Event object wrapper where all the attributes + * contain key/value pairs that are strings instead of raw bytes. + */ +export interface StringEvent { + type: string; + attributes: Attribute[]; +} +export interface StringEventProtoMsg { + typeUrl: "/cosmos.base.abci.v1beta1.StringEvent"; + value: Uint8Array; +} +/** + * StringEvent defines en Event object wrapper where all the attributes + * contain key/value pairs that are strings instead of raw bytes. + */ +export interface StringEventAmino { + type: string; + attributes: AttributeAmino[]; +} +export interface StringEventAminoMsg { + type: "cosmos-sdk/StringEvent"; + value: StringEventAmino; +} +/** + * Attribute defines an attribute wrapper where the key and value are + * strings instead of raw bytes. + */ +export interface Attribute { + key: string; + value: string; +} +export interface AttributeProtoMsg { + typeUrl: "/cosmos.base.abci.v1beta1.Attribute"; + value: Uint8Array; +} +/** + * Attribute defines an attribute wrapper where the key and value are + * strings instead of raw bytes. + */ +export interface AttributeAmino { + key: string; + value: string; +} +export interface AttributeAminoMsg { + type: "cosmos-sdk/Attribute"; + value: AttributeAmino; +} +/** GasInfo defines tx execution gas context. */ +export interface GasInfo { + /** GasWanted is the maximum units of work we allow this tx to perform. */ + gasWanted: bigint; + /** GasUsed is the amount of gas actually consumed. */ + gasUsed: bigint; +} +export interface GasInfoProtoMsg { + typeUrl: "/cosmos.base.abci.v1beta1.GasInfo"; + value: Uint8Array; +} +/** GasInfo defines tx execution gas context. */ +export interface GasInfoAmino { + /** GasWanted is the maximum units of work we allow this tx to perform. */ + gas_wanted: string; + /** GasUsed is the amount of gas actually consumed. */ + gas_used: string; +} +export interface GasInfoAminoMsg { + type: "cosmos-sdk/GasInfo"; + value: GasInfoAmino; +} +/** Result is the union of ResponseFormat and ResponseCheckTx. */ +export interface Result { + /** + * Data is any data returned from message or handler execution. It MUST be + * length prefixed in order to separate data from multiple message executions. + * Deprecated. This field is still populated, but prefer msg_response instead + * because it also contains the Msg response typeURL. + */ + /** @deprecated */ + data: Uint8Array; + /** Log contains the log information from message or handler execution. */ + log: string; + /** + * Events contains a slice of Event objects that were emitted during message + * or handler execution. + */ + events: Event[]; + /** + * msg_responses contains the Msg handler responses type packed in Anys. + * + * Since: cosmos-sdk 0.46 + */ + msgResponses: Any[]; +} +export interface ResultProtoMsg { + typeUrl: "/cosmos.base.abci.v1beta1.Result"; + value: Uint8Array; +} +/** Result is the union of ResponseFormat and ResponseCheckTx. */ +export interface ResultAmino { + /** + * Data is any data returned from message or handler execution. It MUST be + * length prefixed in order to separate data from multiple message executions. + * Deprecated. This field is still populated, but prefer msg_response instead + * because it also contains the Msg response typeURL. + */ + /** @deprecated */ + data: string; + /** Log contains the log information from message or handler execution. */ + log: string; + /** + * Events contains a slice of Event objects that were emitted during message + * or handler execution. + */ + events: EventAmino[]; + /** + * msg_responses contains the Msg handler responses type packed in Anys. + * + * Since: cosmos-sdk 0.46 + */ + msg_responses: AnyAmino[]; +} +export interface ResultAminoMsg { + type: "cosmos-sdk/Result"; + value: ResultAmino; +} +/** + * SimulationResponse defines the response generated when a transaction is + * successfully simulated. + */ +export interface SimulationResponse { + gasInfo: GasInfo; + result?: Result; +} +export interface SimulationResponseProtoMsg { + typeUrl: "/cosmos.base.abci.v1beta1.SimulationResponse"; + value: Uint8Array; +} +/** + * SimulationResponse defines the response generated when a transaction is + * successfully simulated. + */ +export interface SimulationResponseAmino { + gas_info: GasInfoAmino; + result?: ResultAmino; +} +export interface SimulationResponseAminoMsg { + type: "cosmos-sdk/SimulationResponse"; + value: SimulationResponseAmino; +} +/** + * MsgData defines the data returned in a Result object during message + * execution. + */ +/** @deprecated */ +export interface MsgData { + msgType: string; + data: Uint8Array; +} +export interface MsgDataProtoMsg { + typeUrl: "/cosmos.base.abci.v1beta1.MsgData"; + value: Uint8Array; +} +/** + * MsgData defines the data returned in a Result object during message + * execution. + */ +/** @deprecated */ +export interface MsgDataAmino { + msg_type: string; + data: string; +} +export interface MsgDataAminoMsg { + type: "cosmos-sdk/MsgData"; + value: MsgDataAmino; +} +/** + * TxMsgData defines a list of MsgData. A transaction will have a MsgData object + * for each message. + */ +export interface TxMsgData { + /** data field is deprecated and not populated. */ + /** @deprecated */ + data: MsgData[]; + /** + * msg_responses contains the Msg handler responses packed into Anys. + * + * Since: cosmos-sdk 0.46 + */ + msgResponses: Any[]; +} +export interface TxMsgDataProtoMsg { + typeUrl: "/cosmos.base.abci.v1beta1.TxMsgData"; + value: Uint8Array; +} +/** + * TxMsgData defines a list of MsgData. A transaction will have a MsgData object + * for each message. + */ +export interface TxMsgDataAmino { + /** data field is deprecated and not populated. */ + /** @deprecated */ + data: MsgDataAmino[]; + /** + * msg_responses contains the Msg handler responses packed into Anys. + * + * Since: cosmos-sdk 0.46 + */ + msg_responses: AnyAmino[]; +} +export interface TxMsgDataAminoMsg { + type: "cosmos-sdk/TxMsgData"; + value: TxMsgDataAmino; +} +/** SearchTxsResult defines a structure for querying txs pageable */ +export interface SearchTxsResult { + /** Count of all txs */ + totalCount: bigint; + /** Count of txs in current page */ + count: bigint; + /** Index of current page, start from 1 */ + pageNumber: bigint; + /** Count of total pages */ + pageTotal: bigint; + /** Max count txs per page */ + limit: bigint; + /** List of txs in current page */ + txs: TxResponse[]; +} +export interface SearchTxsResultProtoMsg { + typeUrl: "/cosmos.base.abci.v1beta1.SearchTxsResult"; + value: Uint8Array; +} +/** SearchTxsResult defines a structure for querying txs pageable */ +export interface SearchTxsResultAmino { + /** Count of all txs */ + total_count: string; + /** Count of txs in current page */ + count: string; + /** Index of current page, start from 1 */ + page_number: string; + /** Count of total pages */ + page_total: string; + /** Max count txs per page */ + limit: string; + /** List of txs in current page */ + txs: TxResponseAmino[]; +} +export interface SearchTxsResultAminoMsg { + type: "cosmos-sdk/SearchTxsResult"; + value: SearchTxsResultAmino; +} +/** SearchBlocksResult defines a structure for querying blocks pageable */ +export interface SearchBlocksResult { + /** Count of all blocks */ + totalCount: bigint; + /** Count of blocks in current page */ + count: bigint; + /** Index of current page, start from 1 */ + pageNumber: bigint; + /** Count of total pages */ + pageTotal: bigint; + /** Max count blocks per page */ + limit: bigint; + /** List of blocks in current page */ + blocks: Block[]; +} +export interface SearchBlocksResultProtoMsg { + typeUrl: "/cosmos.base.abci.v1beta1.SearchBlocksResult"; + value: Uint8Array; +} +/** SearchBlocksResult defines a structure for querying blocks pageable */ +export interface SearchBlocksResultAmino { + /** Count of all blocks */ + total_count: string; + /** Count of blocks in current page */ + count: string; + /** Index of current page, start from 1 */ + page_number: string; + /** Count of total pages */ + page_total: string; + /** Max count blocks per page */ + limit: string; + /** List of blocks in current page */ + blocks: BlockAmino[]; +} +export interface SearchBlocksResultAminoMsg { + type: "cosmos-sdk/SearchBlocksResult"; + value: SearchBlocksResultAmino; +} +function createBaseTxResponse(): TxResponse { + return { + height: BigInt(0), + txhash: "", + codespace: "", + code: 0, + data: "", + rawLog: "", + logs: [], + info: "", + gasWanted: BigInt(0), + gasUsed: BigInt(0), + tx: undefined, + timestamp: "", + events: [] + }; +} +export const TxResponse = { + typeUrl: "/cosmos.base.abci.v1beta1.TxResponse", + aminoType: "cosmos-sdk/TxResponse", + is(o: any): o is TxResponse { + return o && (o.$typeUrl === TxResponse.typeUrl || typeof o.height === "bigint" && typeof o.txhash === "string" && typeof o.codespace === "string" && typeof o.code === "number" && typeof o.data === "string" && typeof o.rawLog === "string" && Array.isArray(o.logs) && (!o.logs.length || ABCIMessageLog.is(o.logs[0])) && typeof o.info === "string" && typeof o.gasWanted === "bigint" && typeof o.gasUsed === "bigint" && typeof o.timestamp === "string" && Array.isArray(o.events) && (!o.events.length || Event.is(o.events[0]))); + }, + isAmino(o: any): o is TxResponseAmino { + return o && (o.$typeUrl === TxResponse.typeUrl || typeof o.height === "bigint" && typeof o.txhash === "string" && typeof o.codespace === "string" && typeof o.code === "number" && typeof o.data === "string" && typeof o.raw_log === "string" && Array.isArray(o.logs) && (!o.logs.length || ABCIMessageLog.isAmino(o.logs[0])) && typeof o.info === "string" && typeof o.gas_wanted === "bigint" && typeof o.gas_used === "bigint" && typeof o.timestamp === "string" && Array.isArray(o.events) && (!o.events.length || Event.isAmino(o.events[0]))); + }, + encode(message: TxResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { + writer.uint32(8).int64(message.height); + } + if (message.txhash !== "") { + writer.uint32(18).string(message.txhash); + } + if (message.codespace !== "") { + writer.uint32(26).string(message.codespace); + } + if (message.code !== 0) { + writer.uint32(32).uint32(message.code); + } + if (message.data !== "") { + writer.uint32(42).string(message.data); + } + if (message.rawLog !== "") { + writer.uint32(50).string(message.rawLog); + } + for (const v of message.logs) { + ABCIMessageLog.encode(v!, writer.uint32(58).fork()).ldelim(); + } + if (message.info !== "") { + writer.uint32(66).string(message.info); + } + if (message.gasWanted !== BigInt(0)) { + writer.uint32(72).int64(message.gasWanted); + } + if (message.gasUsed !== BigInt(0)) { + writer.uint32(80).int64(message.gasUsed); + } + if (message.tx !== undefined) { + Any.encode(message.tx, writer.uint32(90).fork()).ldelim(); + } + if (message.timestamp !== "") { + writer.uint32(98).string(message.timestamp); + } + for (const v of message.events) { + Event.encode(v!, writer.uint32(106).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.int64(); + break; + case 2: + message.txhash = reader.string(); + break; + case 3: + message.codespace = reader.string(); + break; + case 4: + message.code = reader.uint32(); + break; + case 5: + message.data = reader.string(); + break; + case 6: + message.rawLog = reader.string(); + break; + case 7: + message.logs.push(ABCIMessageLog.decode(reader, reader.uint32())); + break; + case 8: + message.info = reader.string(); + break; + case 9: + message.gasWanted = reader.int64(); + break; + case 10: + message.gasUsed = reader.int64(); + break; + case 11: + message.tx = Any.decode(reader, reader.uint32()); + break; + case 12: + message.timestamp = reader.string(); + break; + case 13: + message.events.push(Event.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): TxResponse { + const message = createBaseTxResponse(); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.txhash = object.txhash ?? ""; + message.codespace = object.codespace ?? ""; + message.code = object.code ?? 0; + message.data = object.data ?? ""; + message.rawLog = object.rawLog ?? ""; + message.logs = object.logs?.map(e => ABCIMessageLog.fromPartial(e)) || []; + message.info = object.info ?? ""; + message.gasWanted = object.gasWanted !== undefined && object.gasWanted !== null ? BigInt(object.gasWanted.toString()) : BigInt(0); + message.gasUsed = object.gasUsed !== undefined && object.gasUsed !== null ? BigInt(object.gasUsed.toString()) : BigInt(0); + message.tx = object.tx !== undefined && object.tx !== null ? Any.fromPartial(object.tx) : undefined; + message.timestamp = object.timestamp ?? ""; + message.events = object.events?.map(e => Event.fromPartial(e)) || []; + return message; + }, + fromAmino(object: TxResponseAmino): TxResponse { + const message = createBaseTxResponse(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.txhash !== undefined && object.txhash !== null) { + message.txhash = object.txhash; + } + if (object.codespace !== undefined && object.codespace !== null) { + message.codespace = object.codespace; + } + if (object.code !== undefined && object.code !== null) { + message.code = object.code; + } + if (object.data !== undefined && object.data !== null) { + message.data = object.data; + } + if (object.raw_log !== undefined && object.raw_log !== null) { + message.rawLog = object.raw_log; + } + message.logs = object.logs?.map(e => ABCIMessageLog.fromAmino(e)) || []; + if (object.info !== undefined && object.info !== null) { + message.info = object.info; + } + if (object.gas_wanted !== undefined && object.gas_wanted !== null) { + message.gasWanted = BigInt(object.gas_wanted); + } + if (object.gas_used !== undefined && object.gas_used !== null) { + message.gasUsed = BigInt(object.gas_used); + } + if (object.tx !== undefined && object.tx !== null) { + message.tx = Any.fromAmino(object.tx); + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = object.timestamp; + } + message.events = object.events?.map(e => Event.fromAmino(e)) || []; + return message; + }, + toAmino(message: TxResponse): TxResponseAmino { + const obj: any = {}; + obj.height = message.height !== BigInt(0) ? message.height?.toString() : undefined; + obj.txhash = message.txhash === "" ? undefined : message.txhash; + obj.codespace = message.codespace === "" ? undefined : message.codespace; + obj.code = message.code === 0 ? undefined : message.code; + obj.data = message.data === "" ? undefined : message.data; + obj.raw_log = message.rawLog === "" ? undefined : message.rawLog; + if (message.logs) { + obj.logs = message.logs.map(e => e ? ABCIMessageLog.toAmino(e) : undefined); + } else { + obj.logs = message.logs; + } + obj.info = message.info === "" ? undefined : message.info; + obj.gas_wanted = message.gasWanted !== BigInt(0) ? message.gasWanted?.toString() : undefined; + obj.gas_used = message.gasUsed !== BigInt(0) ? message.gasUsed?.toString() : undefined; + obj.tx = message.tx ? Any.toAmino(message.tx) : undefined; + obj.timestamp = message.timestamp === "" ? undefined : message.timestamp; + if (message.events) { + obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); + } else { + obj.events = message.events; + } + return obj; + }, + fromAminoMsg(object: TxResponseAminoMsg): TxResponse { + return TxResponse.fromAmino(object.value); + }, + toAminoMsg(message: TxResponse): TxResponseAminoMsg { + return { + type: "cosmos-sdk/TxResponse", + value: TxResponse.toAmino(message) + }; + }, + fromProtoMsg(message: TxResponseProtoMsg): TxResponse { + return TxResponse.decode(message.value); + }, + toProto(message: TxResponse): Uint8Array { + return TxResponse.encode(message).finish(); + }, + toProtoMsg(message: TxResponse): TxResponseProtoMsg { + return { + typeUrl: "/cosmos.base.abci.v1beta1.TxResponse", + value: TxResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(TxResponse.typeUrl, TxResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(TxResponse.aminoType, TxResponse.typeUrl); +function createBaseABCIMessageLog(): ABCIMessageLog { + return { + msgIndex: 0, + log: "", + events: [] + }; +} +export const ABCIMessageLog = { + typeUrl: "/cosmos.base.abci.v1beta1.ABCIMessageLog", + aminoType: "cosmos-sdk/ABCIMessageLog", + is(o: any): o is ABCIMessageLog { + return o && (o.$typeUrl === ABCIMessageLog.typeUrl || typeof o.msgIndex === "number" && typeof o.log === "string" && Array.isArray(o.events) && (!o.events.length || StringEvent.is(o.events[0]))); + }, + isAmino(o: any): o is ABCIMessageLogAmino { + return o && (o.$typeUrl === ABCIMessageLog.typeUrl || typeof o.msg_index === "number" && typeof o.log === "string" && Array.isArray(o.events) && (!o.events.length || StringEvent.isAmino(o.events[0]))); + }, + encode(message: ABCIMessageLog, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.msgIndex !== 0) { + writer.uint32(8).uint32(message.msgIndex); + } + if (message.log !== "") { + writer.uint32(18).string(message.log); + } + for (const v of message.events) { + StringEvent.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ABCIMessageLog { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseABCIMessageLog(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.msgIndex = reader.uint32(); + break; + case 2: + message.log = reader.string(); + break; + case 3: + message.events.push(StringEvent.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ABCIMessageLog { + const message = createBaseABCIMessageLog(); + message.msgIndex = object.msgIndex ?? 0; + message.log = object.log ?? ""; + message.events = object.events?.map(e => StringEvent.fromPartial(e)) || []; + return message; + }, + fromAmino(object: ABCIMessageLogAmino): ABCIMessageLog { + const message = createBaseABCIMessageLog(); + if (object.msg_index !== undefined && object.msg_index !== null) { + message.msgIndex = object.msg_index; + } + if (object.log !== undefined && object.log !== null) { + message.log = object.log; + } + message.events = object.events?.map(e => StringEvent.fromAmino(e)) || []; + return message; + }, + toAmino(message: ABCIMessageLog): ABCIMessageLogAmino { + const obj: any = {}; + obj.msg_index = message.msgIndex ?? 0; + obj.log = message.log === "" ? undefined : message.log; + if (message.events) { + obj.events = message.events.map(e => e ? StringEvent.toAmino(e) : undefined); + } else { + obj.events = message.events; + } + return obj; + }, + fromAminoMsg(object: ABCIMessageLogAminoMsg): ABCIMessageLog { + return ABCIMessageLog.fromAmino(object.value); + }, + toAminoMsg(message: ABCIMessageLog): ABCIMessageLogAminoMsg { + return { + type: "cosmos-sdk/ABCIMessageLog", + value: ABCIMessageLog.toAmino(message) + }; + }, + fromProtoMsg(message: ABCIMessageLogProtoMsg): ABCIMessageLog { + return ABCIMessageLog.decode(message.value); + }, + toProto(message: ABCIMessageLog): Uint8Array { + return ABCIMessageLog.encode(message).finish(); + }, + toProtoMsg(message: ABCIMessageLog): ABCIMessageLogProtoMsg { + return { + typeUrl: "/cosmos.base.abci.v1beta1.ABCIMessageLog", + value: ABCIMessageLog.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ABCIMessageLog.typeUrl, ABCIMessageLog); +GlobalDecoderRegistry.registerAminoProtoMapping(ABCIMessageLog.aminoType, ABCIMessageLog.typeUrl); +function createBaseStringEvent(): StringEvent { + return { + type: "", + attributes: [] + }; +} +export const StringEvent = { + typeUrl: "/cosmos.base.abci.v1beta1.StringEvent", + aminoType: "cosmos-sdk/StringEvent", + is(o: any): o is StringEvent { + return o && (o.$typeUrl === StringEvent.typeUrl || typeof o.type === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.is(o.attributes[0]))); + }, + isAmino(o: any): o is StringEventAmino { + return o && (o.$typeUrl === StringEvent.typeUrl || typeof o.type === "string" && Array.isArray(o.attributes) && (!o.attributes.length || Attribute.isAmino(o.attributes[0]))); + }, + encode(message: StringEvent, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.type !== "") { + writer.uint32(10).string(message.type); + } + for (const v of message.attributes) { + Attribute.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): StringEvent { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseStringEvent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = reader.string(); + break; + case 2: + message.attributes.push(Attribute.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): StringEvent { + const message = createBaseStringEvent(); + message.type = object.type ?? ""; + message.attributes = object.attributes?.map(e => Attribute.fromPartial(e)) || []; + return message; + }, + fromAmino(object: StringEventAmino): StringEvent { + const message = createBaseStringEvent(); + if (object.type !== undefined && object.type !== null) { + message.type = object.type; + } + message.attributes = object.attributes?.map(e => Attribute.fromAmino(e)) || []; + return message; + }, + toAmino(message: StringEvent): StringEventAmino { + const obj: any = {}; + obj.type = message.type === "" ? undefined : message.type; + if (message.attributes) { + obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); + } else { + obj.attributes = message.attributes; + } + return obj; + }, + fromAminoMsg(object: StringEventAminoMsg): StringEvent { + return StringEvent.fromAmino(object.value); + }, + toAminoMsg(message: StringEvent): StringEventAminoMsg { + return { + type: "cosmos-sdk/StringEvent", + value: StringEvent.toAmino(message) + }; + }, + fromProtoMsg(message: StringEventProtoMsg): StringEvent { + return StringEvent.decode(message.value); + }, + toProto(message: StringEvent): Uint8Array { + return StringEvent.encode(message).finish(); + }, + toProtoMsg(message: StringEvent): StringEventProtoMsg { + return { + typeUrl: "/cosmos.base.abci.v1beta1.StringEvent", + value: StringEvent.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(StringEvent.typeUrl, StringEvent); +GlobalDecoderRegistry.registerAminoProtoMapping(StringEvent.aminoType, StringEvent.typeUrl); +function createBaseAttribute(): Attribute { + return { + key: "", + value: "" + }; +} +export const Attribute = { + typeUrl: "/cosmos.base.abci.v1beta1.Attribute", + aminoType: "cosmos-sdk/Attribute", + is(o: any): o is Attribute { + return o && (o.$typeUrl === Attribute.typeUrl || typeof o.key === "string" && typeof o.value === "string"); + }, + isAmino(o: any): o is AttributeAmino { + return o && (o.$typeUrl === Attribute.typeUrl || typeof o.key === "string" && typeof o.value === "string"); + }, + encode(message: Attribute, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Attribute { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAttribute(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.string(); + break; + case 2: + message.value = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Attribute { + const message = createBaseAttribute(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + return message; + }, + fromAmino(object: AttributeAmino): Attribute { + const message = createBaseAttribute(); + if (object.key !== undefined && object.key !== null) { + message.key = object.key; + } + if (object.value !== undefined && object.value !== null) { + message.value = object.value; + } + return message; + }, + toAmino(message: Attribute): AttributeAmino { + const obj: any = {}; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; + return obj; + }, + fromAminoMsg(object: AttributeAminoMsg): Attribute { + return Attribute.fromAmino(object.value); + }, + toAminoMsg(message: Attribute): AttributeAminoMsg { + return { + type: "cosmos-sdk/Attribute", + value: Attribute.toAmino(message) + }; + }, + fromProtoMsg(message: AttributeProtoMsg): Attribute { + return Attribute.decode(message.value); + }, + toProto(message: Attribute): Uint8Array { + return Attribute.encode(message).finish(); + }, + toProtoMsg(message: Attribute): AttributeProtoMsg { + return { + typeUrl: "/cosmos.base.abci.v1beta1.Attribute", + value: Attribute.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Attribute.typeUrl, Attribute); +GlobalDecoderRegistry.registerAminoProtoMapping(Attribute.aminoType, Attribute.typeUrl); +function createBaseGasInfo(): GasInfo { + return { + gasWanted: BigInt(0), + gasUsed: BigInt(0) + }; +} +export const GasInfo = { + typeUrl: "/cosmos.base.abci.v1beta1.GasInfo", + aminoType: "cosmos-sdk/GasInfo", + is(o: any): o is GasInfo { + return o && (o.$typeUrl === GasInfo.typeUrl || typeof o.gasWanted === "bigint" && typeof o.gasUsed === "bigint"); + }, + isAmino(o: any): o is GasInfoAmino { + return o && (o.$typeUrl === GasInfo.typeUrl || typeof o.gas_wanted === "bigint" && typeof o.gas_used === "bigint"); + }, + encode(message: GasInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.gasWanted !== BigInt(0)) { + writer.uint32(8).uint64(message.gasWanted); + } + if (message.gasUsed !== BigInt(0)) { + writer.uint32(16).uint64(message.gasUsed); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GasInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGasInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.gasWanted = reader.uint64(); + break; + case 2: + message.gasUsed = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): GasInfo { + const message = createBaseGasInfo(); + message.gasWanted = object.gasWanted !== undefined && object.gasWanted !== null ? BigInt(object.gasWanted.toString()) : BigInt(0); + message.gasUsed = object.gasUsed !== undefined && object.gasUsed !== null ? BigInt(object.gasUsed.toString()) : BigInt(0); + return message; + }, + fromAmino(object: GasInfoAmino): GasInfo { + const message = createBaseGasInfo(); + if (object.gas_wanted !== undefined && object.gas_wanted !== null) { + message.gasWanted = BigInt(object.gas_wanted); + } + if (object.gas_used !== undefined && object.gas_used !== null) { + message.gasUsed = BigInt(object.gas_used); + } + return message; + }, + toAmino(message: GasInfo): GasInfoAmino { + const obj: any = {}; + obj.gas_wanted = message.gasWanted !== BigInt(0) ? message.gasWanted?.toString() : undefined; + obj.gas_used = message.gasUsed !== BigInt(0) ? message.gasUsed?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: GasInfoAminoMsg): GasInfo { + return GasInfo.fromAmino(object.value); + }, + toAminoMsg(message: GasInfo): GasInfoAminoMsg { + return { + type: "cosmos-sdk/GasInfo", + value: GasInfo.toAmino(message) + }; + }, + fromProtoMsg(message: GasInfoProtoMsg): GasInfo { + return GasInfo.decode(message.value); + }, + toProto(message: GasInfo): Uint8Array { + return GasInfo.encode(message).finish(); + }, + toProtoMsg(message: GasInfo): GasInfoProtoMsg { + return { + typeUrl: "/cosmos.base.abci.v1beta1.GasInfo", + value: GasInfo.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(GasInfo.typeUrl, GasInfo); +GlobalDecoderRegistry.registerAminoProtoMapping(GasInfo.aminoType, GasInfo.typeUrl); +function createBaseResult(): Result { + return { + data: new Uint8Array(), + log: "", + events: [], + msgResponses: [] + }; +} +export const Result = { + typeUrl: "/cosmos.base.abci.v1beta1.Result", + aminoType: "cosmos-sdk/Result", + is(o: any): o is Result { + return o && (o.$typeUrl === Result.typeUrl || (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.log === "string" && Array.isArray(o.events) && (!o.events.length || Event.is(o.events[0])) && Array.isArray(o.msgResponses) && (!o.msgResponses.length || Any.is(o.msgResponses[0]))); + }, + isAmino(o: any): o is ResultAmino { + return o && (o.$typeUrl === Result.typeUrl || (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.log === "string" && Array.isArray(o.events) && (!o.events.length || Event.isAmino(o.events[0])) && Array.isArray(o.msg_responses) && (!o.msg_responses.length || Any.isAmino(o.msg_responses[0]))); + }, + encode(message: Result, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + if (message.log !== "") { + writer.uint32(18).string(message.log); + } + for (const v of message.events) { + Event.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.msgResponses) { + Any.encode(v!, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Result { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.data = reader.bytes(); + break; + case 2: + message.log = reader.string(); + break; + case 3: + message.events.push(Event.decode(reader, reader.uint32())); + break; + case 4: + message.msgResponses.push(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Result { + const message = createBaseResult(); + message.data = object.data ?? new Uint8Array(); + message.log = object.log ?? ""; + message.events = object.events?.map(e => Event.fromPartial(e)) || []; + message.msgResponses = object.msgResponses?.map(e => Any.fromPartial(e)) || []; + return message; + }, + fromAmino(object: ResultAmino): Result { + const message = createBaseResult(); + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + if (object.log !== undefined && object.log !== null) { + message.log = object.log; + } + message.events = object.events?.map(e => Event.fromAmino(e)) || []; + message.msgResponses = object.msg_responses?.map(e => Any.fromAmino(e)) || []; + return message; + }, + toAmino(message: Result): ResultAmino { + const obj: any = {}; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + obj.log = message.log === "" ? undefined : message.log; + if (message.events) { + obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); + } else { + obj.events = message.events; + } + if (message.msgResponses) { + obj.msg_responses = message.msgResponses.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.msg_responses = message.msgResponses; + } + return obj; + }, + fromAminoMsg(object: ResultAminoMsg): Result { + return Result.fromAmino(object.value); + }, + toAminoMsg(message: Result): ResultAminoMsg { + return { + type: "cosmos-sdk/Result", + value: Result.toAmino(message) + }; + }, + fromProtoMsg(message: ResultProtoMsg): Result { + return Result.decode(message.value); + }, + toProto(message: Result): Uint8Array { + return Result.encode(message).finish(); + }, + toProtoMsg(message: Result): ResultProtoMsg { + return { + typeUrl: "/cosmos.base.abci.v1beta1.Result", + value: Result.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Result.typeUrl, Result); +GlobalDecoderRegistry.registerAminoProtoMapping(Result.aminoType, Result.typeUrl); +function createBaseSimulationResponse(): SimulationResponse { + return { + gasInfo: GasInfo.fromPartial({}), + result: undefined + }; +} +export const SimulationResponse = { + typeUrl: "/cosmos.base.abci.v1beta1.SimulationResponse", + aminoType: "cosmos-sdk/SimulationResponse", + is(o: any): o is SimulationResponse { + return o && (o.$typeUrl === SimulationResponse.typeUrl || GasInfo.is(o.gasInfo)); + }, + isAmino(o: any): o is SimulationResponseAmino { + return o && (o.$typeUrl === SimulationResponse.typeUrl || GasInfo.isAmino(o.gas_info)); + }, + encode(message: SimulationResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.gasInfo !== undefined) { + GasInfo.encode(message.gasInfo, writer.uint32(10).fork()).ldelim(); + } + if (message.result !== undefined) { + Result.encode(message.result, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SimulationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSimulationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.gasInfo = GasInfo.decode(reader, reader.uint32()); + break; + case 2: + message.result = Result.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SimulationResponse { + const message = createBaseSimulationResponse(); + message.gasInfo = object.gasInfo !== undefined && object.gasInfo !== null ? GasInfo.fromPartial(object.gasInfo) : undefined; + message.result = object.result !== undefined && object.result !== null ? Result.fromPartial(object.result) : undefined; + return message; + }, + fromAmino(object: SimulationResponseAmino): SimulationResponse { + const message = createBaseSimulationResponse(); + if (object.gas_info !== undefined && object.gas_info !== null) { + message.gasInfo = GasInfo.fromAmino(object.gas_info); + } + if (object.result !== undefined && object.result !== null) { + message.result = Result.fromAmino(object.result); + } + return message; + }, + toAmino(message: SimulationResponse): SimulationResponseAmino { + const obj: any = {}; + obj.gas_info = message.gasInfo ? GasInfo.toAmino(message.gasInfo) : undefined; + obj.result = message.result ? Result.toAmino(message.result) : undefined; + return obj; + }, + fromAminoMsg(object: SimulationResponseAminoMsg): SimulationResponse { + return SimulationResponse.fromAmino(object.value); + }, + toAminoMsg(message: SimulationResponse): SimulationResponseAminoMsg { + return { + type: "cosmos-sdk/SimulationResponse", + value: SimulationResponse.toAmino(message) + }; + }, + fromProtoMsg(message: SimulationResponseProtoMsg): SimulationResponse { + return SimulationResponse.decode(message.value); + }, + toProto(message: SimulationResponse): Uint8Array { + return SimulationResponse.encode(message).finish(); + }, + toProtoMsg(message: SimulationResponse): SimulationResponseProtoMsg { + return { + typeUrl: "/cosmos.base.abci.v1beta1.SimulationResponse", + value: SimulationResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(SimulationResponse.typeUrl, SimulationResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(SimulationResponse.aminoType, SimulationResponse.typeUrl); +function createBaseMsgData(): MsgData { + return { + msgType: "", + data: new Uint8Array() + }; +} +export const MsgData = { + typeUrl: "/cosmos.base.abci.v1beta1.MsgData", + aminoType: "cosmos-sdk/MsgData", + is(o: any): o is MsgData { + return o && (o.$typeUrl === MsgData.typeUrl || typeof o.msgType === "string" && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + isAmino(o: any): o is MsgDataAmino { + return o && (o.$typeUrl === MsgData.typeUrl || typeof o.msg_type === "string" && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + encode(message: MsgData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.msgType !== "") { + writer.uint32(10).string(message.msgType); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.msgType = reader.string(); + break; + case 2: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgData { + const message = createBaseMsgData(); + message.msgType = object.msgType ?? ""; + message.data = object.data ?? new Uint8Array(); + return message; + }, + fromAmino(object: MsgDataAmino): MsgData { + const message = createBaseMsgData(); + if (object.msg_type !== undefined && object.msg_type !== null) { + message.msgType = object.msg_type; + } + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + return message; + }, + toAmino(message: MsgData): MsgDataAmino { + const obj: any = {}; + obj.msg_type = message.msgType === "" ? undefined : message.msgType; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + return obj; + }, + fromAminoMsg(object: MsgDataAminoMsg): MsgData { + return MsgData.fromAmino(object.value); + }, + toAminoMsg(message: MsgData): MsgDataAminoMsg { + return { + type: "cosmos-sdk/MsgData", + value: MsgData.toAmino(message) + }; + }, + fromProtoMsg(message: MsgDataProtoMsg): MsgData { + return MsgData.decode(message.value); + }, + toProto(message: MsgData): Uint8Array { + return MsgData.encode(message).finish(); + }, + toProtoMsg(message: MsgData): MsgDataProtoMsg { + return { + typeUrl: "/cosmos.base.abci.v1beta1.MsgData", + value: MsgData.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgData.typeUrl, MsgData); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgData.aminoType, MsgData.typeUrl); +function createBaseTxMsgData(): TxMsgData { + return { + data: [], + msgResponses: [] + }; +} +export const TxMsgData = { + typeUrl: "/cosmos.base.abci.v1beta1.TxMsgData", + aminoType: "cosmos-sdk/TxMsgData", + is(o: any): o is TxMsgData { + return o && (o.$typeUrl === TxMsgData.typeUrl || Array.isArray(o.data) && (!o.data.length || MsgData.is(o.data[0])) && Array.isArray(o.msgResponses) && (!o.msgResponses.length || Any.is(o.msgResponses[0]))); + }, + isAmino(o: any): o is TxMsgDataAmino { + return o && (o.$typeUrl === TxMsgData.typeUrl || Array.isArray(o.data) && (!o.data.length || MsgData.isAmino(o.data[0])) && Array.isArray(o.msg_responses) && (!o.msg_responses.length || Any.isAmino(o.msg_responses[0]))); + }, + encode(message: TxMsgData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.data) { + MsgData.encode(v!, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.msgResponses) { + Any.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TxMsgData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxMsgData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.data.push(MsgData.decode(reader, reader.uint32())); + break; + case 2: + message.msgResponses.push(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): TxMsgData { + const message = createBaseTxMsgData(); + message.data = object.data?.map(e => MsgData.fromPartial(e)) || []; + message.msgResponses = object.msgResponses?.map(e => Any.fromPartial(e)) || []; + return message; + }, + fromAmino(object: TxMsgDataAmino): TxMsgData { + const message = createBaseTxMsgData(); + message.data = object.data?.map(e => MsgData.fromAmino(e)) || []; + message.msgResponses = object.msg_responses?.map(e => Any.fromAmino(e)) || []; + return message; + }, + toAmino(message: TxMsgData): TxMsgDataAmino { + const obj: any = {}; + if (message.data) { + obj.data = message.data.map(e => e ? MsgData.toAmino(e) : undefined); + } else { + obj.data = message.data; + } + if (message.msgResponses) { + obj.msg_responses = message.msgResponses.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.msg_responses = message.msgResponses; + } + return obj; + }, + fromAminoMsg(object: TxMsgDataAminoMsg): TxMsgData { + return TxMsgData.fromAmino(object.value); + }, + toAminoMsg(message: TxMsgData): TxMsgDataAminoMsg { + return { + type: "cosmos-sdk/TxMsgData", + value: TxMsgData.toAmino(message) + }; + }, + fromProtoMsg(message: TxMsgDataProtoMsg): TxMsgData { + return TxMsgData.decode(message.value); + }, + toProto(message: TxMsgData): Uint8Array { + return TxMsgData.encode(message).finish(); + }, + toProtoMsg(message: TxMsgData): TxMsgDataProtoMsg { + return { + typeUrl: "/cosmos.base.abci.v1beta1.TxMsgData", + value: TxMsgData.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(TxMsgData.typeUrl, TxMsgData); +GlobalDecoderRegistry.registerAminoProtoMapping(TxMsgData.aminoType, TxMsgData.typeUrl); +function createBaseSearchTxsResult(): SearchTxsResult { + return { + totalCount: BigInt(0), + count: BigInt(0), + pageNumber: BigInt(0), + pageTotal: BigInt(0), + limit: BigInt(0), + txs: [] + }; +} +export const SearchTxsResult = { + typeUrl: "/cosmos.base.abci.v1beta1.SearchTxsResult", + aminoType: "cosmos-sdk/SearchTxsResult", + is(o: any): o is SearchTxsResult { + return o && (o.$typeUrl === SearchTxsResult.typeUrl || typeof o.totalCount === "bigint" && typeof o.count === "bigint" && typeof o.pageNumber === "bigint" && typeof o.pageTotal === "bigint" && typeof o.limit === "bigint" && Array.isArray(o.txs) && (!o.txs.length || TxResponse.is(o.txs[0]))); + }, + isAmino(o: any): o is SearchTxsResultAmino { + return o && (o.$typeUrl === SearchTxsResult.typeUrl || typeof o.total_count === "bigint" && typeof o.count === "bigint" && typeof o.page_number === "bigint" && typeof o.page_total === "bigint" && typeof o.limit === "bigint" && Array.isArray(o.txs) && (!o.txs.length || TxResponse.isAmino(o.txs[0]))); + }, + encode(message: SearchTxsResult, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.totalCount !== BigInt(0)) { + writer.uint32(8).uint64(message.totalCount); + } + if (message.count !== BigInt(0)) { + writer.uint32(16).uint64(message.count); + } + if (message.pageNumber !== BigInt(0)) { + writer.uint32(24).uint64(message.pageNumber); + } + if (message.pageTotal !== BigInt(0)) { + writer.uint32(32).uint64(message.pageTotal); + } + if (message.limit !== BigInt(0)) { + writer.uint32(40).uint64(message.limit); + } + for (const v of message.txs) { + TxResponse.encode(v!, writer.uint32(50).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SearchTxsResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSearchTxsResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.totalCount = reader.uint64(); + break; + case 2: + message.count = reader.uint64(); + break; + case 3: + message.pageNumber = reader.uint64(); + break; + case 4: + message.pageTotal = reader.uint64(); + break; + case 5: + message.limit = reader.uint64(); + break; + case 6: + message.txs.push(TxResponse.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SearchTxsResult { + const message = createBaseSearchTxsResult(); + message.totalCount = object.totalCount !== undefined && object.totalCount !== null ? BigInt(object.totalCount.toString()) : BigInt(0); + message.count = object.count !== undefined && object.count !== null ? BigInt(object.count.toString()) : BigInt(0); + message.pageNumber = object.pageNumber !== undefined && object.pageNumber !== null ? BigInt(object.pageNumber.toString()) : BigInt(0); + message.pageTotal = object.pageTotal !== undefined && object.pageTotal !== null ? BigInt(object.pageTotal.toString()) : BigInt(0); + message.limit = object.limit !== undefined && object.limit !== null ? BigInt(object.limit.toString()) : BigInt(0); + message.txs = object.txs?.map(e => TxResponse.fromPartial(e)) || []; + return message; + }, + fromAmino(object: SearchTxsResultAmino): SearchTxsResult { + const message = createBaseSearchTxsResult(); + if (object.total_count !== undefined && object.total_count !== null) { + message.totalCount = BigInt(object.total_count); + } + if (object.count !== undefined && object.count !== null) { + message.count = BigInt(object.count); + } + if (object.page_number !== undefined && object.page_number !== null) { + message.pageNumber = BigInt(object.page_number); + } + if (object.page_total !== undefined && object.page_total !== null) { + message.pageTotal = BigInt(object.page_total); + } + if (object.limit !== undefined && object.limit !== null) { + message.limit = BigInt(object.limit); + } + message.txs = object.txs?.map(e => TxResponse.fromAmino(e)) || []; + return message; + }, + toAmino(message: SearchTxsResult): SearchTxsResultAmino { + const obj: any = {}; + obj.total_count = message.totalCount !== BigInt(0) ? message.totalCount?.toString() : undefined; + obj.count = message.count !== BigInt(0) ? message.count?.toString() : undefined; + obj.page_number = message.pageNumber !== BigInt(0) ? message.pageNumber?.toString() : undefined; + obj.page_total = message.pageTotal !== BigInt(0) ? message.pageTotal?.toString() : undefined; + obj.limit = message.limit !== BigInt(0) ? message.limit?.toString() : undefined; + if (message.txs) { + obj.txs = message.txs.map(e => e ? TxResponse.toAmino(e) : undefined); + } else { + obj.txs = message.txs; + } + return obj; + }, + fromAminoMsg(object: SearchTxsResultAminoMsg): SearchTxsResult { + return SearchTxsResult.fromAmino(object.value); + }, + toAminoMsg(message: SearchTxsResult): SearchTxsResultAminoMsg { + return { + type: "cosmos-sdk/SearchTxsResult", + value: SearchTxsResult.toAmino(message) + }; + }, + fromProtoMsg(message: SearchTxsResultProtoMsg): SearchTxsResult { + return SearchTxsResult.decode(message.value); + }, + toProto(message: SearchTxsResult): Uint8Array { + return SearchTxsResult.encode(message).finish(); + }, + toProtoMsg(message: SearchTxsResult): SearchTxsResultProtoMsg { + return { + typeUrl: "/cosmos.base.abci.v1beta1.SearchTxsResult", + value: SearchTxsResult.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(SearchTxsResult.typeUrl, SearchTxsResult); +GlobalDecoderRegistry.registerAminoProtoMapping(SearchTxsResult.aminoType, SearchTxsResult.typeUrl); +function createBaseSearchBlocksResult(): SearchBlocksResult { + return { + totalCount: BigInt(0), + count: BigInt(0), + pageNumber: BigInt(0), + pageTotal: BigInt(0), + limit: BigInt(0), + blocks: [] + }; +} +export const SearchBlocksResult = { + typeUrl: "/cosmos.base.abci.v1beta1.SearchBlocksResult", + aminoType: "cosmos-sdk/SearchBlocksResult", + is(o: any): o is SearchBlocksResult { + return o && (o.$typeUrl === SearchBlocksResult.typeUrl || typeof o.totalCount === "bigint" && typeof o.count === "bigint" && typeof o.pageNumber === "bigint" && typeof o.pageTotal === "bigint" && typeof o.limit === "bigint" && Array.isArray(o.blocks) && (!o.blocks.length || Block.is(o.blocks[0]))); + }, + isAmino(o: any): o is SearchBlocksResultAmino { + return o && (o.$typeUrl === SearchBlocksResult.typeUrl || typeof o.total_count === "bigint" && typeof o.count === "bigint" && typeof o.page_number === "bigint" && typeof o.page_total === "bigint" && typeof o.limit === "bigint" && Array.isArray(o.blocks) && (!o.blocks.length || Block.isAmino(o.blocks[0]))); + }, + encode(message: SearchBlocksResult, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.totalCount !== BigInt(0)) { + writer.uint32(8).int64(message.totalCount); + } + if (message.count !== BigInt(0)) { + writer.uint32(16).int64(message.count); + } + if (message.pageNumber !== BigInt(0)) { + writer.uint32(24).int64(message.pageNumber); + } + if (message.pageTotal !== BigInt(0)) { + writer.uint32(32).int64(message.pageTotal); + } + if (message.limit !== BigInt(0)) { + writer.uint32(40).int64(message.limit); + } + for (const v of message.blocks) { + Block.encode(v!, writer.uint32(50).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SearchBlocksResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSearchBlocksResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.totalCount = reader.int64(); + break; + case 2: + message.count = reader.int64(); + break; + case 3: + message.pageNumber = reader.int64(); + break; + case 4: + message.pageTotal = reader.int64(); + break; + case 5: + message.limit = reader.int64(); + break; + case 6: + message.blocks.push(Block.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SearchBlocksResult { + const message = createBaseSearchBlocksResult(); + message.totalCount = object.totalCount !== undefined && object.totalCount !== null ? BigInt(object.totalCount.toString()) : BigInt(0); + message.count = object.count !== undefined && object.count !== null ? BigInt(object.count.toString()) : BigInt(0); + message.pageNumber = object.pageNumber !== undefined && object.pageNumber !== null ? BigInt(object.pageNumber.toString()) : BigInt(0); + message.pageTotal = object.pageTotal !== undefined && object.pageTotal !== null ? BigInt(object.pageTotal.toString()) : BigInt(0); + message.limit = object.limit !== undefined && object.limit !== null ? BigInt(object.limit.toString()) : BigInt(0); + message.blocks = object.blocks?.map(e => Block.fromPartial(e)) || []; + return message; + }, + fromAmino(object: SearchBlocksResultAmino): SearchBlocksResult { + const message = createBaseSearchBlocksResult(); + if (object.total_count !== undefined && object.total_count !== null) { + message.totalCount = BigInt(object.total_count); + } + if (object.count !== undefined && object.count !== null) { + message.count = BigInt(object.count); + } + if (object.page_number !== undefined && object.page_number !== null) { + message.pageNumber = BigInt(object.page_number); + } + if (object.page_total !== undefined && object.page_total !== null) { + message.pageTotal = BigInt(object.page_total); + } + if (object.limit !== undefined && object.limit !== null) { + message.limit = BigInt(object.limit); + } + message.blocks = object.blocks?.map(e => Block.fromAmino(e)) || []; + return message; + }, + toAmino(message: SearchBlocksResult): SearchBlocksResultAmino { + const obj: any = {}; + obj.total_count = message.totalCount !== BigInt(0) ? message.totalCount?.toString() : undefined; + obj.count = message.count !== BigInt(0) ? message.count?.toString() : undefined; + obj.page_number = message.pageNumber !== BigInt(0) ? message.pageNumber?.toString() : undefined; + obj.page_total = message.pageTotal !== BigInt(0) ? message.pageTotal?.toString() : undefined; + obj.limit = message.limit !== BigInt(0) ? message.limit?.toString() : undefined; + if (message.blocks) { + obj.blocks = message.blocks.map(e => e ? Block.toAmino(e) : undefined); + } else { + obj.blocks = message.blocks; + } + return obj; + }, + fromAminoMsg(object: SearchBlocksResultAminoMsg): SearchBlocksResult { + return SearchBlocksResult.fromAmino(object.value); + }, + toAminoMsg(message: SearchBlocksResult): SearchBlocksResultAminoMsg { + return { + type: "cosmos-sdk/SearchBlocksResult", + value: SearchBlocksResult.toAmino(message) + }; + }, + fromProtoMsg(message: SearchBlocksResultProtoMsg): SearchBlocksResult { + return SearchBlocksResult.decode(message.value); + }, + toProto(message: SearchBlocksResult): Uint8Array { + return SearchBlocksResult.encode(message).finish(); + }, + toProtoMsg(message: SearchBlocksResult): SearchBlocksResultProtoMsg { + return { + typeUrl: "/cosmos.base.abci.v1beta1.SearchBlocksResult", + value: SearchBlocksResult.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(SearchBlocksResult.typeUrl, SearchBlocksResult); +GlobalDecoderRegistry.registerAminoProtoMapping(SearchBlocksResult.aminoType, SearchBlocksResult.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/base/query/v1beta1/pagination.ts b/libs/interchain-query/src/cosmos/base/query/v1beta1/pagination.ts new file mode 100644 index 00000000..35272ec2 --- /dev/null +++ b/libs/interchain-query/src/cosmos/base/query/v1beta1/pagination.ts @@ -0,0 +1,361 @@ +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { GlobalDecoderRegistry } from "../../../../registry"; +/** + * PageRequest is to be embedded in gRPC request messages for efficient + * pagination. Ex: + * + * message SomeRequest { + * Foo some_parameter = 1; + * PageRequest pagination = 2; + * } + */ +export interface PageRequest { + /** + * key is a value returned in PageResponse.next_key to begin + * querying the next page most efficiently. Only one of offset or key + * should be set. + */ + key: Uint8Array; + /** + * offset is a numeric offset that can be used when key is unavailable. + * It is less efficient than using key. Only one of offset or key should + * be set. + */ + offset: bigint; + /** + * limit is the total number of results to be returned in the result page. + * If left empty it will default to a value to be set by each app. + */ + limit: bigint; + /** + * count_total is set to true to indicate that the result set should include + * a count of the total number of items available for pagination in UIs. + * count_total is only respected when offset is used. It is ignored when key + * is set. + */ + countTotal: boolean; + /** + * reverse is set to true if results are to be returned in the descending order. + * + * Since: cosmos-sdk 0.43 + */ + reverse: boolean; +} +export interface PageRequestProtoMsg { + typeUrl: "/cosmos.base.query.v1beta1.PageRequest"; + value: Uint8Array; +} +/** + * PageRequest is to be embedded in gRPC request messages for efficient + * pagination. Ex: + * + * message SomeRequest { + * Foo some_parameter = 1; + * PageRequest pagination = 2; + * } + */ +export interface PageRequestAmino { + /** + * key is a value returned in PageResponse.next_key to begin + * querying the next page most efficiently. Only one of offset or key + * should be set. + */ + key: string; + /** + * offset is a numeric offset that can be used when key is unavailable. + * It is less efficient than using key. Only one of offset or key should + * be set. + */ + offset: string; + /** + * limit is the total number of results to be returned in the result page. + * If left empty it will default to a value to be set by each app. + */ + limit: string; + /** + * count_total is set to true to indicate that the result set should include + * a count of the total number of items available for pagination in UIs. + * count_total is only respected when offset is used. It is ignored when key + * is set. + */ + count_total: boolean; + /** + * reverse is set to true if results are to be returned in the descending order. + * + * Since: cosmos-sdk 0.43 + */ + reverse: boolean; +} +export interface PageRequestAminoMsg { + type: "cosmos-sdk/PageRequest"; + value: PageRequestAmino; +} +/** + * PageResponse is to be embedded in gRPC response messages where the + * corresponding request message has used PageRequest. + * + * message SomeResponse { + * repeated Bar results = 1; + * PageResponse page = 2; + * } + */ +export interface PageResponse { + /** + * next_key is the key to be passed to PageRequest.key to + * query the next page most efficiently. It will be empty if + * there are no more results. + */ + nextKey: Uint8Array; + /** + * total is total number of results available if PageRequest.count_total + * was set, its value is undefined otherwise + */ + total: bigint; +} +export interface PageResponseProtoMsg { + typeUrl: "/cosmos.base.query.v1beta1.PageResponse"; + value: Uint8Array; +} +/** + * PageResponse is to be embedded in gRPC response messages where the + * corresponding request message has used PageRequest. + * + * message SomeResponse { + * repeated Bar results = 1; + * PageResponse page = 2; + * } + */ +export interface PageResponseAmino { + /** + * next_key is the key to be passed to PageRequest.key to + * query the next page most efficiently. It will be empty if + * there are no more results. + */ + next_key: string; + /** + * total is total number of results available if PageRequest.count_total + * was set, its value is undefined otherwise + */ + total: string; +} +export interface PageResponseAminoMsg { + type: "cosmos-sdk/PageResponse"; + value: PageResponseAmino; +} +function createBasePageRequest(): PageRequest { + return { + key: new Uint8Array(), + offset: BigInt(0), + limit: BigInt(0), + countTotal: false, + reverse: false + }; +} +export const PageRequest = { + typeUrl: "/cosmos.base.query.v1beta1.PageRequest", + aminoType: "cosmos-sdk/PageRequest", + is(o: any): o is PageRequest { + return o && (o.$typeUrl === PageRequest.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && typeof o.offset === "bigint" && typeof o.limit === "bigint" && typeof o.countTotal === "boolean" && typeof o.reverse === "boolean"); + }, + isAmino(o: any): o is PageRequestAmino { + return o && (o.$typeUrl === PageRequest.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && typeof o.offset === "bigint" && typeof o.limit === "bigint" && typeof o.count_total === "boolean" && typeof o.reverse === "boolean"); + }, + encode(message: PageRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.offset !== BigInt(0)) { + writer.uint32(16).uint64(message.offset); + } + if (message.limit !== BigInt(0)) { + writer.uint32(24).uint64(message.limit); + } + if (message.countTotal === true) { + writer.uint32(32).bool(message.countTotal); + } + if (message.reverse === true) { + writer.uint32(40).bool(message.reverse); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PageRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePageRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + case 2: + message.offset = reader.uint64(); + break; + case 3: + message.limit = reader.uint64(); + break; + case 4: + message.countTotal = reader.bool(); + break; + case 5: + message.reverse = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): PageRequest { + const message = createBasePageRequest(); + message.key = object.key ?? new Uint8Array(); + message.offset = object.offset !== undefined && object.offset !== null ? BigInt(object.offset.toString()) : BigInt(0); + message.limit = object.limit !== undefined && object.limit !== null ? BigInt(object.limit.toString()) : BigInt(0); + message.countTotal = object.countTotal ?? false; + message.reverse = object.reverse ?? false; + return message; + }, + fromAmino(object: PageRequestAmino): PageRequest { + const message = createBasePageRequest(); + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + if (object.offset !== undefined && object.offset !== null) { + message.offset = BigInt(object.offset); + } + if (object.limit !== undefined && object.limit !== null) { + message.limit = BigInt(object.limit); + } + if (object.count_total !== undefined && object.count_total !== null) { + message.countTotal = object.count_total; + } + if (object.reverse !== undefined && object.reverse !== null) { + message.reverse = object.reverse; + } + return message; + }, + toAmino(message: PageRequest): PageRequestAmino { + const obj: any = {}; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + obj.offset = message.offset !== BigInt(0) ? message.offset?.toString() : undefined; + obj.limit = message.limit !== BigInt(0) ? message.limit?.toString() : undefined; + obj.count_total = message.countTotal === false ? undefined : message.countTotal; + obj.reverse = message.reverse === false ? undefined : message.reverse; + return obj; + }, + fromAminoMsg(object: PageRequestAminoMsg): PageRequest { + return PageRequest.fromAmino(object.value); + }, + toAminoMsg(message: PageRequest): PageRequestAminoMsg { + return { + type: "cosmos-sdk/PageRequest", + value: PageRequest.toAmino(message) + }; + }, + fromProtoMsg(message: PageRequestProtoMsg): PageRequest { + return PageRequest.decode(message.value); + }, + toProto(message: PageRequest): Uint8Array { + return PageRequest.encode(message).finish(); + }, + toProtoMsg(message: PageRequest): PageRequestProtoMsg { + return { + typeUrl: "/cosmos.base.query.v1beta1.PageRequest", + value: PageRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(PageRequest.typeUrl, PageRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(PageRequest.aminoType, PageRequest.typeUrl); +function createBasePageResponse(): PageResponse { + return { + nextKey: new Uint8Array(), + total: BigInt(0) + }; +} +export const PageResponse = { + typeUrl: "/cosmos.base.query.v1beta1.PageResponse", + aminoType: "cosmos-sdk/PageResponse", + is(o: any): o is PageResponse { + return o && (o.$typeUrl === PageResponse.typeUrl || (o.nextKey instanceof Uint8Array || typeof o.nextKey === "string") && typeof o.total === "bigint"); + }, + isAmino(o: any): o is PageResponseAmino { + return o && (o.$typeUrl === PageResponse.typeUrl || (o.next_key instanceof Uint8Array || typeof o.next_key === "string") && typeof o.total === "bigint"); + }, + encode(message: PageResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.nextKey.length !== 0) { + writer.uint32(10).bytes(message.nextKey); + } + if (message.total !== BigInt(0)) { + writer.uint32(16).uint64(message.total); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PageResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePageResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.nextKey = reader.bytes(); + break; + case 2: + message.total = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): PageResponse { + const message = createBasePageResponse(); + message.nextKey = object.nextKey ?? new Uint8Array(); + message.total = object.total !== undefined && object.total !== null ? BigInt(object.total.toString()) : BigInt(0); + return message; + }, + fromAmino(object: PageResponseAmino): PageResponse { + const message = createBasePageResponse(); + if (object.next_key !== undefined && object.next_key !== null) { + message.nextKey = bytesFromBase64(object.next_key); + } + if (object.total !== undefined && object.total !== null) { + message.total = BigInt(object.total); + } + return message; + }, + toAmino(message: PageResponse): PageResponseAmino { + const obj: any = {}; + obj.next_key = message.nextKey ? base64FromBytes(message.nextKey) : undefined; + obj.total = message.total !== BigInt(0) ? message.total?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: PageResponseAminoMsg): PageResponse { + return PageResponse.fromAmino(object.value); + }, + toAminoMsg(message: PageResponse): PageResponseAminoMsg { + return { + type: "cosmos-sdk/PageResponse", + value: PageResponse.toAmino(message) + }; + }, + fromProtoMsg(message: PageResponseProtoMsg): PageResponse { + return PageResponse.decode(message.value); + }, + toProto(message: PageResponse): Uint8Array { + return PageResponse.encode(message).finish(); + }, + toProtoMsg(message: PageResponse): PageResponseProtoMsg { + return { + typeUrl: "/cosmos.base.query.v1beta1.PageResponse", + value: PageResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(PageResponse.typeUrl, PageResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(PageResponse.aminoType, PageResponse.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/base/v1beta1/coin.ts b/libs/interchain-query/src/cosmos/base/v1beta1/coin.ts new file mode 100644 index 00000000..155e8009 --- /dev/null +++ b/libs/interchain-query/src/cosmos/base/v1beta1/coin.ts @@ -0,0 +1,439 @@ +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +export interface Coin { + denom: string; + amount: string; +} +export interface CoinProtoMsg { + typeUrl: "/cosmos.base.v1beta1.Coin"; + value: Uint8Array; +} +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +export interface CoinAmino { + denom: string; + amount: string; +} +export interface CoinAminoMsg { + type: "cosmos-sdk/Coin"; + value: CoinAmino; +} +/** + * DecCoin defines a token with a denomination and a decimal amount. + * + * NOTE: The amount field is an Dec which implements the custom method + * signatures required by gogoproto. + */ +export interface DecCoin { + denom: string; + amount: string; +} +export interface DecCoinProtoMsg { + typeUrl: "/cosmos.base.v1beta1.DecCoin"; + value: Uint8Array; +} +/** + * DecCoin defines a token with a denomination and a decimal amount. + * + * NOTE: The amount field is an Dec which implements the custom method + * signatures required by gogoproto. + */ +export interface DecCoinAmino { + denom: string; + amount: string; +} +export interface DecCoinAminoMsg { + type: "cosmos-sdk/DecCoin"; + value: DecCoinAmino; +} +/** + * IntProto defines a Protobuf wrapper around an Int object. + * Deprecated: Prefer to use math.Int directly. It supports binary Marshal and Unmarshal. + */ +export interface IntProto { + int: string; +} +export interface IntProtoProtoMsg { + typeUrl: "/cosmos.base.v1beta1.IntProto"; + value: Uint8Array; +} +/** + * IntProto defines a Protobuf wrapper around an Int object. + * Deprecated: Prefer to use math.Int directly. It supports binary Marshal and Unmarshal. + */ +export interface IntProtoAmino { + int: string; +} +export interface IntProtoAminoMsg { + type: "cosmos-sdk/IntProto"; + value: IntProtoAmino; +} +/** + * DecProto defines a Protobuf wrapper around a Dec object. + * Deprecated: Prefer to use math.LegacyDec directly. It supports binary Marshal and Unmarshal. + */ +export interface DecProto { + dec: string; +} +export interface DecProtoProtoMsg { + typeUrl: "/cosmos.base.v1beta1.DecProto"; + value: Uint8Array; +} +/** + * DecProto defines a Protobuf wrapper around a Dec object. + * Deprecated: Prefer to use math.LegacyDec directly. It supports binary Marshal and Unmarshal. + */ +export interface DecProtoAmino { + dec: string; +} +export interface DecProtoAminoMsg { + type: "cosmos-sdk/DecProto"; + value: DecProtoAmino; +} +function createBaseCoin(): Coin { + return { + denom: "", + amount: "" + }; +} +export const Coin = { + typeUrl: "/cosmos.base.v1beta1.Coin", + aminoType: "cosmos-sdk/Coin", + is(o: any): o is Coin { + return o && (o.$typeUrl === Coin.typeUrl || typeof o.denom === "string" && typeof o.amount === "string"); + }, + isAmino(o: any): o is CoinAmino { + return o && (o.$typeUrl === Coin.typeUrl || typeof o.denom === "string" && typeof o.amount === "string"); + }, + encode(message: Coin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Coin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + case 2: + message.amount = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Coin { + const message = createBaseCoin(); + message.denom = object.denom ?? ""; + message.amount = object.amount ?? ""; + return message; + }, + fromAmino(object: CoinAmino): Coin { + const message = createBaseCoin(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + if (object.amount !== undefined && object.amount !== null) { + message.amount = object.amount; + } + return message; + }, + toAmino(message: Coin): CoinAmino { + const obj: any = {}; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.amount = message.amount ?? ""; + return obj; + }, + fromAminoMsg(object: CoinAminoMsg): Coin { + return Coin.fromAmino(object.value); + }, + toAminoMsg(message: Coin): CoinAminoMsg { + return { + type: "cosmos-sdk/Coin", + value: Coin.toAmino(message) + }; + }, + fromProtoMsg(message: CoinProtoMsg): Coin { + return Coin.decode(message.value); + }, + toProto(message: Coin): Uint8Array { + return Coin.encode(message).finish(); + }, + toProtoMsg(message: Coin): CoinProtoMsg { + return { + typeUrl: "/cosmos.base.v1beta1.Coin", + value: Coin.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Coin.typeUrl, Coin); +GlobalDecoderRegistry.registerAminoProtoMapping(Coin.aminoType, Coin.typeUrl); +function createBaseDecCoin(): DecCoin { + return { + denom: "", + amount: "" + }; +} +export const DecCoin = { + typeUrl: "/cosmos.base.v1beta1.DecCoin", + aminoType: "cosmos-sdk/DecCoin", + is(o: any): o is DecCoin { + return o && (o.$typeUrl === DecCoin.typeUrl || typeof o.denom === "string" && typeof o.amount === "string"); + }, + isAmino(o: any): o is DecCoinAmino { + return o && (o.$typeUrl === DecCoin.typeUrl || typeof o.denom === "string" && typeof o.amount === "string"); + }, + encode(message: DecCoin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.denom !== "") { + writer.uint32(10).string(message.denom); + } + if (message.amount !== "") { + writer.uint32(18).string(message.amount); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DecCoin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecCoin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.denom = reader.string(); + break; + case 2: + message.amount = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): DecCoin { + const message = createBaseDecCoin(); + message.denom = object.denom ?? ""; + message.amount = object.amount ?? ""; + return message; + }, + fromAmino(object: DecCoinAmino): DecCoin { + const message = createBaseDecCoin(); + if (object.denom !== undefined && object.denom !== null) { + message.denom = object.denom; + } + if (object.amount !== undefined && object.amount !== null) { + message.amount = object.amount; + } + return message; + }, + toAmino(message: DecCoin): DecCoinAmino { + const obj: any = {}; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.amount = message.amount === "" ? undefined : message.amount; + return obj; + }, + fromAminoMsg(object: DecCoinAminoMsg): DecCoin { + return DecCoin.fromAmino(object.value); + }, + toAminoMsg(message: DecCoin): DecCoinAminoMsg { + return { + type: "cosmos-sdk/DecCoin", + value: DecCoin.toAmino(message) + }; + }, + fromProtoMsg(message: DecCoinProtoMsg): DecCoin { + return DecCoin.decode(message.value); + }, + toProto(message: DecCoin): Uint8Array { + return DecCoin.encode(message).finish(); + }, + toProtoMsg(message: DecCoin): DecCoinProtoMsg { + return { + typeUrl: "/cosmos.base.v1beta1.DecCoin", + value: DecCoin.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(DecCoin.typeUrl, DecCoin); +GlobalDecoderRegistry.registerAminoProtoMapping(DecCoin.aminoType, DecCoin.typeUrl); +function createBaseIntProto(): IntProto { + return { + int: "" + }; +} +export const IntProto = { + typeUrl: "/cosmos.base.v1beta1.IntProto", + aminoType: "cosmos-sdk/IntProto", + is(o: any): o is IntProto { + return o && (o.$typeUrl === IntProto.typeUrl || typeof o.int === "string"); + }, + isAmino(o: any): o is IntProtoAmino { + return o && (o.$typeUrl === IntProto.typeUrl || typeof o.int === "string"); + }, + encode(message: IntProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.int !== "") { + writer.uint32(10).string(message.int); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): IntProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIntProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.int = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): IntProto { + const message = createBaseIntProto(); + message.int = object.int ?? ""; + return message; + }, + fromAmino(object: IntProtoAmino): IntProto { + const message = createBaseIntProto(); + if (object.int !== undefined && object.int !== null) { + message.int = object.int; + } + return message; + }, + toAmino(message: IntProto): IntProtoAmino { + const obj: any = {}; + obj.int = message.int === "" ? undefined : message.int; + return obj; + }, + fromAminoMsg(object: IntProtoAminoMsg): IntProto { + return IntProto.fromAmino(object.value); + }, + toAminoMsg(message: IntProto): IntProtoAminoMsg { + return { + type: "cosmos-sdk/IntProto", + value: IntProto.toAmino(message) + }; + }, + fromProtoMsg(message: IntProtoProtoMsg): IntProto { + return IntProto.decode(message.value); + }, + toProto(message: IntProto): Uint8Array { + return IntProto.encode(message).finish(); + }, + toProtoMsg(message: IntProto): IntProtoProtoMsg { + return { + typeUrl: "/cosmos.base.v1beta1.IntProto", + value: IntProto.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(IntProto.typeUrl, IntProto); +GlobalDecoderRegistry.registerAminoProtoMapping(IntProto.aminoType, IntProto.typeUrl); +function createBaseDecProto(): DecProto { + return { + dec: "" + }; +} +export const DecProto = { + typeUrl: "/cosmos.base.v1beta1.DecProto", + aminoType: "cosmos-sdk/DecProto", + is(o: any): o is DecProto { + return o && (o.$typeUrl === DecProto.typeUrl || typeof o.dec === "string"); + }, + isAmino(o: any): o is DecProtoAmino { + return o && (o.$typeUrl === DecProto.typeUrl || typeof o.dec === "string"); + }, + encode(message: DecProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.dec !== "") { + writer.uint32(10).string(message.dec); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DecProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.dec = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): DecProto { + const message = createBaseDecProto(); + message.dec = object.dec ?? ""; + return message; + }, + fromAmino(object: DecProtoAmino): DecProto { + const message = createBaseDecProto(); + if (object.dec !== undefined && object.dec !== null) { + message.dec = object.dec; + } + return message; + }, + toAmino(message: DecProto): DecProtoAmino { + const obj: any = {}; + obj.dec = message.dec === "" ? undefined : message.dec; + return obj; + }, + fromAminoMsg(object: DecProtoAminoMsg): DecProto { + return DecProto.fromAmino(object.value); + }, + toAminoMsg(message: DecProto): DecProtoAminoMsg { + return { + type: "cosmos-sdk/DecProto", + value: DecProto.toAmino(message) + }; + }, + fromProtoMsg(message: DecProtoProtoMsg): DecProto { + return DecProto.decode(message.value); + }, + toProto(message: DecProto): Uint8Array { + return DecProto.encode(message).finish(); + }, + toProtoMsg(message: DecProto): DecProtoProtoMsg { + return { + typeUrl: "/cosmos.base.v1beta1.DecProto", + value: DecProto.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(DecProto.typeUrl, DecProto); +GlobalDecoderRegistry.registerAminoProtoMapping(DecProto.aminoType, DecProto.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/crypto/ed25519/keys.ts b/libs/interchain-query/src/cosmos/crypto/ed25519/keys.ts new file mode 100644 index 00000000..6f544d77 --- /dev/null +++ b/libs/interchain-query/src/cosmos/crypto/ed25519/keys.ts @@ -0,0 +1,209 @@ +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; +/** + * PubKey is an ed25519 public key for handling Tendermint keys in SDK. + * It's needed for Any serialization and SDK compatibility. + * It must not be used in a non Tendermint key context because it doesn't implement + * ADR-28. Nevertheless, you will like to use ed25519 in app user level + * then you must create a new proto message and follow ADR-28 for Address construction. + */ +export interface PubKey { + key: Uint8Array; +} +export interface PubKeyProtoMsg { + typeUrl: "/cosmos.crypto.ed25519.PubKey"; + value: Uint8Array; +} +/** + * PubKey is an ed25519 public key for handling Tendermint keys in SDK. + * It's needed for Any serialization and SDK compatibility. + * It must not be used in a non Tendermint key context because it doesn't implement + * ADR-28. Nevertheless, you will like to use ed25519 in app user level + * then you must create a new proto message and follow ADR-28 for Address construction. + */ +export interface PubKeyAmino { + key: string; +} +export interface PubKeyAminoMsg { + type: "tendermint/PubKeyEd25519"; + value: PubKeyAmino; +} +/** + * PrivKey defines a ed25519 private key. + * NOTE: ed25519 keys must not be used in SDK apps except in a tendermint validator context. + */ +export interface PrivKey { + key: Uint8Array; +} +export interface PrivKeyProtoMsg { + typeUrl: "/cosmos.crypto.ed25519.PrivKey"; + value: Uint8Array; +} +/** + * PrivKey defines a ed25519 private key. + * NOTE: ed25519 keys must not be used in SDK apps except in a tendermint validator context. + */ +export interface PrivKeyAmino { + key: string; +} +export interface PrivKeyAminoMsg { + type: "tendermint/PrivKeyEd25519"; + value: PrivKeyAmino; +} +function createBasePubKey(): PubKey { + return { + key: new Uint8Array() + }; +} +export const PubKey = { + typeUrl: "/cosmos.crypto.ed25519.PubKey", + aminoType: "tendermint/PubKeyEd25519", + is(o: any): o is PubKey { + return o && (o.$typeUrl === PubKey.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + isAmino(o: any): o is PubKeyAmino { + return o && (o.$typeUrl === PubKey.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + encode(message: PubKey, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PubKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePubKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): PubKey { + const message = createBasePubKey(); + message.key = object.key ?? new Uint8Array(); + return message; + }, + fromAmino(object: PubKeyAmino): PubKey { + const message = createBasePubKey(); + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + return message; + }, + toAmino(message: PubKey): PubKeyAmino { + const obj: any = {}; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + return obj; + }, + fromAminoMsg(object: PubKeyAminoMsg): PubKey { + return PubKey.fromAmino(object.value); + }, + toAminoMsg(message: PubKey): PubKeyAminoMsg { + return { + type: "tendermint/PubKeyEd25519", + value: PubKey.toAmino(message) + }; + }, + fromProtoMsg(message: PubKeyProtoMsg): PubKey { + return PubKey.decode(message.value); + }, + toProto(message: PubKey): Uint8Array { + return PubKey.encode(message).finish(); + }, + toProtoMsg(message: PubKey): PubKeyProtoMsg { + return { + typeUrl: "/cosmos.crypto.ed25519.PubKey", + value: PubKey.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(PubKey.typeUrl, PubKey); +GlobalDecoderRegistry.registerAminoProtoMapping(PubKey.aminoType, PubKey.typeUrl); +function createBasePrivKey(): PrivKey { + return { + key: new Uint8Array() + }; +} +export const PrivKey = { + typeUrl: "/cosmos.crypto.ed25519.PrivKey", + aminoType: "tendermint/PrivKeyEd25519", + is(o: any): o is PrivKey { + return o && (o.$typeUrl === PrivKey.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + isAmino(o: any): o is PrivKeyAmino { + return o && (o.$typeUrl === PrivKey.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + encode(message: PrivKey, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PrivKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): PrivKey { + const message = createBasePrivKey(); + message.key = object.key ?? new Uint8Array(); + return message; + }, + fromAmino(object: PrivKeyAmino): PrivKey { + const message = createBasePrivKey(); + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + return message; + }, + toAmino(message: PrivKey): PrivKeyAmino { + const obj: any = {}; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + return obj; + }, + fromAminoMsg(object: PrivKeyAminoMsg): PrivKey { + return PrivKey.fromAmino(object.value); + }, + toAminoMsg(message: PrivKey): PrivKeyAminoMsg { + return { + type: "tendermint/PrivKeyEd25519", + value: PrivKey.toAmino(message) + }; + }, + fromProtoMsg(message: PrivKeyProtoMsg): PrivKey { + return PrivKey.decode(message.value); + }, + toProto(message: PrivKey): Uint8Array { + return PrivKey.encode(message).finish(); + }, + toProtoMsg(message: PrivKey): PrivKeyProtoMsg { + return { + typeUrl: "/cosmos.crypto.ed25519.PrivKey", + value: PrivKey.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(PrivKey.typeUrl, PrivKey); +GlobalDecoderRegistry.registerAminoProtoMapping(PrivKey.aminoType, PrivKey.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/crypto/multisig/v1beta1/multisig.ts b/libs/interchain-query/src/cosmos/crypto/multisig/v1beta1/multisig.ts new file mode 100644 index 00000000..1d46639b --- /dev/null +++ b/libs/interchain-query/src/cosmos/crypto/multisig/v1beta1/multisig.ts @@ -0,0 +1,225 @@ +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { GlobalDecoderRegistry } from "../../../../registry"; +/** + * MultiSignature wraps the signatures from a multisig.LegacyAminoPubKey. + * See cosmos.tx.v1betata1.ModeInfo.Multi for how to specify which signers + * signed and with which modes. + */ +export interface MultiSignature { + signatures: Uint8Array[]; +} +export interface MultiSignatureProtoMsg { + typeUrl: "/cosmos.crypto.multisig.v1beta1.MultiSignature"; + value: Uint8Array; +} +/** + * MultiSignature wraps the signatures from a multisig.LegacyAminoPubKey. + * See cosmos.tx.v1betata1.ModeInfo.Multi for how to specify which signers + * signed and with which modes. + */ +export interface MultiSignatureAmino { + signatures: string[]; +} +export interface MultiSignatureAminoMsg { + type: "cosmos-sdk/MultiSignature"; + value: MultiSignatureAmino; +} +/** + * CompactBitArray is an implementation of a space efficient bit array. + * This is used to ensure that the encoded data takes up a minimal amount of + * space after proto encoding. + * This is not thread safe, and is not intended for concurrent usage. + */ +export interface CompactBitArray { + extraBitsStored: number; + elems: Uint8Array; +} +export interface CompactBitArrayProtoMsg { + typeUrl: "/cosmos.crypto.multisig.v1beta1.CompactBitArray"; + value: Uint8Array; +} +/** + * CompactBitArray is an implementation of a space efficient bit array. + * This is used to ensure that the encoded data takes up a minimal amount of + * space after proto encoding. + * This is not thread safe, and is not intended for concurrent usage. + */ +export interface CompactBitArrayAmino { + extra_bits_stored: number; + elems: string; +} +export interface CompactBitArrayAminoMsg { + type: "cosmos-sdk/CompactBitArray"; + value: CompactBitArrayAmino; +} +function createBaseMultiSignature(): MultiSignature { + return { + signatures: [] + }; +} +export const MultiSignature = { + typeUrl: "/cosmos.crypto.multisig.v1beta1.MultiSignature", + aminoType: "cosmos-sdk/MultiSignature", + is(o: any): o is MultiSignature { + return o && (o.$typeUrl === MultiSignature.typeUrl || Array.isArray(o.signatures) && (!o.signatures.length || o.signatures[0] instanceof Uint8Array || typeof o.signatures[0] === "string")); + }, + isAmino(o: any): o is MultiSignatureAmino { + return o && (o.$typeUrl === MultiSignature.typeUrl || Array.isArray(o.signatures) && (!o.signatures.length || o.signatures[0] instanceof Uint8Array || typeof o.signatures[0] === "string")); + }, + encode(message: MultiSignature, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.signatures) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MultiSignature { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMultiSignature(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signatures.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MultiSignature { + const message = createBaseMultiSignature(); + message.signatures = object.signatures?.map(e => e) || []; + return message; + }, + fromAmino(object: MultiSignatureAmino): MultiSignature { + const message = createBaseMultiSignature(); + message.signatures = object.signatures?.map(e => bytesFromBase64(e)) || []; + return message; + }, + toAmino(message: MultiSignature): MultiSignatureAmino { + const obj: any = {}; + if (message.signatures) { + obj.signatures = message.signatures.map(e => base64FromBytes(e)); + } else { + obj.signatures = message.signatures; + } + return obj; + }, + fromAminoMsg(object: MultiSignatureAminoMsg): MultiSignature { + return MultiSignature.fromAmino(object.value); + }, + toAminoMsg(message: MultiSignature): MultiSignatureAminoMsg { + return { + type: "cosmos-sdk/MultiSignature", + value: MultiSignature.toAmino(message) + }; + }, + fromProtoMsg(message: MultiSignatureProtoMsg): MultiSignature { + return MultiSignature.decode(message.value); + }, + toProto(message: MultiSignature): Uint8Array { + return MultiSignature.encode(message).finish(); + }, + toProtoMsg(message: MultiSignature): MultiSignatureProtoMsg { + return { + typeUrl: "/cosmos.crypto.multisig.v1beta1.MultiSignature", + value: MultiSignature.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MultiSignature.typeUrl, MultiSignature); +GlobalDecoderRegistry.registerAminoProtoMapping(MultiSignature.aminoType, MultiSignature.typeUrl); +function createBaseCompactBitArray(): CompactBitArray { + return { + extraBitsStored: 0, + elems: new Uint8Array() + }; +} +export const CompactBitArray = { + typeUrl: "/cosmos.crypto.multisig.v1beta1.CompactBitArray", + aminoType: "cosmos-sdk/CompactBitArray", + is(o: any): o is CompactBitArray { + return o && (o.$typeUrl === CompactBitArray.typeUrl || typeof o.extraBitsStored === "number" && (o.elems instanceof Uint8Array || typeof o.elems === "string")); + }, + isAmino(o: any): o is CompactBitArrayAmino { + return o && (o.$typeUrl === CompactBitArray.typeUrl || typeof o.extra_bits_stored === "number" && (o.elems instanceof Uint8Array || typeof o.elems === "string")); + }, + encode(message: CompactBitArray, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.extraBitsStored !== 0) { + writer.uint32(8).uint32(message.extraBitsStored); + } + if (message.elems.length !== 0) { + writer.uint32(18).bytes(message.elems); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): CompactBitArray { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCompactBitArray(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.extraBitsStored = reader.uint32(); + break; + case 2: + message.elems = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): CompactBitArray { + const message = createBaseCompactBitArray(); + message.extraBitsStored = object.extraBitsStored ?? 0; + message.elems = object.elems ?? new Uint8Array(); + return message; + }, + fromAmino(object: CompactBitArrayAmino): CompactBitArray { + const message = createBaseCompactBitArray(); + if (object.extra_bits_stored !== undefined && object.extra_bits_stored !== null) { + message.extraBitsStored = object.extra_bits_stored; + } + if (object.elems !== undefined && object.elems !== null) { + message.elems = bytesFromBase64(object.elems); + } + return message; + }, + toAmino(message: CompactBitArray): CompactBitArrayAmino { + const obj: any = {}; + obj.extra_bits_stored = message.extraBitsStored === 0 ? undefined : message.extraBitsStored; + obj.elems = message.elems ? base64FromBytes(message.elems) : undefined; + return obj; + }, + fromAminoMsg(object: CompactBitArrayAminoMsg): CompactBitArray { + return CompactBitArray.fromAmino(object.value); + }, + toAminoMsg(message: CompactBitArray): CompactBitArrayAminoMsg { + return { + type: "cosmos-sdk/CompactBitArray", + value: CompactBitArray.toAmino(message) + }; + }, + fromProtoMsg(message: CompactBitArrayProtoMsg): CompactBitArray { + return CompactBitArray.decode(message.value); + }, + toProto(message: CompactBitArray): Uint8Array { + return CompactBitArray.encode(message).finish(); + }, + toProtoMsg(message: CompactBitArray): CompactBitArrayProtoMsg { + return { + typeUrl: "/cosmos.crypto.multisig.v1beta1.CompactBitArray", + value: CompactBitArray.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(CompactBitArray.typeUrl, CompactBitArray); +GlobalDecoderRegistry.registerAminoProtoMapping(CompactBitArray.aminoType, CompactBitArray.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/crypto/secp256k1/keys.ts b/libs/interchain-query/src/cosmos/crypto/secp256k1/keys.ts new file mode 100644 index 00000000..c0fdd0ac --- /dev/null +++ b/libs/interchain-query/src/cosmos/crypto/secp256k1/keys.ts @@ -0,0 +1,203 @@ +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; +/** + * PubKey defines a secp256k1 public key + * Key is the compressed form of the pubkey. The first byte depends is a 0x02 byte + * if the y-coordinate is the lexicographically largest of the two associated with + * the x-coordinate. Otherwise the first byte is a 0x03. + * This prefix is followed with the x-coordinate. + */ +export interface PubKey { + key: Uint8Array; +} +export interface PubKeyProtoMsg { + typeUrl: "/cosmos.crypto.secp256k1.PubKey"; + value: Uint8Array; +} +/** + * PubKey defines a secp256k1 public key + * Key is the compressed form of the pubkey. The first byte depends is a 0x02 byte + * if the y-coordinate is the lexicographically largest of the two associated with + * the x-coordinate. Otherwise the first byte is a 0x03. + * This prefix is followed with the x-coordinate. + */ +export interface PubKeyAmino { + key: string; +} +export interface PubKeyAminoMsg { + type: "tendermint/PubKeySecp256k1"; + value: PubKeyAmino; +} +/** PrivKey defines a secp256k1 private key. */ +export interface PrivKey { + key: Uint8Array; +} +export interface PrivKeyProtoMsg { + typeUrl: "/cosmos.crypto.secp256k1.PrivKey"; + value: Uint8Array; +} +/** PrivKey defines a secp256k1 private key. */ +export interface PrivKeyAmino { + key: string; +} +export interface PrivKeyAminoMsg { + type: "tendermint/PrivKeySecp256k1"; + value: PrivKeyAmino; +} +function createBasePubKey(): PubKey { + return { + key: new Uint8Array() + }; +} +export const PubKey = { + typeUrl: "/cosmos.crypto.secp256k1.PubKey", + aminoType: "tendermint/PubKeySecp256k1", + is(o: any): o is PubKey { + return o && (o.$typeUrl === PubKey.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + isAmino(o: any): o is PubKeyAmino { + return o && (o.$typeUrl === PubKey.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + encode(message: PubKey, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PubKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePubKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): PubKey { + const message = createBasePubKey(); + message.key = object.key ?? new Uint8Array(); + return message; + }, + fromAmino(object: PubKeyAmino): PubKey { + const message = createBasePubKey(); + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + return message; + }, + toAmino(message: PubKey): PubKeyAmino { + const obj: any = {}; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + return obj; + }, + fromAminoMsg(object: PubKeyAminoMsg): PubKey { + return PubKey.fromAmino(object.value); + }, + toAminoMsg(message: PubKey): PubKeyAminoMsg { + return { + type: "tendermint/PubKeySecp256k1", + value: PubKey.toAmino(message) + }; + }, + fromProtoMsg(message: PubKeyProtoMsg): PubKey { + return PubKey.decode(message.value); + }, + toProto(message: PubKey): Uint8Array { + return PubKey.encode(message).finish(); + }, + toProtoMsg(message: PubKey): PubKeyProtoMsg { + return { + typeUrl: "/cosmos.crypto.secp256k1.PubKey", + value: PubKey.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(PubKey.typeUrl, PubKey); +GlobalDecoderRegistry.registerAminoProtoMapping(PubKey.aminoType, PubKey.typeUrl); +function createBasePrivKey(): PrivKey { + return { + key: new Uint8Array() + }; +} +export const PrivKey = { + typeUrl: "/cosmos.crypto.secp256k1.PrivKey", + aminoType: "tendermint/PrivKeySecp256k1", + is(o: any): o is PrivKey { + return o && (o.$typeUrl === PrivKey.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + isAmino(o: any): o is PrivKeyAmino { + return o && (o.$typeUrl === PrivKey.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + encode(message: PrivKey, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PrivKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): PrivKey { + const message = createBasePrivKey(); + message.key = object.key ?? new Uint8Array(); + return message; + }, + fromAmino(object: PrivKeyAmino): PrivKey { + const message = createBasePrivKey(); + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + return message; + }, + toAmino(message: PrivKey): PrivKeyAmino { + const obj: any = {}; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + return obj; + }, + fromAminoMsg(object: PrivKeyAminoMsg): PrivKey { + return PrivKey.fromAmino(object.value); + }, + toAminoMsg(message: PrivKey): PrivKeyAminoMsg { + return { + type: "tendermint/PrivKeySecp256k1", + value: PrivKey.toAmino(message) + }; + }, + fromProtoMsg(message: PrivKeyProtoMsg): PrivKey { + return PrivKey.decode(message.value); + }, + toProto(message: PrivKey): Uint8Array { + return PrivKey.encode(message).finish(); + }, + toProtoMsg(message: PrivKey): PrivKeyProtoMsg { + return { + typeUrl: "/cosmos.crypto.secp256k1.PrivKey", + value: PrivKey.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(PrivKey.typeUrl, PrivKey); +GlobalDecoderRegistry.registerAminoProtoMapping(PrivKey.aminoType, PrivKey.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/crypto/secp256r1/keys.ts b/libs/interchain-query/src/cosmos/crypto/secp256r1/keys.ts new file mode 100644 index 00000000..6b1edf68 --- /dev/null +++ b/libs/interchain-query/src/cosmos/crypto/secp256r1/keys.ts @@ -0,0 +1,201 @@ +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; +/** PubKey defines a secp256r1 ECDSA public key. */ +export interface PubKey { + /** + * Point on secp256r1 curve in a compressed representation as specified in section + * 4.3.6 of ANSI X9.62: https://webstore.ansi.org/standards/ascx9/ansix9621998 + */ + key: Uint8Array; +} +export interface PubKeyProtoMsg { + typeUrl: "/cosmos.crypto.secp256r1.PubKey"; + value: Uint8Array; +} +/** PubKey defines a secp256r1 ECDSA public key. */ +export interface PubKeyAmino { + /** + * Point on secp256r1 curve in a compressed representation as specified in section + * 4.3.6 of ANSI X9.62: https://webstore.ansi.org/standards/ascx9/ansix9621998 + */ + key: string; +} +export interface PubKeyAminoMsg { + type: "cosmos-sdk/PubKey"; + value: PubKeyAmino; +} +/** PrivKey defines a secp256r1 ECDSA private key. */ +export interface PrivKey { + /** secret number serialized using big-endian encoding */ + secret: Uint8Array; +} +export interface PrivKeyProtoMsg { + typeUrl: "/cosmos.crypto.secp256r1.PrivKey"; + value: Uint8Array; +} +/** PrivKey defines a secp256r1 ECDSA private key. */ +export interface PrivKeyAmino { + /** secret number serialized using big-endian encoding */ + secret: string; +} +export interface PrivKeyAminoMsg { + type: "cosmos-sdk/PrivKey"; + value: PrivKeyAmino; +} +function createBasePubKey(): PubKey { + return { + key: new Uint8Array() + }; +} +export const PubKey = { + typeUrl: "/cosmos.crypto.secp256r1.PubKey", + aminoType: "cosmos-sdk/PubKey", + is(o: any): o is PubKey { + return o && (o.$typeUrl === PubKey.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + isAmino(o: any): o is PubKeyAmino { + return o && (o.$typeUrl === PubKey.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + encode(message: PubKey, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PubKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePubKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): PubKey { + const message = createBasePubKey(); + message.key = object.key ?? new Uint8Array(); + return message; + }, + fromAmino(object: PubKeyAmino): PubKey { + const message = createBasePubKey(); + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + return message; + }, + toAmino(message: PubKey): PubKeyAmino { + const obj: any = {}; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + return obj; + }, + fromAminoMsg(object: PubKeyAminoMsg): PubKey { + return PubKey.fromAmino(object.value); + }, + toAminoMsg(message: PubKey): PubKeyAminoMsg { + return { + type: "cosmos-sdk/PubKey", + value: PubKey.toAmino(message) + }; + }, + fromProtoMsg(message: PubKeyProtoMsg): PubKey { + return PubKey.decode(message.value); + }, + toProto(message: PubKey): Uint8Array { + return PubKey.encode(message).finish(); + }, + toProtoMsg(message: PubKey): PubKeyProtoMsg { + return { + typeUrl: "/cosmos.crypto.secp256r1.PubKey", + value: PubKey.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(PubKey.typeUrl, PubKey); +GlobalDecoderRegistry.registerAminoProtoMapping(PubKey.aminoType, PubKey.typeUrl); +function createBasePrivKey(): PrivKey { + return { + secret: new Uint8Array() + }; +} +export const PrivKey = { + typeUrl: "/cosmos.crypto.secp256r1.PrivKey", + aminoType: "cosmos-sdk/PrivKey", + is(o: any): o is PrivKey { + return o && (o.$typeUrl === PrivKey.typeUrl || o.secret instanceof Uint8Array || typeof o.secret === "string"); + }, + isAmino(o: any): o is PrivKeyAmino { + return o && (o.$typeUrl === PrivKey.typeUrl || o.secret instanceof Uint8Array || typeof o.secret === "string"); + }, + encode(message: PrivKey, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.secret.length !== 0) { + writer.uint32(10).bytes(message.secret); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PrivKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePrivKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.secret = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): PrivKey { + const message = createBasePrivKey(); + message.secret = object.secret ?? new Uint8Array(); + return message; + }, + fromAmino(object: PrivKeyAmino): PrivKey { + const message = createBasePrivKey(); + if (object.secret !== undefined && object.secret !== null) { + message.secret = bytesFromBase64(object.secret); + } + return message; + }, + toAmino(message: PrivKey): PrivKeyAmino { + const obj: any = {}; + obj.secret = message.secret ? base64FromBytes(message.secret) : undefined; + return obj; + }, + fromAminoMsg(object: PrivKeyAminoMsg): PrivKey { + return PrivKey.fromAmino(object.value); + }, + toAminoMsg(message: PrivKey): PrivKeyAminoMsg { + return { + type: "cosmos-sdk/PrivKey", + value: PrivKey.toAmino(message) + }; + }, + fromProtoMsg(message: PrivKeyProtoMsg): PrivKey { + return PrivKey.decode(message.value); + }, + toProto(message: PrivKey): Uint8Array { + return PrivKey.encode(message).finish(); + }, + toProtoMsg(message: PrivKey): PrivKeyProtoMsg { + return { + typeUrl: "/cosmos.crypto.secp256r1.PrivKey", + value: PrivKey.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(PrivKey.typeUrl, PrivKey); +GlobalDecoderRegistry.registerAminoProtoMapping(PrivKey.aminoType, PrivKey.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/distribution/v1beta1/distribution.ts b/libs/interchain-query/src/cosmos/distribution/v1beta1/distribution.ts new file mode 100644 index 00000000..fdf747a5 --- /dev/null +++ b/libs/interchain-query/src/cosmos/distribution/v1beta1/distribution.ts @@ -0,0 +1,1494 @@ +import { DecCoin, DecCoinAmino, Coin, CoinAmino } from "../../base/v1beta1/coin"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; +/** Params defines the set of params for the distribution module. */ +export interface Params { + communityTax: string; + /** + * Deprecated: The base_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + */ + /** @deprecated */ + baseProposerReward: string; + /** + * Deprecated: The bonus_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + */ + /** @deprecated */ + bonusProposerReward: string; + withdrawAddrEnabled: boolean; +} +export interface ParamsProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.Params"; + value: Uint8Array; +} +/** Params defines the set of params for the distribution module. */ +export interface ParamsAmino { + community_tax: string; + /** + * Deprecated: The base_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + */ + /** @deprecated */ + base_proposer_reward: string; + /** + * Deprecated: The bonus_proposer_reward field is deprecated and is no longer used + * in the x/distribution module's reward mechanism. + */ + /** @deprecated */ + bonus_proposer_reward: string; + withdraw_addr_enabled: boolean; +} +export interface ParamsAminoMsg { + type: "cosmos-sdk/x/distribution/Params"; + value: ParamsAmino; +} +/** + * ValidatorHistoricalRewards represents historical rewards for a validator. + * Height is implicit within the store key. + * Cumulative reward ratio is the sum from the zeroeth period + * until this period of rewards / tokens, per the spec. + * The reference count indicates the number of objects + * which might need to reference this historical entry at any point. + * ReferenceCount = + * number of outstanding delegations which ended the associated period (and + * might need to read that record) + * + number of slashes which ended the associated period (and might need to + * read that record) + * + one per validator for the zeroeth period, set on initialization + */ +export interface ValidatorHistoricalRewards { + cumulativeRewardRatio: DecCoin[]; + referenceCount: number; +} +export interface ValidatorHistoricalRewardsProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorHistoricalRewards"; + value: Uint8Array; +} +/** + * ValidatorHistoricalRewards represents historical rewards for a validator. + * Height is implicit within the store key. + * Cumulative reward ratio is the sum from the zeroeth period + * until this period of rewards / tokens, per the spec. + * The reference count indicates the number of objects + * which might need to reference this historical entry at any point. + * ReferenceCount = + * number of outstanding delegations which ended the associated period (and + * might need to read that record) + * + number of slashes which ended the associated period (and might need to + * read that record) + * + one per validator for the zeroeth period, set on initialization + */ +export interface ValidatorHistoricalRewardsAmino { + cumulative_reward_ratio: DecCoinAmino[]; + reference_count: number; +} +export interface ValidatorHistoricalRewardsAminoMsg { + type: "cosmos-sdk/ValidatorHistoricalRewards"; + value: ValidatorHistoricalRewardsAmino; +} +/** + * ValidatorCurrentRewards represents current rewards and current + * period for a validator kept as a running counter and incremented + * each block as long as the validator's tokens remain constant. + */ +export interface ValidatorCurrentRewards { + rewards: DecCoin[]; + period: bigint; +} +export interface ValidatorCurrentRewardsProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorCurrentRewards"; + value: Uint8Array; +} +/** + * ValidatorCurrentRewards represents current rewards and current + * period for a validator kept as a running counter and incremented + * each block as long as the validator's tokens remain constant. + */ +export interface ValidatorCurrentRewardsAmino { + rewards: DecCoinAmino[]; + period: string; +} +export interface ValidatorCurrentRewardsAminoMsg { + type: "cosmos-sdk/ValidatorCurrentRewards"; + value: ValidatorCurrentRewardsAmino; +} +/** + * ValidatorAccumulatedCommission represents accumulated commission + * for a validator kept as a running counter, can be withdrawn at any time. + */ +export interface ValidatorAccumulatedCommission { + commission: DecCoin[]; +} +export interface ValidatorAccumulatedCommissionProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorAccumulatedCommission"; + value: Uint8Array; +} +/** + * ValidatorAccumulatedCommission represents accumulated commission + * for a validator kept as a running counter, can be withdrawn at any time. + */ +export interface ValidatorAccumulatedCommissionAmino { + commission: DecCoinAmino[]; +} +export interface ValidatorAccumulatedCommissionAminoMsg { + type: "cosmos-sdk/ValidatorAccumulatedCommission"; + value: ValidatorAccumulatedCommissionAmino; +} +/** + * ValidatorOutstandingRewards represents outstanding (un-withdrawn) rewards + * for a validator inexpensive to track, allows simple sanity checks. + */ +export interface ValidatorOutstandingRewards { + rewards: DecCoin[]; +} +export interface ValidatorOutstandingRewardsProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorOutstandingRewards"; + value: Uint8Array; +} +/** + * ValidatorOutstandingRewards represents outstanding (un-withdrawn) rewards + * for a validator inexpensive to track, allows simple sanity checks. + */ +export interface ValidatorOutstandingRewardsAmino { + rewards: DecCoinAmino[]; +} +export interface ValidatorOutstandingRewardsAminoMsg { + type: "cosmos-sdk/ValidatorOutstandingRewards"; + value: ValidatorOutstandingRewardsAmino; +} +/** + * ValidatorSlashEvent represents a validator slash event. + * Height is implicit within the store key. + * This is needed to calculate appropriate amount of staking tokens + * for delegations which are withdrawn after a slash has occurred. + */ +export interface ValidatorSlashEvent { + validatorPeriod: bigint; + fraction: string; +} +export interface ValidatorSlashEventProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorSlashEvent"; + value: Uint8Array; +} +/** + * ValidatorSlashEvent represents a validator slash event. + * Height is implicit within the store key. + * This is needed to calculate appropriate amount of staking tokens + * for delegations which are withdrawn after a slash has occurred. + */ +export interface ValidatorSlashEventAmino { + validator_period: string; + fraction: string; +} +export interface ValidatorSlashEventAminoMsg { + type: "cosmos-sdk/ValidatorSlashEvent"; + value: ValidatorSlashEventAmino; +} +/** ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. */ +export interface ValidatorSlashEvents { + validatorSlashEvents: ValidatorSlashEvent[]; +} +export interface ValidatorSlashEventsProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorSlashEvents"; + value: Uint8Array; +} +/** ValidatorSlashEvents is a collection of ValidatorSlashEvent messages. */ +export interface ValidatorSlashEventsAmino { + validator_slash_events: ValidatorSlashEventAmino[]; +} +export interface ValidatorSlashEventsAminoMsg { + type: "cosmos-sdk/ValidatorSlashEvents"; + value: ValidatorSlashEventsAmino; +} +/** FeePool is the global fee pool for distribution. */ +export interface FeePool { + communityPool: DecCoin[]; +} +export interface FeePoolProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.FeePool"; + value: Uint8Array; +} +/** FeePool is the global fee pool for distribution. */ +export interface FeePoolAmino { + community_pool: DecCoinAmino[]; +} +export interface FeePoolAminoMsg { + type: "cosmos-sdk/FeePool"; + value: FeePoolAmino; +} +/** + * CommunityPoolSpendProposal details a proposal for use of community funds, + * together with how many coins are proposed to be spent, and to which + * recipient account. + * + * Deprecated: Do not use. As of the Cosmos SDK release v0.47.x, there is no + * longer a need for an explicit CommunityPoolSpendProposal. To spend community + * pool funds, a simple MsgCommunityPoolSpend can be invoked from the x/gov + * module via a v1 governance proposal. + */ +/** @deprecated */ +export interface CommunityPoolSpendProposal { + title: string; + description: string; + recipient: string; + amount: Coin[]; +} +export interface CommunityPoolSpendProposalProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal"; + value: Uint8Array; +} +/** + * CommunityPoolSpendProposal details a proposal for use of community funds, + * together with how many coins are proposed to be spent, and to which + * recipient account. + * + * Deprecated: Do not use. As of the Cosmos SDK release v0.47.x, there is no + * longer a need for an explicit CommunityPoolSpendProposal. To spend community + * pool funds, a simple MsgCommunityPoolSpend can be invoked from the x/gov + * module via a v1 governance proposal. + */ +/** @deprecated */ +export interface CommunityPoolSpendProposalAmino { + title: string; + description: string; + recipient: string; + amount: CoinAmino[]; +} +export interface CommunityPoolSpendProposalAminoMsg { + type: "cosmos-sdk/CommunityPoolSpendProposal"; + value: CommunityPoolSpendProposalAmino; +} +/** + * DelegatorStartingInfo represents the starting info for a delegator reward + * period. It tracks the previous validator period, the delegation's amount of + * staking token, and the creation height (to check later on if any slashes have + * occurred). NOTE: Even though validators are slashed to whole staking tokens, + * the delegators within the validator may be left with less than a full token, + * thus sdk.Dec is used. + */ +export interface DelegatorStartingInfo { + previousPeriod: bigint; + stake: string; + height: bigint; +} +export interface DelegatorStartingInfoProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.DelegatorStartingInfo"; + value: Uint8Array; +} +/** + * DelegatorStartingInfo represents the starting info for a delegator reward + * period. It tracks the previous validator period, the delegation's amount of + * staking token, and the creation height (to check later on if any slashes have + * occurred). NOTE: Even though validators are slashed to whole staking tokens, + * the delegators within the validator may be left with less than a full token, + * thus sdk.Dec is used. + */ +export interface DelegatorStartingInfoAmino { + previous_period: string; + stake: string; + height: string; +} +export interface DelegatorStartingInfoAminoMsg { + type: "cosmos-sdk/DelegatorStartingInfo"; + value: DelegatorStartingInfoAmino; +} +/** + * DelegationDelegatorReward represents the properties + * of a delegator's delegation reward. + */ +export interface DelegationDelegatorReward { + validatorAddress: string; + reward: DecCoin[]; +} +export interface DelegationDelegatorRewardProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.DelegationDelegatorReward"; + value: Uint8Array; +} +/** + * DelegationDelegatorReward represents the properties + * of a delegator's delegation reward. + */ +export interface DelegationDelegatorRewardAmino { + validator_address: string; + reward: DecCoinAmino[]; +} +export interface DelegationDelegatorRewardAminoMsg { + type: "cosmos-sdk/DelegationDelegatorReward"; + value: DelegationDelegatorRewardAmino; +} +/** + * CommunityPoolSpendProposalWithDeposit defines a CommunityPoolSpendProposal + * with a deposit + */ +export interface CommunityPoolSpendProposalWithDeposit { + title: string; + description: string; + recipient: string; + amount: string; + deposit: string; +} +export interface CommunityPoolSpendProposalWithDepositProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit"; + value: Uint8Array; +} +/** + * CommunityPoolSpendProposalWithDeposit defines a CommunityPoolSpendProposal + * with a deposit + */ +export interface CommunityPoolSpendProposalWithDepositAmino { + title: string; + description: string; + recipient: string; + amount: string; + deposit: string; +} +export interface CommunityPoolSpendProposalWithDepositAminoMsg { + type: "cosmos-sdk/CommunityPoolSpendProposalWithDeposit"; + value: CommunityPoolSpendProposalWithDepositAmino; +} +function createBaseParams(): Params { + return { + communityTax: "", + baseProposerReward: "", + bonusProposerReward: "", + withdrawAddrEnabled: false + }; +} +export const Params = { + typeUrl: "/cosmos.distribution.v1beta1.Params", + aminoType: "cosmos-sdk/x/distribution/Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || typeof o.communityTax === "string" && typeof o.baseProposerReward === "string" && typeof o.bonusProposerReward === "string" && typeof o.withdrawAddrEnabled === "boolean"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || typeof o.community_tax === "string" && typeof o.base_proposer_reward === "string" && typeof o.bonus_proposer_reward === "string" && typeof o.withdraw_addr_enabled === "boolean"); + }, + encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.communityTax !== "") { + writer.uint32(10).string(message.communityTax); + } + if (message.baseProposerReward !== "") { + writer.uint32(18).string(message.baseProposerReward); + } + if (message.bonusProposerReward !== "") { + writer.uint32(26).string(message.bonusProposerReward); + } + if (message.withdrawAddrEnabled === true) { + writer.uint32(32).bool(message.withdrawAddrEnabled); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.communityTax = reader.string(); + break; + case 2: + message.baseProposerReward = reader.string(); + break; + case 3: + message.bonusProposerReward = reader.string(); + break; + case 4: + message.withdrawAddrEnabled = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Params { + const message = createBaseParams(); + message.communityTax = object.communityTax ?? ""; + message.baseProposerReward = object.baseProposerReward ?? ""; + message.bonusProposerReward = object.bonusProposerReward ?? ""; + message.withdrawAddrEnabled = object.withdrawAddrEnabled ?? false; + return message; + }, + fromAmino(object: ParamsAmino): Params { + const message = createBaseParams(); + if (object.community_tax !== undefined && object.community_tax !== null) { + message.communityTax = object.community_tax; + } + if (object.base_proposer_reward !== undefined && object.base_proposer_reward !== null) { + message.baseProposerReward = object.base_proposer_reward; + } + if (object.bonus_proposer_reward !== undefined && object.bonus_proposer_reward !== null) { + message.bonusProposerReward = object.bonus_proposer_reward; + } + if (object.withdraw_addr_enabled !== undefined && object.withdraw_addr_enabled !== null) { + message.withdrawAddrEnabled = object.withdraw_addr_enabled; + } + return message; + }, + toAmino(message: Params): ParamsAmino { + const obj: any = {}; + obj.community_tax = message.communityTax ?? ""; + obj.base_proposer_reward = message.baseProposerReward ?? ""; + obj.bonus_proposer_reward = message.bonusProposerReward ?? ""; + obj.withdraw_addr_enabled = message.withdrawAddrEnabled === false ? undefined : message.withdrawAddrEnabled; + return obj; + }, + fromAminoMsg(object: ParamsAminoMsg): Params { + return Params.fromAmino(object.value); + }, + toAminoMsg(message: Params): ParamsAminoMsg { + return { + type: "cosmos-sdk/x/distribution/Params", + value: Params.toAmino(message) + }; + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.Params", + value: Params.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Params.typeUrl, Params); +GlobalDecoderRegistry.registerAminoProtoMapping(Params.aminoType, Params.typeUrl); +function createBaseValidatorHistoricalRewards(): ValidatorHistoricalRewards { + return { + cumulativeRewardRatio: [], + referenceCount: 0 + }; +} +export const ValidatorHistoricalRewards = { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorHistoricalRewards", + aminoType: "cosmos-sdk/ValidatorHistoricalRewards", + is(o: any): o is ValidatorHistoricalRewards { + return o && (o.$typeUrl === ValidatorHistoricalRewards.typeUrl || Array.isArray(o.cumulativeRewardRatio) && (!o.cumulativeRewardRatio.length || DecCoin.is(o.cumulativeRewardRatio[0])) && typeof o.referenceCount === "number"); + }, + isAmino(o: any): o is ValidatorHistoricalRewardsAmino { + return o && (o.$typeUrl === ValidatorHistoricalRewards.typeUrl || Array.isArray(o.cumulative_reward_ratio) && (!o.cumulative_reward_ratio.length || DecCoin.isAmino(o.cumulative_reward_ratio[0])) && typeof o.reference_count === "number"); + }, + encode(message: ValidatorHistoricalRewards, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.cumulativeRewardRatio) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.referenceCount !== 0) { + writer.uint32(16).uint32(message.referenceCount); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorHistoricalRewards { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorHistoricalRewards(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.cumulativeRewardRatio.push(DecCoin.decode(reader, reader.uint32())); + break; + case 2: + message.referenceCount = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ValidatorHistoricalRewards { + const message = createBaseValidatorHistoricalRewards(); + message.cumulativeRewardRatio = object.cumulativeRewardRatio?.map(e => DecCoin.fromPartial(e)) || []; + message.referenceCount = object.referenceCount ?? 0; + return message; + }, + fromAmino(object: ValidatorHistoricalRewardsAmino): ValidatorHistoricalRewards { + const message = createBaseValidatorHistoricalRewards(); + message.cumulativeRewardRatio = object.cumulative_reward_ratio?.map(e => DecCoin.fromAmino(e)) || []; + if (object.reference_count !== undefined && object.reference_count !== null) { + message.referenceCount = object.reference_count; + } + return message; + }, + toAmino(message: ValidatorHistoricalRewards): ValidatorHistoricalRewardsAmino { + const obj: any = {}; + if (message.cumulativeRewardRatio) { + obj.cumulative_reward_ratio = message.cumulativeRewardRatio.map(e => e ? DecCoin.toAmino(e) : undefined); + } else { + obj.cumulative_reward_ratio = message.cumulativeRewardRatio; + } + obj.reference_count = message.referenceCount === 0 ? undefined : message.referenceCount; + return obj; + }, + fromAminoMsg(object: ValidatorHistoricalRewardsAminoMsg): ValidatorHistoricalRewards { + return ValidatorHistoricalRewards.fromAmino(object.value); + }, + toAminoMsg(message: ValidatorHistoricalRewards): ValidatorHistoricalRewardsAminoMsg { + return { + type: "cosmos-sdk/ValidatorHistoricalRewards", + value: ValidatorHistoricalRewards.toAmino(message) + }; + }, + fromProtoMsg(message: ValidatorHistoricalRewardsProtoMsg): ValidatorHistoricalRewards { + return ValidatorHistoricalRewards.decode(message.value); + }, + toProto(message: ValidatorHistoricalRewards): Uint8Array { + return ValidatorHistoricalRewards.encode(message).finish(); + }, + toProtoMsg(message: ValidatorHistoricalRewards): ValidatorHistoricalRewardsProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorHistoricalRewards", + value: ValidatorHistoricalRewards.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ValidatorHistoricalRewards.typeUrl, ValidatorHistoricalRewards); +GlobalDecoderRegistry.registerAminoProtoMapping(ValidatorHistoricalRewards.aminoType, ValidatorHistoricalRewards.typeUrl); +function createBaseValidatorCurrentRewards(): ValidatorCurrentRewards { + return { + rewards: [], + period: BigInt(0) + }; +} +export const ValidatorCurrentRewards = { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorCurrentRewards", + aminoType: "cosmos-sdk/ValidatorCurrentRewards", + is(o: any): o is ValidatorCurrentRewards { + return o && (o.$typeUrl === ValidatorCurrentRewards.typeUrl || Array.isArray(o.rewards) && (!o.rewards.length || DecCoin.is(o.rewards[0])) && typeof o.period === "bigint"); + }, + isAmino(o: any): o is ValidatorCurrentRewardsAmino { + return o && (o.$typeUrl === ValidatorCurrentRewards.typeUrl || Array.isArray(o.rewards) && (!o.rewards.length || DecCoin.isAmino(o.rewards[0])) && typeof o.period === "bigint"); + }, + encode(message: ValidatorCurrentRewards, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.rewards) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.period !== BigInt(0)) { + writer.uint32(16).uint64(message.period); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorCurrentRewards { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorCurrentRewards(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + break; + case 2: + message.period = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ValidatorCurrentRewards { + const message = createBaseValidatorCurrentRewards(); + message.rewards = object.rewards?.map(e => DecCoin.fromPartial(e)) || []; + message.period = object.period !== undefined && object.period !== null ? BigInt(object.period.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ValidatorCurrentRewardsAmino): ValidatorCurrentRewards { + const message = createBaseValidatorCurrentRewards(); + message.rewards = object.rewards?.map(e => DecCoin.fromAmino(e)) || []; + if (object.period !== undefined && object.period !== null) { + message.period = BigInt(object.period); + } + return message; + }, + toAmino(message: ValidatorCurrentRewards): ValidatorCurrentRewardsAmino { + const obj: any = {}; + if (message.rewards) { + obj.rewards = message.rewards.map(e => e ? DecCoin.toAmino(e) : undefined); + } else { + obj.rewards = message.rewards; + } + obj.period = message.period !== BigInt(0) ? message.period?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ValidatorCurrentRewardsAminoMsg): ValidatorCurrentRewards { + return ValidatorCurrentRewards.fromAmino(object.value); + }, + toAminoMsg(message: ValidatorCurrentRewards): ValidatorCurrentRewardsAminoMsg { + return { + type: "cosmos-sdk/ValidatorCurrentRewards", + value: ValidatorCurrentRewards.toAmino(message) + }; + }, + fromProtoMsg(message: ValidatorCurrentRewardsProtoMsg): ValidatorCurrentRewards { + return ValidatorCurrentRewards.decode(message.value); + }, + toProto(message: ValidatorCurrentRewards): Uint8Array { + return ValidatorCurrentRewards.encode(message).finish(); + }, + toProtoMsg(message: ValidatorCurrentRewards): ValidatorCurrentRewardsProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorCurrentRewards", + value: ValidatorCurrentRewards.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ValidatorCurrentRewards.typeUrl, ValidatorCurrentRewards); +GlobalDecoderRegistry.registerAminoProtoMapping(ValidatorCurrentRewards.aminoType, ValidatorCurrentRewards.typeUrl); +function createBaseValidatorAccumulatedCommission(): ValidatorAccumulatedCommission { + return { + commission: [] + }; +} +export const ValidatorAccumulatedCommission = { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorAccumulatedCommission", + aminoType: "cosmos-sdk/ValidatorAccumulatedCommission", + is(o: any): o is ValidatorAccumulatedCommission { + return o && (o.$typeUrl === ValidatorAccumulatedCommission.typeUrl || Array.isArray(o.commission) && (!o.commission.length || DecCoin.is(o.commission[0]))); + }, + isAmino(o: any): o is ValidatorAccumulatedCommissionAmino { + return o && (o.$typeUrl === ValidatorAccumulatedCommission.typeUrl || Array.isArray(o.commission) && (!o.commission.length || DecCoin.isAmino(o.commission[0]))); + }, + encode(message: ValidatorAccumulatedCommission, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.commission) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorAccumulatedCommission { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorAccumulatedCommission(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.commission.push(DecCoin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ValidatorAccumulatedCommission { + const message = createBaseValidatorAccumulatedCommission(); + message.commission = object.commission?.map(e => DecCoin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: ValidatorAccumulatedCommissionAmino): ValidatorAccumulatedCommission { + const message = createBaseValidatorAccumulatedCommission(); + message.commission = object.commission?.map(e => DecCoin.fromAmino(e)) || []; + return message; + }, + toAmino(message: ValidatorAccumulatedCommission): ValidatorAccumulatedCommissionAmino { + const obj: any = {}; + if (message.commission) { + obj.commission = message.commission.map(e => e ? DecCoin.toAmino(e) : undefined); + } else { + obj.commission = message.commission; + } + return obj; + }, + fromAminoMsg(object: ValidatorAccumulatedCommissionAminoMsg): ValidatorAccumulatedCommission { + return ValidatorAccumulatedCommission.fromAmino(object.value); + }, + toAminoMsg(message: ValidatorAccumulatedCommission): ValidatorAccumulatedCommissionAminoMsg { + return { + type: "cosmos-sdk/ValidatorAccumulatedCommission", + value: ValidatorAccumulatedCommission.toAmino(message) + }; + }, + fromProtoMsg(message: ValidatorAccumulatedCommissionProtoMsg): ValidatorAccumulatedCommission { + return ValidatorAccumulatedCommission.decode(message.value); + }, + toProto(message: ValidatorAccumulatedCommission): Uint8Array { + return ValidatorAccumulatedCommission.encode(message).finish(); + }, + toProtoMsg(message: ValidatorAccumulatedCommission): ValidatorAccumulatedCommissionProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorAccumulatedCommission", + value: ValidatorAccumulatedCommission.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ValidatorAccumulatedCommission.typeUrl, ValidatorAccumulatedCommission); +GlobalDecoderRegistry.registerAminoProtoMapping(ValidatorAccumulatedCommission.aminoType, ValidatorAccumulatedCommission.typeUrl); +function createBaseValidatorOutstandingRewards(): ValidatorOutstandingRewards { + return { + rewards: [] + }; +} +export const ValidatorOutstandingRewards = { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorOutstandingRewards", + aminoType: "cosmos-sdk/ValidatorOutstandingRewards", + is(o: any): o is ValidatorOutstandingRewards { + return o && (o.$typeUrl === ValidatorOutstandingRewards.typeUrl || Array.isArray(o.rewards) && (!o.rewards.length || DecCoin.is(o.rewards[0]))); + }, + isAmino(o: any): o is ValidatorOutstandingRewardsAmino { + return o && (o.$typeUrl === ValidatorOutstandingRewards.typeUrl || Array.isArray(o.rewards) && (!o.rewards.length || DecCoin.isAmino(o.rewards[0]))); + }, + encode(message: ValidatorOutstandingRewards, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.rewards) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorOutstandingRewards { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorOutstandingRewards(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.rewards.push(DecCoin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ValidatorOutstandingRewards { + const message = createBaseValidatorOutstandingRewards(); + message.rewards = object.rewards?.map(e => DecCoin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: ValidatorOutstandingRewardsAmino): ValidatorOutstandingRewards { + const message = createBaseValidatorOutstandingRewards(); + message.rewards = object.rewards?.map(e => DecCoin.fromAmino(e)) || []; + return message; + }, + toAmino(message: ValidatorOutstandingRewards): ValidatorOutstandingRewardsAmino { + const obj: any = {}; + if (message.rewards) { + obj.rewards = message.rewards.map(e => e ? DecCoin.toAmino(e) : undefined); + } else { + obj.rewards = message.rewards; + } + return obj; + }, + fromAminoMsg(object: ValidatorOutstandingRewardsAminoMsg): ValidatorOutstandingRewards { + return ValidatorOutstandingRewards.fromAmino(object.value); + }, + toAminoMsg(message: ValidatorOutstandingRewards): ValidatorOutstandingRewardsAminoMsg { + return { + type: "cosmos-sdk/ValidatorOutstandingRewards", + value: ValidatorOutstandingRewards.toAmino(message) + }; + }, + fromProtoMsg(message: ValidatorOutstandingRewardsProtoMsg): ValidatorOutstandingRewards { + return ValidatorOutstandingRewards.decode(message.value); + }, + toProto(message: ValidatorOutstandingRewards): Uint8Array { + return ValidatorOutstandingRewards.encode(message).finish(); + }, + toProtoMsg(message: ValidatorOutstandingRewards): ValidatorOutstandingRewardsProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorOutstandingRewards", + value: ValidatorOutstandingRewards.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ValidatorOutstandingRewards.typeUrl, ValidatorOutstandingRewards); +GlobalDecoderRegistry.registerAminoProtoMapping(ValidatorOutstandingRewards.aminoType, ValidatorOutstandingRewards.typeUrl); +function createBaseValidatorSlashEvent(): ValidatorSlashEvent { + return { + validatorPeriod: BigInt(0), + fraction: "" + }; +} +export const ValidatorSlashEvent = { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorSlashEvent", + aminoType: "cosmos-sdk/ValidatorSlashEvent", + is(o: any): o is ValidatorSlashEvent { + return o && (o.$typeUrl === ValidatorSlashEvent.typeUrl || typeof o.validatorPeriod === "bigint" && typeof o.fraction === "string"); + }, + isAmino(o: any): o is ValidatorSlashEventAmino { + return o && (o.$typeUrl === ValidatorSlashEvent.typeUrl || typeof o.validator_period === "bigint" && typeof o.fraction === "string"); + }, + encode(message: ValidatorSlashEvent, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.validatorPeriod !== BigInt(0)) { + writer.uint32(8).uint64(message.validatorPeriod); + } + if (message.fraction !== "") { + writer.uint32(18).string(message.fraction); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSlashEvent { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSlashEvent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validatorPeriod = reader.uint64(); + break; + case 2: + message.fraction = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ValidatorSlashEvent { + const message = createBaseValidatorSlashEvent(); + message.validatorPeriod = object.validatorPeriod !== undefined && object.validatorPeriod !== null ? BigInt(object.validatorPeriod.toString()) : BigInt(0); + message.fraction = object.fraction ?? ""; + return message; + }, + fromAmino(object: ValidatorSlashEventAmino): ValidatorSlashEvent { + const message = createBaseValidatorSlashEvent(); + if (object.validator_period !== undefined && object.validator_period !== null) { + message.validatorPeriod = BigInt(object.validator_period); + } + if (object.fraction !== undefined && object.fraction !== null) { + message.fraction = object.fraction; + } + return message; + }, + toAmino(message: ValidatorSlashEvent): ValidatorSlashEventAmino { + const obj: any = {}; + obj.validator_period = message.validatorPeriod !== BigInt(0) ? message.validatorPeriod?.toString() : undefined; + obj.fraction = message.fraction === "" ? undefined : message.fraction; + return obj; + }, + fromAminoMsg(object: ValidatorSlashEventAminoMsg): ValidatorSlashEvent { + return ValidatorSlashEvent.fromAmino(object.value); + }, + toAminoMsg(message: ValidatorSlashEvent): ValidatorSlashEventAminoMsg { + return { + type: "cosmos-sdk/ValidatorSlashEvent", + value: ValidatorSlashEvent.toAmino(message) + }; + }, + fromProtoMsg(message: ValidatorSlashEventProtoMsg): ValidatorSlashEvent { + return ValidatorSlashEvent.decode(message.value); + }, + toProto(message: ValidatorSlashEvent): Uint8Array { + return ValidatorSlashEvent.encode(message).finish(); + }, + toProtoMsg(message: ValidatorSlashEvent): ValidatorSlashEventProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorSlashEvent", + value: ValidatorSlashEvent.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ValidatorSlashEvent.typeUrl, ValidatorSlashEvent); +GlobalDecoderRegistry.registerAminoProtoMapping(ValidatorSlashEvent.aminoType, ValidatorSlashEvent.typeUrl); +function createBaseValidatorSlashEvents(): ValidatorSlashEvents { + return { + validatorSlashEvents: [] + }; +} +export const ValidatorSlashEvents = { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorSlashEvents", + aminoType: "cosmos-sdk/ValidatorSlashEvents", + is(o: any): o is ValidatorSlashEvents { + return o && (o.$typeUrl === ValidatorSlashEvents.typeUrl || Array.isArray(o.validatorSlashEvents) && (!o.validatorSlashEvents.length || ValidatorSlashEvent.is(o.validatorSlashEvents[0]))); + }, + isAmino(o: any): o is ValidatorSlashEventsAmino { + return o && (o.$typeUrl === ValidatorSlashEvents.typeUrl || Array.isArray(o.validator_slash_events) && (!o.validator_slash_events.length || ValidatorSlashEvent.isAmino(o.validator_slash_events[0]))); + }, + encode(message: ValidatorSlashEvents, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.validatorSlashEvents) { + ValidatorSlashEvent.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSlashEvents { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSlashEvents(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validatorSlashEvents.push(ValidatorSlashEvent.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ValidatorSlashEvents { + const message = createBaseValidatorSlashEvents(); + message.validatorSlashEvents = object.validatorSlashEvents?.map(e => ValidatorSlashEvent.fromPartial(e)) || []; + return message; + }, + fromAmino(object: ValidatorSlashEventsAmino): ValidatorSlashEvents { + const message = createBaseValidatorSlashEvents(); + message.validatorSlashEvents = object.validator_slash_events?.map(e => ValidatorSlashEvent.fromAmino(e)) || []; + return message; + }, + toAmino(message: ValidatorSlashEvents): ValidatorSlashEventsAmino { + const obj: any = {}; + if (message.validatorSlashEvents) { + obj.validator_slash_events = message.validatorSlashEvents.map(e => e ? ValidatorSlashEvent.toAmino(e) : undefined); + } else { + obj.validator_slash_events = message.validatorSlashEvents; + } + return obj; + }, + fromAminoMsg(object: ValidatorSlashEventsAminoMsg): ValidatorSlashEvents { + return ValidatorSlashEvents.fromAmino(object.value); + }, + toAminoMsg(message: ValidatorSlashEvents): ValidatorSlashEventsAminoMsg { + return { + type: "cosmos-sdk/ValidatorSlashEvents", + value: ValidatorSlashEvents.toAmino(message) + }; + }, + fromProtoMsg(message: ValidatorSlashEventsProtoMsg): ValidatorSlashEvents { + return ValidatorSlashEvents.decode(message.value); + }, + toProto(message: ValidatorSlashEvents): Uint8Array { + return ValidatorSlashEvents.encode(message).finish(); + }, + toProtoMsg(message: ValidatorSlashEvents): ValidatorSlashEventsProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.ValidatorSlashEvents", + value: ValidatorSlashEvents.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ValidatorSlashEvents.typeUrl, ValidatorSlashEvents); +GlobalDecoderRegistry.registerAminoProtoMapping(ValidatorSlashEvents.aminoType, ValidatorSlashEvents.typeUrl); +function createBaseFeePool(): FeePool { + return { + communityPool: [] + }; +} +export const FeePool = { + typeUrl: "/cosmos.distribution.v1beta1.FeePool", + aminoType: "cosmos-sdk/FeePool", + is(o: any): o is FeePool { + return o && (o.$typeUrl === FeePool.typeUrl || Array.isArray(o.communityPool) && (!o.communityPool.length || DecCoin.is(o.communityPool[0]))); + }, + isAmino(o: any): o is FeePoolAmino { + return o && (o.$typeUrl === FeePool.typeUrl || Array.isArray(o.community_pool) && (!o.community_pool.length || DecCoin.isAmino(o.community_pool[0]))); + }, + encode(message: FeePool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.communityPool) { + DecCoin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): FeePool { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeePool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.communityPool.push(DecCoin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): FeePool { + const message = createBaseFeePool(); + message.communityPool = object.communityPool?.map(e => DecCoin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: FeePoolAmino): FeePool { + const message = createBaseFeePool(); + message.communityPool = object.community_pool?.map(e => DecCoin.fromAmino(e)) || []; + return message; + }, + toAmino(message: FeePool): FeePoolAmino { + const obj: any = {}; + if (message.communityPool) { + obj.community_pool = message.communityPool.map(e => e ? DecCoin.toAmino(e) : undefined); + } else { + obj.community_pool = message.communityPool; + } + return obj; + }, + fromAminoMsg(object: FeePoolAminoMsg): FeePool { + return FeePool.fromAmino(object.value); + }, + toAminoMsg(message: FeePool): FeePoolAminoMsg { + return { + type: "cosmos-sdk/FeePool", + value: FeePool.toAmino(message) + }; + }, + fromProtoMsg(message: FeePoolProtoMsg): FeePool { + return FeePool.decode(message.value); + }, + toProto(message: FeePool): Uint8Array { + return FeePool.encode(message).finish(); + }, + toProtoMsg(message: FeePool): FeePoolProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.FeePool", + value: FeePool.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(FeePool.typeUrl, FeePool); +GlobalDecoderRegistry.registerAminoProtoMapping(FeePool.aminoType, FeePool.typeUrl); +function createBaseCommunityPoolSpendProposal(): CommunityPoolSpendProposal { + return { + title: "", + description: "", + recipient: "", + amount: [] + }; +} +export const CommunityPoolSpendProposal = { + typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal", + aminoType: "cosmos-sdk/CommunityPoolSpendProposal", + is(o: any): o is CommunityPoolSpendProposal { + return o && (o.$typeUrl === CommunityPoolSpendProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.recipient === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0]))); + }, + isAmino(o: any): o is CommunityPoolSpendProposalAmino { + return o && (o.$typeUrl === CommunityPoolSpendProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.recipient === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0]))); + }, + encode(message: CommunityPoolSpendProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.recipient !== "") { + writer.uint32(26).string(message.recipient); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): CommunityPoolSpendProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommunityPoolSpendProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + case 3: + message.recipient = reader.string(); + break; + case 4: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): CommunityPoolSpendProposal { + const message = createBaseCommunityPoolSpendProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.recipient = object.recipient ?? ""; + message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: CommunityPoolSpendProposalAmino): CommunityPoolSpendProposal { + const message = createBaseCommunityPoolSpendProposal(); + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + if (object.recipient !== undefined && object.recipient !== null) { + message.recipient = object.recipient; + } + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: CommunityPoolSpendProposal): CommunityPoolSpendProposalAmino { + const obj: any = {}; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.recipient = message.recipient === "" ? undefined : message.recipient; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = message.amount; + } + return obj; + }, + fromAminoMsg(object: CommunityPoolSpendProposalAminoMsg): CommunityPoolSpendProposal { + return CommunityPoolSpendProposal.fromAmino(object.value); + }, + toAminoMsg(message: CommunityPoolSpendProposal): CommunityPoolSpendProposalAminoMsg { + return { + type: "cosmos-sdk/CommunityPoolSpendProposal", + value: CommunityPoolSpendProposal.toAmino(message) + }; + }, + fromProtoMsg(message: CommunityPoolSpendProposalProtoMsg): CommunityPoolSpendProposal { + return CommunityPoolSpendProposal.decode(message.value); + }, + toProto(message: CommunityPoolSpendProposal): Uint8Array { + return CommunityPoolSpendProposal.encode(message).finish(); + }, + toProtoMsg(message: CommunityPoolSpendProposal): CommunityPoolSpendProposalProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposal", + value: CommunityPoolSpendProposal.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(CommunityPoolSpendProposal.typeUrl, CommunityPoolSpendProposal); +GlobalDecoderRegistry.registerAminoProtoMapping(CommunityPoolSpendProposal.aminoType, CommunityPoolSpendProposal.typeUrl); +function createBaseDelegatorStartingInfo(): DelegatorStartingInfo { + return { + previousPeriod: BigInt(0), + stake: "", + height: BigInt(0) + }; +} +export const DelegatorStartingInfo = { + typeUrl: "/cosmos.distribution.v1beta1.DelegatorStartingInfo", + aminoType: "cosmos-sdk/DelegatorStartingInfo", + is(o: any): o is DelegatorStartingInfo { + return o && (o.$typeUrl === DelegatorStartingInfo.typeUrl || typeof o.previousPeriod === "bigint" && typeof o.stake === "string" && typeof o.height === "bigint"); + }, + isAmino(o: any): o is DelegatorStartingInfoAmino { + return o && (o.$typeUrl === DelegatorStartingInfo.typeUrl || typeof o.previous_period === "bigint" && typeof o.stake === "string" && typeof o.height === "bigint"); + }, + encode(message: DelegatorStartingInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.previousPeriod !== BigInt(0)) { + writer.uint32(8).uint64(message.previousPeriod); + } + if (message.stake !== "") { + writer.uint32(18).string(message.stake); + } + if (message.height !== BigInt(0)) { + writer.uint32(24).uint64(message.height); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DelegatorStartingInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegatorStartingInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.previousPeriod = reader.uint64(); + break; + case 2: + message.stake = reader.string(); + break; + case 3: + message.height = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): DelegatorStartingInfo { + const message = createBaseDelegatorStartingInfo(); + message.previousPeriod = object.previousPeriod !== undefined && object.previousPeriod !== null ? BigInt(object.previousPeriod.toString()) : BigInt(0); + message.stake = object.stake ?? ""; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + return message; + }, + fromAmino(object: DelegatorStartingInfoAmino): DelegatorStartingInfo { + const message = createBaseDelegatorStartingInfo(); + if (object.previous_period !== undefined && object.previous_period !== null) { + message.previousPeriod = BigInt(object.previous_period); + } + if (object.stake !== undefined && object.stake !== null) { + message.stake = object.stake; + } + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + return message; + }, + toAmino(message: DelegatorStartingInfo): DelegatorStartingInfoAmino { + const obj: any = {}; + obj.previous_period = message.previousPeriod !== BigInt(0) ? message.previousPeriod?.toString() : undefined; + obj.stake = message.stake ?? ""; + obj.height = message.height ? message.height?.toString() : "0"; + return obj; + }, + fromAminoMsg(object: DelegatorStartingInfoAminoMsg): DelegatorStartingInfo { + return DelegatorStartingInfo.fromAmino(object.value); + }, + toAminoMsg(message: DelegatorStartingInfo): DelegatorStartingInfoAminoMsg { + return { + type: "cosmos-sdk/DelegatorStartingInfo", + value: DelegatorStartingInfo.toAmino(message) + }; + }, + fromProtoMsg(message: DelegatorStartingInfoProtoMsg): DelegatorStartingInfo { + return DelegatorStartingInfo.decode(message.value); + }, + toProto(message: DelegatorStartingInfo): Uint8Array { + return DelegatorStartingInfo.encode(message).finish(); + }, + toProtoMsg(message: DelegatorStartingInfo): DelegatorStartingInfoProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.DelegatorStartingInfo", + value: DelegatorStartingInfo.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(DelegatorStartingInfo.typeUrl, DelegatorStartingInfo); +GlobalDecoderRegistry.registerAminoProtoMapping(DelegatorStartingInfo.aminoType, DelegatorStartingInfo.typeUrl); +function createBaseDelegationDelegatorReward(): DelegationDelegatorReward { + return { + validatorAddress: "", + reward: [] + }; +} +export const DelegationDelegatorReward = { + typeUrl: "/cosmos.distribution.v1beta1.DelegationDelegatorReward", + aminoType: "cosmos-sdk/DelegationDelegatorReward", + is(o: any): o is DelegationDelegatorReward { + return o && (o.$typeUrl === DelegationDelegatorReward.typeUrl || typeof o.validatorAddress === "string" && Array.isArray(o.reward) && (!o.reward.length || DecCoin.is(o.reward[0]))); + }, + isAmino(o: any): o is DelegationDelegatorRewardAmino { + return o && (o.$typeUrl === DelegationDelegatorReward.typeUrl || typeof o.validator_address === "string" && Array.isArray(o.reward) && (!o.reward.length || DecCoin.isAmino(o.reward[0]))); + }, + encode(message: DelegationDelegatorReward, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + for (const v of message.reward) { + DecCoin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DelegationDelegatorReward { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegationDelegatorReward(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validatorAddress = reader.string(); + break; + case 2: + message.reward.push(DecCoin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): DelegationDelegatorReward { + const message = createBaseDelegationDelegatorReward(); + message.validatorAddress = object.validatorAddress ?? ""; + message.reward = object.reward?.map(e => DecCoin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: DelegationDelegatorRewardAmino): DelegationDelegatorReward { + const message = createBaseDelegationDelegatorReward(); + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + message.reward = object.reward?.map(e => DecCoin.fromAmino(e)) || []; + return message; + }, + toAmino(message: DelegationDelegatorReward): DelegationDelegatorRewardAmino { + const obj: any = {}; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + if (message.reward) { + obj.reward = message.reward.map(e => e ? DecCoin.toAmino(e) : undefined); + } else { + obj.reward = message.reward; + } + return obj; + }, + fromAminoMsg(object: DelegationDelegatorRewardAminoMsg): DelegationDelegatorReward { + return DelegationDelegatorReward.fromAmino(object.value); + }, + toAminoMsg(message: DelegationDelegatorReward): DelegationDelegatorRewardAminoMsg { + return { + type: "cosmos-sdk/DelegationDelegatorReward", + value: DelegationDelegatorReward.toAmino(message) + }; + }, + fromProtoMsg(message: DelegationDelegatorRewardProtoMsg): DelegationDelegatorReward { + return DelegationDelegatorReward.decode(message.value); + }, + toProto(message: DelegationDelegatorReward): Uint8Array { + return DelegationDelegatorReward.encode(message).finish(); + }, + toProtoMsg(message: DelegationDelegatorReward): DelegationDelegatorRewardProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.DelegationDelegatorReward", + value: DelegationDelegatorReward.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(DelegationDelegatorReward.typeUrl, DelegationDelegatorReward); +GlobalDecoderRegistry.registerAminoProtoMapping(DelegationDelegatorReward.aminoType, DelegationDelegatorReward.typeUrl); +function createBaseCommunityPoolSpendProposalWithDeposit(): CommunityPoolSpendProposalWithDeposit { + return { + title: "", + description: "", + recipient: "", + amount: "", + deposit: "" + }; +} +export const CommunityPoolSpendProposalWithDeposit = { + typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit", + aminoType: "cosmos-sdk/CommunityPoolSpendProposalWithDeposit", + is(o: any): o is CommunityPoolSpendProposalWithDeposit { + return o && (o.$typeUrl === CommunityPoolSpendProposalWithDeposit.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.recipient === "string" && typeof o.amount === "string" && typeof o.deposit === "string"); + }, + isAmino(o: any): o is CommunityPoolSpendProposalWithDepositAmino { + return o && (o.$typeUrl === CommunityPoolSpendProposalWithDeposit.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.recipient === "string" && typeof o.amount === "string" && typeof o.deposit === "string"); + }, + encode(message: CommunityPoolSpendProposalWithDeposit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.recipient !== "") { + writer.uint32(26).string(message.recipient); + } + if (message.amount !== "") { + writer.uint32(34).string(message.amount); + } + if (message.deposit !== "") { + writer.uint32(42).string(message.deposit); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): CommunityPoolSpendProposalWithDeposit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommunityPoolSpendProposalWithDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + case 3: + message.recipient = reader.string(); + break; + case 4: + message.amount = reader.string(); + break; + case 5: + message.deposit = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): CommunityPoolSpendProposalWithDeposit { + const message = createBaseCommunityPoolSpendProposalWithDeposit(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.recipient = object.recipient ?? ""; + message.amount = object.amount ?? ""; + message.deposit = object.deposit ?? ""; + return message; + }, + fromAmino(object: CommunityPoolSpendProposalWithDepositAmino): CommunityPoolSpendProposalWithDeposit { + const message = createBaseCommunityPoolSpendProposalWithDeposit(); + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + if (object.recipient !== undefined && object.recipient !== null) { + message.recipient = object.recipient; + } + if (object.amount !== undefined && object.amount !== null) { + message.amount = object.amount; + } + if (object.deposit !== undefined && object.deposit !== null) { + message.deposit = object.deposit; + } + return message; + }, + toAmino(message: CommunityPoolSpendProposalWithDeposit): CommunityPoolSpendProposalWithDepositAmino { + const obj: any = {}; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.recipient = message.recipient === "" ? undefined : message.recipient; + obj.amount = message.amount === "" ? undefined : message.amount; + obj.deposit = message.deposit === "" ? undefined : message.deposit; + return obj; + }, + fromAminoMsg(object: CommunityPoolSpendProposalWithDepositAminoMsg): CommunityPoolSpendProposalWithDeposit { + return CommunityPoolSpendProposalWithDeposit.fromAmino(object.value); + }, + toAminoMsg(message: CommunityPoolSpendProposalWithDeposit): CommunityPoolSpendProposalWithDepositAminoMsg { + return { + type: "cosmos-sdk/CommunityPoolSpendProposalWithDeposit", + value: CommunityPoolSpendProposalWithDeposit.toAmino(message) + }; + }, + fromProtoMsg(message: CommunityPoolSpendProposalWithDepositProtoMsg): CommunityPoolSpendProposalWithDeposit { + return CommunityPoolSpendProposalWithDeposit.decode(message.value); + }, + toProto(message: CommunityPoolSpendProposalWithDeposit): Uint8Array { + return CommunityPoolSpendProposalWithDeposit.encode(message).finish(); + }, + toProtoMsg(message: CommunityPoolSpendProposalWithDeposit): CommunityPoolSpendProposalWithDepositProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.CommunityPoolSpendProposalWithDeposit", + value: CommunityPoolSpendProposalWithDeposit.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(CommunityPoolSpendProposalWithDeposit.typeUrl, CommunityPoolSpendProposalWithDeposit); +GlobalDecoderRegistry.registerAminoProtoMapping(CommunityPoolSpendProposalWithDeposit.aminoType, CommunityPoolSpendProposalWithDeposit.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/distribution/v1beta1/tx.rpc.func.ts b/libs/interchain-query/src/cosmos/distribution/v1beta1/tx.rpc.func.ts new file mode 100644 index 00000000..79204615 --- /dev/null +++ b/libs/interchain-query/src/cosmos/distribution/v1beta1/tx.rpc.func.ts @@ -0,0 +1,67 @@ +import { buildTx, SigningClientResolver } from "../../../helper-func-types"; +import { buildUseMutation } from "../../../react-query"; +import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; +import { MsgSetWithdrawAddress, MsgWithdrawDelegatorReward, MsgWithdrawValidatorCommission, MsgFundCommunityPool, MsgUpdateParams, MsgCommunityPoolSpend, MsgDepositValidatorRewardsPool } from "./tx"; +export const createSetWithdrawAddress = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgSetWithdrawAddress.typeUrl, + encoders: toEncoders(MsgSetWithdrawAddress), + converters: toConverters(MsgSetWithdrawAddress) +}); +export const useSetWithdrawAddress = buildUseMutation({ + builderMutationFn: createSetWithdrawAddress +}); +export const createWithdrawDelegatorReward = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgWithdrawDelegatorReward.typeUrl, + encoders: toEncoders(MsgWithdrawDelegatorReward), + converters: toConverters(MsgWithdrawDelegatorReward) +}); +export const useWithdrawDelegatorReward = buildUseMutation({ + builderMutationFn: createWithdrawDelegatorReward +}); +export const createWithdrawValidatorCommission = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgWithdrawValidatorCommission.typeUrl, + encoders: toEncoders(MsgWithdrawValidatorCommission), + converters: toConverters(MsgWithdrawValidatorCommission) +}); +export const useWithdrawValidatorCommission = buildUseMutation({ + builderMutationFn: createWithdrawValidatorCommission +}); +export const createFundCommunityPool = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgFundCommunityPool.typeUrl, + encoders: toEncoders(MsgFundCommunityPool), + converters: toConverters(MsgFundCommunityPool) +}); +export const useFundCommunityPool = buildUseMutation({ + builderMutationFn: createFundCommunityPool +}); +export const createUpdateParams = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgUpdateParams.typeUrl, + encoders: toEncoders(MsgUpdateParams), + converters: toConverters(MsgUpdateParams) +}); +export const useUpdateParams = buildUseMutation({ + builderMutationFn: createUpdateParams +}); +export const createCommunityPoolSpend = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgCommunityPoolSpend.typeUrl, + encoders: toEncoders(MsgCommunityPoolSpend), + converters: toConverters(MsgCommunityPoolSpend) +}); +export const useCommunityPoolSpend = buildUseMutation({ + builderMutationFn: createCommunityPoolSpend +}); +export const createDepositValidatorRewardsPool = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgDepositValidatorRewardsPool.typeUrl, + encoders: toEncoders(MsgDepositValidatorRewardsPool), + converters: toConverters(MsgDepositValidatorRewardsPool) +}); +export const useDepositValidatorRewardsPool = buildUseMutation({ + builderMutationFn: createDepositValidatorRewardsPool +}); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/distribution/v1beta1/tx.ts b/libs/interchain-query/src/cosmos/distribution/v1beta1/tx.ts new file mode 100644 index 00000000..64517d0b --- /dev/null +++ b/libs/interchain-query/src/cosmos/distribution/v1beta1/tx.ts @@ -0,0 +1,1478 @@ +import { Coin, CoinAmino } from "../../base/v1beta1/coin"; +import { Params, ParamsAmino } from "./distribution"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; +/** + * MsgSetWithdrawAddress sets the withdraw address for + * a delegator (or validator self-delegation). + */ +export interface MsgSetWithdrawAddress { + delegatorAddress: string; + withdrawAddress: string; +} +export interface MsgSetWithdrawAddressProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress"; + value: Uint8Array; +} +/** + * MsgSetWithdrawAddress sets the withdraw address for + * a delegator (or validator self-delegation). + */ +export interface MsgSetWithdrawAddressAmino { + delegator_address: string; + withdraw_address: string; +} +export interface MsgSetWithdrawAddressAminoMsg { + type: "cosmos-sdk/MsgModifyWithdrawAddress"; + value: MsgSetWithdrawAddressAmino; +} +/** + * MsgSetWithdrawAddressResponse defines the Msg/SetWithdrawAddress response + * type. + */ +export interface MsgSetWithdrawAddressResponse {} +export interface MsgSetWithdrawAddressResponseProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse"; + value: Uint8Array; +} +/** + * MsgSetWithdrawAddressResponse defines the Msg/SetWithdrawAddress response + * type. + */ +export interface MsgSetWithdrawAddressResponseAmino {} +export interface MsgSetWithdrawAddressResponseAminoMsg { + type: "cosmos-sdk/MsgSetWithdrawAddressResponse"; + value: MsgSetWithdrawAddressResponseAmino; +} +/** + * MsgWithdrawDelegatorReward represents delegation withdrawal to a delegator + * from a single validator. + */ +export interface MsgWithdrawDelegatorReward { + delegatorAddress: string; + validatorAddress: string; +} +export interface MsgWithdrawDelegatorRewardProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward"; + value: Uint8Array; +} +/** + * MsgWithdrawDelegatorReward represents delegation withdrawal to a delegator + * from a single validator. + */ +export interface MsgWithdrawDelegatorRewardAmino { + delegator_address: string; + validator_address: string; +} +export interface MsgWithdrawDelegatorRewardAminoMsg { + type: "cosmos-sdk/MsgWithdrawDelegationReward"; + value: MsgWithdrawDelegatorRewardAmino; +} +/** + * MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward + * response type. + */ +export interface MsgWithdrawDelegatorRewardResponse { + /** Since: cosmos-sdk 0.46 */ + amount: Coin[]; +} +export interface MsgWithdrawDelegatorRewardResponseProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse"; + value: Uint8Array; +} +/** + * MsgWithdrawDelegatorRewardResponse defines the Msg/WithdrawDelegatorReward + * response type. + */ +export interface MsgWithdrawDelegatorRewardResponseAmino { + /** Since: cosmos-sdk 0.46 */ + amount: CoinAmino[]; +} +export interface MsgWithdrawDelegatorRewardResponseAminoMsg { + type: "cosmos-sdk/MsgWithdrawDelegatorRewardResponse"; + value: MsgWithdrawDelegatorRewardResponseAmino; +} +/** + * MsgWithdrawValidatorCommission withdraws the full commission to the validator + * address. + */ +export interface MsgWithdrawValidatorCommission { + validatorAddress: string; +} +export interface MsgWithdrawValidatorCommissionProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission"; + value: Uint8Array; +} +/** + * MsgWithdrawValidatorCommission withdraws the full commission to the validator + * address. + */ +export interface MsgWithdrawValidatorCommissionAmino { + validator_address: string; +} +export interface MsgWithdrawValidatorCommissionAminoMsg { + type: "cosmos-sdk/MsgWithdrawValidatorCommission"; + value: MsgWithdrawValidatorCommissionAmino; +} +/** + * MsgWithdrawValidatorCommissionResponse defines the + * Msg/WithdrawValidatorCommission response type. + */ +export interface MsgWithdrawValidatorCommissionResponse { + /** Since: cosmos-sdk 0.46 */ + amount: Coin[]; +} +export interface MsgWithdrawValidatorCommissionResponseProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse"; + value: Uint8Array; +} +/** + * MsgWithdrawValidatorCommissionResponse defines the + * Msg/WithdrawValidatorCommission response type. + */ +export interface MsgWithdrawValidatorCommissionResponseAmino { + /** Since: cosmos-sdk 0.46 */ + amount: CoinAmino[]; +} +export interface MsgWithdrawValidatorCommissionResponseAminoMsg { + type: "cosmos-sdk/MsgWithdrawValidatorCommissionResponse"; + value: MsgWithdrawValidatorCommissionResponseAmino; +} +/** + * MsgFundCommunityPool allows an account to directly + * fund the community pool. + */ +export interface MsgFundCommunityPool { + amount: Coin[]; + depositor: string; +} +export interface MsgFundCommunityPoolProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPool"; + value: Uint8Array; +} +/** + * MsgFundCommunityPool allows an account to directly + * fund the community pool. + */ +export interface MsgFundCommunityPoolAmino { + amount: CoinAmino[]; + depositor: string; +} +export interface MsgFundCommunityPoolAminoMsg { + type: "cosmos-sdk/MsgFundCommunityPool"; + value: MsgFundCommunityPoolAmino; +} +/** MsgFundCommunityPoolResponse defines the Msg/FundCommunityPool response type. */ +export interface MsgFundCommunityPoolResponse {} +export interface MsgFundCommunityPoolResponseProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse"; + value: Uint8Array; +} +/** MsgFundCommunityPoolResponse defines the Msg/FundCommunityPool response type. */ +export interface MsgFundCommunityPoolResponseAmino {} +export interface MsgFundCommunityPoolResponseAminoMsg { + type: "cosmos-sdk/MsgFundCommunityPoolResponse"; + value: MsgFundCommunityPoolResponseAmino; +} +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/distribution parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params; +} +export interface MsgUpdateParamsProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.MsgUpdateParams"; + value: Uint8Array; +} +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsAmino { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/distribution parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: ParamsAmino; +} +export interface MsgUpdateParamsAminoMsg { + type: "cosmos-sdk/distribution/MsgUpdateParams"; + value: MsgUpdateParamsAmino; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse {} +export interface MsgUpdateParamsResponseProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.MsgUpdateParamsResponse"; + value: Uint8Array; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponseAmino {} +export interface MsgUpdateParamsResponseAminoMsg { + type: "cosmos-sdk/MsgUpdateParamsResponse"; + value: MsgUpdateParamsResponseAmino; +} +/** + * MsgCommunityPoolSpend defines a message for sending tokens from the community + * pool to another account. This message is typically executed via a governance + * proposal with the governance module being the executing authority. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpend { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + recipient: string; + amount: Coin[]; +} +export interface MsgCommunityPoolSpendProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.MsgCommunityPoolSpend"; + value: Uint8Array; +} +/** + * MsgCommunityPoolSpend defines a message for sending tokens from the community + * pool to another account. This message is typically executed via a governance + * proposal with the governance module being the executing authority. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpendAmino { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + recipient: string; + amount: CoinAmino[]; +} +export interface MsgCommunityPoolSpendAminoMsg { + type: "cosmos-sdk/distr/MsgCommunityPoolSpend"; + value: MsgCommunityPoolSpendAmino; +} +/** + * MsgCommunityPoolSpendResponse defines the response to executing a + * MsgCommunityPoolSpend message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpendResponse {} +export interface MsgCommunityPoolSpendResponseProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.MsgCommunityPoolSpendResponse"; + value: Uint8Array; +} +/** + * MsgCommunityPoolSpendResponse defines the response to executing a + * MsgCommunityPoolSpend message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgCommunityPoolSpendResponseAmino {} +export interface MsgCommunityPoolSpendResponseAminoMsg { + type: "cosmos-sdk/MsgCommunityPoolSpendResponse"; + value: MsgCommunityPoolSpendResponseAmino; +} +/** + * DepositValidatorRewardsPool defines the request structure to provide + * additional rewards to delegators from a specific validator. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPool { + depositor: string; + validatorAddress: string; + amount: Coin[]; +} +export interface MsgDepositValidatorRewardsPoolProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPool"; + value: Uint8Array; +} +/** + * DepositValidatorRewardsPool defines the request structure to provide + * additional rewards to delegators from a specific validator. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPoolAmino { + depositor: string; + validator_address: string; + amount: CoinAmino[]; +} +export interface MsgDepositValidatorRewardsPoolAminoMsg { + type: "cosmos-sdk/distr/MsgDepositValRewards"; + value: MsgDepositValidatorRewardsPoolAmino; +} +/** + * MsgDepositValidatorRewardsPoolResponse defines the response to executing a + * MsgDepositValidatorRewardsPool message. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPoolResponse {} +export interface MsgDepositValidatorRewardsPoolResponseProtoMsg { + typeUrl: "/cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPoolResponse"; + value: Uint8Array; +} +/** + * MsgDepositValidatorRewardsPoolResponse defines the response to executing a + * MsgDepositValidatorRewardsPool message. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgDepositValidatorRewardsPoolResponseAmino {} +export interface MsgDepositValidatorRewardsPoolResponseAminoMsg { + type: "cosmos-sdk/MsgDepositValidatorRewardsPoolResponse"; + value: MsgDepositValidatorRewardsPoolResponseAmino; +} +function createBaseMsgSetWithdrawAddress(): MsgSetWithdrawAddress { + return { + delegatorAddress: "", + withdrawAddress: "" + }; +} +export const MsgSetWithdrawAddress = { + typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", + aminoType: "cosmos-sdk/MsgModifyWithdrawAddress", + is(o: any): o is MsgSetWithdrawAddress { + return o && (o.$typeUrl === MsgSetWithdrawAddress.typeUrl || typeof o.delegatorAddress === "string" && typeof o.withdrawAddress === "string"); + }, + isAmino(o: any): o is MsgSetWithdrawAddressAmino { + return o && (o.$typeUrl === MsgSetWithdrawAddress.typeUrl || typeof o.delegator_address === "string" && typeof o.withdraw_address === "string"); + }, + encode(message: MsgSetWithdrawAddress, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.withdrawAddress !== "") { + writer.uint32(18).string(message.withdrawAddress); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSetWithdrawAddress { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWithdrawAddress(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddress = reader.string(); + break; + case 2: + message.withdrawAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgSetWithdrawAddress { + const message = createBaseMsgSetWithdrawAddress(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.withdrawAddress = object.withdrawAddress ?? ""; + return message; + }, + fromAmino(object: MsgSetWithdrawAddressAmino): MsgSetWithdrawAddress { + const message = createBaseMsgSetWithdrawAddress(); + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + if (object.withdraw_address !== undefined && object.withdraw_address !== null) { + message.withdrawAddress = object.withdraw_address; + } + return message; + }, + toAmino(message: MsgSetWithdrawAddress): MsgSetWithdrawAddressAmino { + const obj: any = {}; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.withdraw_address = message.withdrawAddress === "" ? undefined : message.withdrawAddress; + return obj; + }, + fromAminoMsg(object: MsgSetWithdrawAddressAminoMsg): MsgSetWithdrawAddress { + return MsgSetWithdrawAddress.fromAmino(object.value); + }, + toAminoMsg(message: MsgSetWithdrawAddress): MsgSetWithdrawAddressAminoMsg { + return { + type: "cosmos-sdk/MsgModifyWithdrawAddress", + value: MsgSetWithdrawAddress.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSetWithdrawAddressProtoMsg): MsgSetWithdrawAddress { + return MsgSetWithdrawAddress.decode(message.value); + }, + toProto(message: MsgSetWithdrawAddress): Uint8Array { + return MsgSetWithdrawAddress.encode(message).finish(); + }, + toProtoMsg(message: MsgSetWithdrawAddress): MsgSetWithdrawAddressProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", + value: MsgSetWithdrawAddress.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgSetWithdrawAddress.typeUrl, MsgSetWithdrawAddress); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgSetWithdrawAddress.aminoType, MsgSetWithdrawAddress.typeUrl); +function createBaseMsgSetWithdrawAddressResponse(): MsgSetWithdrawAddressResponse { + return {}; +} +export const MsgSetWithdrawAddressResponse = { + typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse", + aminoType: "cosmos-sdk/MsgSetWithdrawAddressResponse", + is(o: any): o is MsgSetWithdrawAddressResponse { + return o && o.$typeUrl === MsgSetWithdrawAddressResponse.typeUrl; + }, + isAmino(o: any): o is MsgSetWithdrawAddressResponseAmino { + return o && o.$typeUrl === MsgSetWithdrawAddressResponse.typeUrl; + }, + encode(_: MsgSetWithdrawAddressResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSetWithdrawAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSetWithdrawAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgSetWithdrawAddressResponse { + const message = createBaseMsgSetWithdrawAddressResponse(); + return message; + }, + fromAmino(_: MsgSetWithdrawAddressResponseAmino): MsgSetWithdrawAddressResponse { + const message = createBaseMsgSetWithdrawAddressResponse(); + return message; + }, + toAmino(_: MsgSetWithdrawAddressResponse): MsgSetWithdrawAddressResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgSetWithdrawAddressResponseAminoMsg): MsgSetWithdrawAddressResponse { + return MsgSetWithdrawAddressResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgSetWithdrawAddressResponse): MsgSetWithdrawAddressResponseAminoMsg { + return { + type: "cosmos-sdk/MsgSetWithdrawAddressResponse", + value: MsgSetWithdrawAddressResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSetWithdrawAddressResponseProtoMsg): MsgSetWithdrawAddressResponse { + return MsgSetWithdrawAddressResponse.decode(message.value); + }, + toProto(message: MsgSetWithdrawAddressResponse): Uint8Array { + return MsgSetWithdrawAddressResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgSetWithdrawAddressResponse): MsgSetWithdrawAddressResponseProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse", + value: MsgSetWithdrawAddressResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgSetWithdrawAddressResponse.typeUrl, MsgSetWithdrawAddressResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgSetWithdrawAddressResponse.aminoType, MsgSetWithdrawAddressResponse.typeUrl); +function createBaseMsgWithdrawDelegatorReward(): MsgWithdrawDelegatorReward { + return { + delegatorAddress: "", + validatorAddress: "" + }; +} +export const MsgWithdrawDelegatorReward = { + typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", + aminoType: "cosmos-sdk/MsgWithdrawDelegationReward", + is(o: any): o is MsgWithdrawDelegatorReward { + return o && (o.$typeUrl === MsgWithdrawDelegatorReward.typeUrl || typeof o.delegatorAddress === "string" && typeof o.validatorAddress === "string"); + }, + isAmino(o: any): o is MsgWithdrawDelegatorRewardAmino { + return o && (o.$typeUrl === MsgWithdrawDelegatorReward.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string"); + }, + encode(message: MsgWithdrawDelegatorReward, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawDelegatorReward { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawDelegatorReward(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddress = reader.string(); + break; + case 2: + message.validatorAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgWithdrawDelegatorReward { + const message = createBaseMsgWithdrawDelegatorReward(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, + fromAmino(object: MsgWithdrawDelegatorRewardAmino): MsgWithdrawDelegatorReward { + const message = createBaseMsgWithdrawDelegatorReward(); + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + return message; + }, + toAmino(message: MsgWithdrawDelegatorReward): MsgWithdrawDelegatorRewardAmino { + const obj: any = {}; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + return obj; + }, + fromAminoMsg(object: MsgWithdrawDelegatorRewardAminoMsg): MsgWithdrawDelegatorReward { + return MsgWithdrawDelegatorReward.fromAmino(object.value); + }, + toAminoMsg(message: MsgWithdrawDelegatorReward): MsgWithdrawDelegatorRewardAminoMsg { + return { + type: "cosmos-sdk/MsgWithdrawDelegationReward", + value: MsgWithdrawDelegatorReward.toAmino(message) + }; + }, + fromProtoMsg(message: MsgWithdrawDelegatorRewardProtoMsg): MsgWithdrawDelegatorReward { + return MsgWithdrawDelegatorReward.decode(message.value); + }, + toProto(message: MsgWithdrawDelegatorReward): Uint8Array { + return MsgWithdrawDelegatorReward.encode(message).finish(); + }, + toProtoMsg(message: MsgWithdrawDelegatorReward): MsgWithdrawDelegatorRewardProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", + value: MsgWithdrawDelegatorReward.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgWithdrawDelegatorReward.typeUrl, MsgWithdrawDelegatorReward); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgWithdrawDelegatorReward.aminoType, MsgWithdrawDelegatorReward.typeUrl); +function createBaseMsgWithdrawDelegatorRewardResponse(): MsgWithdrawDelegatorRewardResponse { + return { + amount: [] + }; +} +export const MsgWithdrawDelegatorRewardResponse = { + typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse", + aminoType: "cosmos-sdk/MsgWithdrawDelegatorRewardResponse", + is(o: any): o is MsgWithdrawDelegatorRewardResponse { + return o && (o.$typeUrl === MsgWithdrawDelegatorRewardResponse.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0]))); + }, + isAmino(o: any): o is MsgWithdrawDelegatorRewardResponseAmino { + return o && (o.$typeUrl === MsgWithdrawDelegatorRewardResponse.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0]))); + }, + encode(message: MsgWithdrawDelegatorRewardResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawDelegatorRewardResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgWithdrawDelegatorRewardResponse { + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MsgWithdrawDelegatorRewardResponseAmino): MsgWithdrawDelegatorRewardResponse { + const message = createBaseMsgWithdrawDelegatorRewardResponse(); + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgWithdrawDelegatorRewardResponse): MsgWithdrawDelegatorRewardResponseAmino { + const obj: any = {}; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = message.amount; + } + return obj; + }, + fromAminoMsg(object: MsgWithdrawDelegatorRewardResponseAminoMsg): MsgWithdrawDelegatorRewardResponse { + return MsgWithdrawDelegatorRewardResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgWithdrawDelegatorRewardResponse): MsgWithdrawDelegatorRewardResponseAminoMsg { + return { + type: "cosmos-sdk/MsgWithdrawDelegatorRewardResponse", + value: MsgWithdrawDelegatorRewardResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgWithdrawDelegatorRewardResponseProtoMsg): MsgWithdrawDelegatorRewardResponse { + return MsgWithdrawDelegatorRewardResponse.decode(message.value); + }, + toProto(message: MsgWithdrawDelegatorRewardResponse): Uint8Array { + return MsgWithdrawDelegatorRewardResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgWithdrawDelegatorRewardResponse): MsgWithdrawDelegatorRewardResponseProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse", + value: MsgWithdrawDelegatorRewardResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgWithdrawDelegatorRewardResponse.typeUrl, MsgWithdrawDelegatorRewardResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgWithdrawDelegatorRewardResponse.aminoType, MsgWithdrawDelegatorRewardResponse.typeUrl); +function createBaseMsgWithdrawValidatorCommission(): MsgWithdrawValidatorCommission { + return { + validatorAddress: "" + }; +} +export const MsgWithdrawValidatorCommission = { + typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", + aminoType: "cosmos-sdk/MsgWithdrawValidatorCommission", + is(o: any): o is MsgWithdrawValidatorCommission { + return o && (o.$typeUrl === MsgWithdrawValidatorCommission.typeUrl || typeof o.validatorAddress === "string"); + }, + isAmino(o: any): o is MsgWithdrawValidatorCommissionAmino { + return o && (o.$typeUrl === MsgWithdrawValidatorCommission.typeUrl || typeof o.validator_address === "string"); + }, + encode(message: MsgWithdrawValidatorCommission, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.validatorAddress !== "") { + writer.uint32(10).string(message.validatorAddress); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawValidatorCommission { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawValidatorCommission(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validatorAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgWithdrawValidatorCommission { + const message = createBaseMsgWithdrawValidatorCommission(); + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, + fromAmino(object: MsgWithdrawValidatorCommissionAmino): MsgWithdrawValidatorCommission { + const message = createBaseMsgWithdrawValidatorCommission(); + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + return message; + }, + toAmino(message: MsgWithdrawValidatorCommission): MsgWithdrawValidatorCommissionAmino { + const obj: any = {}; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + return obj; + }, + fromAminoMsg(object: MsgWithdrawValidatorCommissionAminoMsg): MsgWithdrawValidatorCommission { + return MsgWithdrawValidatorCommission.fromAmino(object.value); + }, + toAminoMsg(message: MsgWithdrawValidatorCommission): MsgWithdrawValidatorCommissionAminoMsg { + return { + type: "cosmos-sdk/MsgWithdrawValidatorCommission", + value: MsgWithdrawValidatorCommission.toAmino(message) + }; + }, + fromProtoMsg(message: MsgWithdrawValidatorCommissionProtoMsg): MsgWithdrawValidatorCommission { + return MsgWithdrawValidatorCommission.decode(message.value); + }, + toProto(message: MsgWithdrawValidatorCommission): Uint8Array { + return MsgWithdrawValidatorCommission.encode(message).finish(); + }, + toProtoMsg(message: MsgWithdrawValidatorCommission): MsgWithdrawValidatorCommissionProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", + value: MsgWithdrawValidatorCommission.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgWithdrawValidatorCommission.typeUrl, MsgWithdrawValidatorCommission); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgWithdrawValidatorCommission.aminoType, MsgWithdrawValidatorCommission.typeUrl); +function createBaseMsgWithdrawValidatorCommissionResponse(): MsgWithdrawValidatorCommissionResponse { + return { + amount: [] + }; +} +export const MsgWithdrawValidatorCommissionResponse = { + typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse", + aminoType: "cosmos-sdk/MsgWithdrawValidatorCommissionResponse", + is(o: any): o is MsgWithdrawValidatorCommissionResponse { + return o && (o.$typeUrl === MsgWithdrawValidatorCommissionResponse.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0]))); + }, + isAmino(o: any): o is MsgWithdrawValidatorCommissionResponseAmino { + return o && (o.$typeUrl === MsgWithdrawValidatorCommissionResponse.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0]))); + }, + encode(message: MsgWithdrawValidatorCommissionResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawValidatorCommissionResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawValidatorCommissionResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgWithdrawValidatorCommissionResponse { + const message = createBaseMsgWithdrawValidatorCommissionResponse(); + message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MsgWithdrawValidatorCommissionResponseAmino): MsgWithdrawValidatorCommissionResponse { + const message = createBaseMsgWithdrawValidatorCommissionResponse(); + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgWithdrawValidatorCommissionResponse): MsgWithdrawValidatorCommissionResponseAmino { + const obj: any = {}; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = message.amount; + } + return obj; + }, + fromAminoMsg(object: MsgWithdrawValidatorCommissionResponseAminoMsg): MsgWithdrawValidatorCommissionResponse { + return MsgWithdrawValidatorCommissionResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgWithdrawValidatorCommissionResponse): MsgWithdrawValidatorCommissionResponseAminoMsg { + return { + type: "cosmos-sdk/MsgWithdrawValidatorCommissionResponse", + value: MsgWithdrawValidatorCommissionResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgWithdrawValidatorCommissionResponseProtoMsg): MsgWithdrawValidatorCommissionResponse { + return MsgWithdrawValidatorCommissionResponse.decode(message.value); + }, + toProto(message: MsgWithdrawValidatorCommissionResponse): Uint8Array { + return MsgWithdrawValidatorCommissionResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgWithdrawValidatorCommissionResponse): MsgWithdrawValidatorCommissionResponseProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse", + value: MsgWithdrawValidatorCommissionResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgWithdrawValidatorCommissionResponse.typeUrl, MsgWithdrawValidatorCommissionResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgWithdrawValidatorCommissionResponse.aminoType, MsgWithdrawValidatorCommissionResponse.typeUrl); +function createBaseMsgFundCommunityPool(): MsgFundCommunityPool { + return { + amount: [], + depositor: "" + }; +} +export const MsgFundCommunityPool = { + typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPool", + aminoType: "cosmos-sdk/MsgFundCommunityPool", + is(o: any): o is MsgFundCommunityPool { + return o && (o.$typeUrl === MsgFundCommunityPool.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0])) && typeof o.depositor === "string"); + }, + isAmino(o: any): o is MsgFundCommunityPoolAmino { + return o && (o.$typeUrl === MsgFundCommunityPool.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0])) && typeof o.depositor === "string"); + }, + encode(message: MsgFundCommunityPool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgFundCommunityPool { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + case 2: + message.depositor = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgFundCommunityPool { + const message = createBaseMsgFundCommunityPool(); + message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; + message.depositor = object.depositor ?? ""; + return message; + }, + fromAmino(object: MsgFundCommunityPoolAmino): MsgFundCommunityPool { + const message = createBaseMsgFundCommunityPool(); + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + if (object.depositor !== undefined && object.depositor !== null) { + message.depositor = object.depositor; + } + return message; + }, + toAmino(message: MsgFundCommunityPool): MsgFundCommunityPoolAmino { + const obj: any = {}; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = message.amount; + } + obj.depositor = message.depositor === "" ? undefined : message.depositor; + return obj; + }, + fromAminoMsg(object: MsgFundCommunityPoolAminoMsg): MsgFundCommunityPool { + return MsgFundCommunityPool.fromAmino(object.value); + }, + toAminoMsg(message: MsgFundCommunityPool): MsgFundCommunityPoolAminoMsg { + return { + type: "cosmos-sdk/MsgFundCommunityPool", + value: MsgFundCommunityPool.toAmino(message) + }; + }, + fromProtoMsg(message: MsgFundCommunityPoolProtoMsg): MsgFundCommunityPool { + return MsgFundCommunityPool.decode(message.value); + }, + toProto(message: MsgFundCommunityPool): Uint8Array { + return MsgFundCommunityPool.encode(message).finish(); + }, + toProtoMsg(message: MsgFundCommunityPool): MsgFundCommunityPoolProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPool", + value: MsgFundCommunityPool.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgFundCommunityPool.typeUrl, MsgFundCommunityPool); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgFundCommunityPool.aminoType, MsgFundCommunityPool.typeUrl); +function createBaseMsgFundCommunityPoolResponse(): MsgFundCommunityPoolResponse { + return {}; +} +export const MsgFundCommunityPoolResponse = { + typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse", + aminoType: "cosmos-sdk/MsgFundCommunityPoolResponse", + is(o: any): o is MsgFundCommunityPoolResponse { + return o && o.$typeUrl === MsgFundCommunityPoolResponse.typeUrl; + }, + isAmino(o: any): o is MsgFundCommunityPoolResponseAmino { + return o && o.$typeUrl === MsgFundCommunityPoolResponse.typeUrl; + }, + encode(_: MsgFundCommunityPoolResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgFundCommunityPoolResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgFundCommunityPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgFundCommunityPoolResponse { + const message = createBaseMsgFundCommunityPoolResponse(); + return message; + }, + fromAmino(_: MsgFundCommunityPoolResponseAmino): MsgFundCommunityPoolResponse { + const message = createBaseMsgFundCommunityPoolResponse(); + return message; + }, + toAmino(_: MsgFundCommunityPoolResponse): MsgFundCommunityPoolResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgFundCommunityPoolResponseAminoMsg): MsgFundCommunityPoolResponse { + return MsgFundCommunityPoolResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgFundCommunityPoolResponse): MsgFundCommunityPoolResponseAminoMsg { + return { + type: "cosmos-sdk/MsgFundCommunityPoolResponse", + value: MsgFundCommunityPoolResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgFundCommunityPoolResponseProtoMsg): MsgFundCommunityPoolResponse { + return MsgFundCommunityPoolResponse.decode(message.value); + }, + toProto(message: MsgFundCommunityPoolResponse): Uint8Array { + return MsgFundCommunityPoolResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgFundCommunityPoolResponse): MsgFundCommunityPoolResponseProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse", + value: MsgFundCommunityPoolResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgFundCommunityPoolResponse.typeUrl, MsgFundCommunityPoolResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgFundCommunityPoolResponse.aminoType, MsgFundCommunityPoolResponse.typeUrl); +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { + authority: "", + params: Params.fromPartial({}) + }; +} +export const MsgUpdateParams = { + typeUrl: "/cosmos.distribution.v1beta1.MsgUpdateParams", + aminoType: "cosmos-sdk/distribution/MsgUpdateParams", + is(o: any): o is MsgUpdateParams { + return o && (o.$typeUrl === MsgUpdateParams.typeUrl || typeof o.authority === "string" && Params.is(o.params)); + }, + isAmino(o: any): o is MsgUpdateParamsAmino { + return o && (o.$typeUrl === MsgUpdateParams.typeUrl || typeof o.authority === "string" && Params.isAmino(o.params)); + }, + encode(message: MsgUpdateParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + message.authority = object.authority ?? ""; + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: MsgUpdateParamsAmino): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: MsgUpdateParams): MsgUpdateParamsAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsAminoMsg): MsgUpdateParams { + return MsgUpdateParams.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParams): MsgUpdateParamsAminoMsg { + return { + type: "cosmos-sdk/distribution/MsgUpdateParams", + value: MsgUpdateParams.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsProtoMsg): MsgUpdateParams { + return MsgUpdateParams.decode(message.value); + }, + toProto(message: MsgUpdateParams): Uint8Array { + return MsgUpdateParams.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParams): MsgUpdateParamsProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgUpdateParams", + value: MsgUpdateParams.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgUpdateParams.typeUrl, MsgUpdateParams); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgUpdateParams.aminoType, MsgUpdateParams.typeUrl); +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} +export const MsgUpdateParamsResponse = { + typeUrl: "/cosmos.distribution.v1beta1.MsgUpdateParamsResponse", + aminoType: "cosmos-sdk/MsgUpdateParamsResponse", + is(o: any): o is MsgUpdateParamsResponse { + return o && o.$typeUrl === MsgUpdateParamsResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateParamsResponseAmino { + return o && o.$typeUrl === MsgUpdateParamsResponse.typeUrl; + }, + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + fromAmino(_: MsgUpdateParamsResponseAmino): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + toAmino(_: MsgUpdateParamsResponse): MsgUpdateParamsResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsResponseAminoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsResponseProtoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.decode(message.value); + }, + toProto(message: MsgUpdateParamsResponse): Uint8Array { + return MsgUpdateParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgUpdateParamsResponse.typeUrl, MsgUpdateParamsResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgUpdateParamsResponse.aminoType, MsgUpdateParamsResponse.typeUrl); +function createBaseMsgCommunityPoolSpend(): MsgCommunityPoolSpend { + return { + authority: "", + recipient: "", + amount: [] + }; +} +export const MsgCommunityPoolSpend = { + typeUrl: "/cosmos.distribution.v1beta1.MsgCommunityPoolSpend", + aminoType: "cosmos-sdk/distr/MsgCommunityPoolSpend", + is(o: any): o is MsgCommunityPoolSpend { + return o && (o.$typeUrl === MsgCommunityPoolSpend.typeUrl || typeof o.authority === "string" && typeof o.recipient === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0]))); + }, + isAmino(o: any): o is MsgCommunityPoolSpendAmino { + return o && (o.$typeUrl === MsgCommunityPoolSpend.typeUrl || typeof o.authority === "string" && typeof o.recipient === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0]))); + }, + encode(message: MsgCommunityPoolSpend, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.recipient !== "") { + writer.uint32(18).string(message.recipient); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCommunityPoolSpend { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpend(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.recipient = reader.string(); + break; + case 3: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgCommunityPoolSpend { + const message = createBaseMsgCommunityPoolSpend(); + message.authority = object.authority ?? ""; + message.recipient = object.recipient ?? ""; + message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MsgCommunityPoolSpendAmino): MsgCommunityPoolSpend { + const message = createBaseMsgCommunityPoolSpend(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.recipient !== undefined && object.recipient !== null) { + message.recipient = object.recipient; + } + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgCommunityPoolSpend): MsgCommunityPoolSpendAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + obj.recipient = message.recipient === "" ? undefined : message.recipient; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = message.amount; + } + return obj; + }, + fromAminoMsg(object: MsgCommunityPoolSpendAminoMsg): MsgCommunityPoolSpend { + return MsgCommunityPoolSpend.fromAmino(object.value); + }, + toAminoMsg(message: MsgCommunityPoolSpend): MsgCommunityPoolSpendAminoMsg { + return { + type: "cosmos-sdk/distr/MsgCommunityPoolSpend", + value: MsgCommunityPoolSpend.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCommunityPoolSpendProtoMsg): MsgCommunityPoolSpend { + return MsgCommunityPoolSpend.decode(message.value); + }, + toProto(message: MsgCommunityPoolSpend): Uint8Array { + return MsgCommunityPoolSpend.encode(message).finish(); + }, + toProtoMsg(message: MsgCommunityPoolSpend): MsgCommunityPoolSpendProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgCommunityPoolSpend", + value: MsgCommunityPoolSpend.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgCommunityPoolSpend.typeUrl, MsgCommunityPoolSpend); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgCommunityPoolSpend.aminoType, MsgCommunityPoolSpend.typeUrl); +function createBaseMsgCommunityPoolSpendResponse(): MsgCommunityPoolSpendResponse { + return {}; +} +export const MsgCommunityPoolSpendResponse = { + typeUrl: "/cosmos.distribution.v1beta1.MsgCommunityPoolSpendResponse", + aminoType: "cosmos-sdk/MsgCommunityPoolSpendResponse", + is(o: any): o is MsgCommunityPoolSpendResponse { + return o && o.$typeUrl === MsgCommunityPoolSpendResponse.typeUrl; + }, + isAmino(o: any): o is MsgCommunityPoolSpendResponseAmino { + return o && o.$typeUrl === MsgCommunityPoolSpendResponse.typeUrl; + }, + encode(_: MsgCommunityPoolSpendResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCommunityPoolSpendResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCommunityPoolSpendResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgCommunityPoolSpendResponse { + const message = createBaseMsgCommunityPoolSpendResponse(); + return message; + }, + fromAmino(_: MsgCommunityPoolSpendResponseAmino): MsgCommunityPoolSpendResponse { + const message = createBaseMsgCommunityPoolSpendResponse(); + return message; + }, + toAmino(_: MsgCommunityPoolSpendResponse): MsgCommunityPoolSpendResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgCommunityPoolSpendResponseAminoMsg): MsgCommunityPoolSpendResponse { + return MsgCommunityPoolSpendResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgCommunityPoolSpendResponse): MsgCommunityPoolSpendResponseAminoMsg { + return { + type: "cosmos-sdk/MsgCommunityPoolSpendResponse", + value: MsgCommunityPoolSpendResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCommunityPoolSpendResponseProtoMsg): MsgCommunityPoolSpendResponse { + return MsgCommunityPoolSpendResponse.decode(message.value); + }, + toProto(message: MsgCommunityPoolSpendResponse): Uint8Array { + return MsgCommunityPoolSpendResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgCommunityPoolSpendResponse): MsgCommunityPoolSpendResponseProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgCommunityPoolSpendResponse", + value: MsgCommunityPoolSpendResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgCommunityPoolSpendResponse.typeUrl, MsgCommunityPoolSpendResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgCommunityPoolSpendResponse.aminoType, MsgCommunityPoolSpendResponse.typeUrl); +function createBaseMsgDepositValidatorRewardsPool(): MsgDepositValidatorRewardsPool { + return { + depositor: "", + validatorAddress: "", + amount: [] + }; +} +export const MsgDepositValidatorRewardsPool = { + typeUrl: "/cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPool", + aminoType: "cosmos-sdk/distr/MsgDepositValRewards", + is(o: any): o is MsgDepositValidatorRewardsPool { + return o && (o.$typeUrl === MsgDepositValidatorRewardsPool.typeUrl || typeof o.depositor === "string" && typeof o.validatorAddress === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0]))); + }, + isAmino(o: any): o is MsgDepositValidatorRewardsPoolAmino { + return o && (o.$typeUrl === MsgDepositValidatorRewardsPool.typeUrl || typeof o.depositor === "string" && typeof o.validator_address === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0]))); + }, + encode(message: MsgDepositValidatorRewardsPool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.depositor !== "") { + writer.uint32(10).string(message.depositor); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgDepositValidatorRewardsPool { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.depositor = reader.string(); + break; + case 2: + message.validatorAddress = reader.string(); + break; + case 3: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgDepositValidatorRewardsPool { + const message = createBaseMsgDepositValidatorRewardsPool(); + message.depositor = object.depositor ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MsgDepositValidatorRewardsPoolAmino): MsgDepositValidatorRewardsPool { + const message = createBaseMsgDepositValidatorRewardsPool(); + if (object.depositor !== undefined && object.depositor !== null) { + message.depositor = object.depositor; + } + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgDepositValidatorRewardsPool): MsgDepositValidatorRewardsPoolAmino { + const obj: any = {}; + obj.depositor = message.depositor === "" ? undefined : message.depositor; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = message.amount; + } + return obj; + }, + fromAminoMsg(object: MsgDepositValidatorRewardsPoolAminoMsg): MsgDepositValidatorRewardsPool { + return MsgDepositValidatorRewardsPool.fromAmino(object.value); + }, + toAminoMsg(message: MsgDepositValidatorRewardsPool): MsgDepositValidatorRewardsPoolAminoMsg { + return { + type: "cosmos-sdk/distr/MsgDepositValRewards", + value: MsgDepositValidatorRewardsPool.toAmino(message) + }; + }, + fromProtoMsg(message: MsgDepositValidatorRewardsPoolProtoMsg): MsgDepositValidatorRewardsPool { + return MsgDepositValidatorRewardsPool.decode(message.value); + }, + toProto(message: MsgDepositValidatorRewardsPool): Uint8Array { + return MsgDepositValidatorRewardsPool.encode(message).finish(); + }, + toProtoMsg(message: MsgDepositValidatorRewardsPool): MsgDepositValidatorRewardsPoolProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPool", + value: MsgDepositValidatorRewardsPool.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgDepositValidatorRewardsPool.typeUrl, MsgDepositValidatorRewardsPool); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgDepositValidatorRewardsPool.aminoType, MsgDepositValidatorRewardsPool.typeUrl); +function createBaseMsgDepositValidatorRewardsPoolResponse(): MsgDepositValidatorRewardsPoolResponse { + return {}; +} +export const MsgDepositValidatorRewardsPoolResponse = { + typeUrl: "/cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPoolResponse", + aminoType: "cosmos-sdk/MsgDepositValidatorRewardsPoolResponse", + is(o: any): o is MsgDepositValidatorRewardsPoolResponse { + return o && o.$typeUrl === MsgDepositValidatorRewardsPoolResponse.typeUrl; + }, + isAmino(o: any): o is MsgDepositValidatorRewardsPoolResponseAmino { + return o && o.$typeUrl === MsgDepositValidatorRewardsPoolResponse.typeUrl; + }, + encode(_: MsgDepositValidatorRewardsPoolResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgDepositValidatorRewardsPoolResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgDepositValidatorRewardsPoolResponse { + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + return message; + }, + fromAmino(_: MsgDepositValidatorRewardsPoolResponseAmino): MsgDepositValidatorRewardsPoolResponse { + const message = createBaseMsgDepositValidatorRewardsPoolResponse(); + return message; + }, + toAmino(_: MsgDepositValidatorRewardsPoolResponse): MsgDepositValidatorRewardsPoolResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgDepositValidatorRewardsPoolResponseAminoMsg): MsgDepositValidatorRewardsPoolResponse { + return MsgDepositValidatorRewardsPoolResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgDepositValidatorRewardsPoolResponse): MsgDepositValidatorRewardsPoolResponseAminoMsg { + return { + type: "cosmos-sdk/MsgDepositValidatorRewardsPoolResponse", + value: MsgDepositValidatorRewardsPoolResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgDepositValidatorRewardsPoolResponseProtoMsg): MsgDepositValidatorRewardsPoolResponse { + return MsgDepositValidatorRewardsPoolResponse.decode(message.value); + }, + toProto(message: MsgDepositValidatorRewardsPoolResponse): Uint8Array { + return MsgDepositValidatorRewardsPoolResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgDepositValidatorRewardsPoolResponse): MsgDepositValidatorRewardsPoolResponseProtoMsg { + return { + typeUrl: "/cosmos.distribution.v1beta1.MsgDepositValidatorRewardsPoolResponse", + value: MsgDepositValidatorRewardsPoolResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgDepositValidatorRewardsPoolResponse.typeUrl, MsgDepositValidatorRewardsPoolResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgDepositValidatorRewardsPoolResponse.aminoType, MsgDepositValidatorRewardsPoolResponse.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/feegrant/v1beta1/tx.rpc.func.ts b/libs/interchain-query/src/cosmos/feegrant/v1beta1/tx.rpc.func.ts new file mode 100644 index 00000000..3cfc4271 --- /dev/null +++ b/libs/interchain-query/src/cosmos/feegrant/v1beta1/tx.rpc.func.ts @@ -0,0 +1,31 @@ +import { buildTx, SigningClientResolver } from "../../../helper-func-types"; +import { buildUseMutation } from "../../../react-query"; +import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; +import { MsgGrantAllowance, MsgRevokeAllowance, MsgPruneAllowances } from "./tx"; +export const createGrantAllowance = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgGrantAllowance.typeUrl, + encoders: toEncoders(MsgGrantAllowance), + converters: toConverters(MsgGrantAllowance) +}); +export const useGrantAllowance = buildUseMutation({ + builderMutationFn: createGrantAllowance +}); +export const createRevokeAllowance = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgRevokeAllowance.typeUrl, + encoders: toEncoders(MsgRevokeAllowance), + converters: toConverters(MsgRevokeAllowance) +}); +export const useRevokeAllowance = buildUseMutation({ + builderMutationFn: createRevokeAllowance +}); +export const createPruneAllowances = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgPruneAllowances.typeUrl, + encoders: toEncoders(MsgPruneAllowances), + converters: toConverters(MsgPruneAllowances) +}); +export const usePruneAllowances = buildUseMutation({ + builderMutationFn: createPruneAllowances +}); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/feegrant/v1beta1/tx.ts b/libs/interchain-query/src/cosmos/feegrant/v1beta1/tx.ts new file mode 100644 index 00000000..9e674784 --- /dev/null +++ b/libs/interchain-query/src/cosmos/feegrant/v1beta1/tx.ts @@ -0,0 +1,596 @@ +import { Any, AnyProtoMsg, AnyAmino } from "../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; +/** + * MsgGrantAllowance adds permission for Grantee to spend up to Allowance + * of fees from the account of Granter. + */ +export interface MsgGrantAllowance { + /** granter is the address of the user granting an allowance of their funds. */ + granter: string; + /** grantee is the address of the user being granted an allowance of another user's funds. */ + grantee: string; + /** allowance can be any of basic, periodic, allowed fee allowance. */ + allowance?: Any | undefined; +} +export interface MsgGrantAllowanceProtoMsg { + typeUrl: "/cosmos.feegrant.v1beta1.MsgGrantAllowance"; + value: Uint8Array; +} +export type MsgGrantAllowanceEncoded = Omit & { + /** allowance can be any of basic, periodic, allowed fee allowance. */allowance?: AnyProtoMsg | undefined; +}; +/** + * MsgGrantAllowance adds permission for Grantee to spend up to Allowance + * of fees from the account of Granter. + */ +export interface MsgGrantAllowanceAmino { + /** granter is the address of the user granting an allowance of their funds. */ + granter: string; + /** grantee is the address of the user being granted an allowance of another user's funds. */ + grantee: string; + /** allowance can be any of basic, periodic, allowed fee allowance. */ + allowance?: AnyAmino; +} +export interface MsgGrantAllowanceAminoMsg { + type: "cosmos-sdk/MsgGrantAllowance"; + value: MsgGrantAllowanceAmino; +} +/** MsgGrantAllowanceResponse defines the Msg/GrantAllowanceResponse response type. */ +export interface MsgGrantAllowanceResponse {} +export interface MsgGrantAllowanceResponseProtoMsg { + typeUrl: "/cosmos.feegrant.v1beta1.MsgGrantAllowanceResponse"; + value: Uint8Array; +} +/** MsgGrantAllowanceResponse defines the Msg/GrantAllowanceResponse response type. */ +export interface MsgGrantAllowanceResponseAmino {} +export interface MsgGrantAllowanceResponseAminoMsg { + type: "cosmos-sdk/MsgGrantAllowanceResponse"; + value: MsgGrantAllowanceResponseAmino; +} +/** MsgRevokeAllowance removes any existing Allowance from Granter to Grantee. */ +export interface MsgRevokeAllowance { + /** granter is the address of the user granting an allowance of their funds. */ + granter: string; + /** grantee is the address of the user being granted an allowance of another user's funds. */ + grantee: string; +} +export interface MsgRevokeAllowanceProtoMsg { + typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowance"; + value: Uint8Array; +} +/** MsgRevokeAllowance removes any existing Allowance from Granter to Grantee. */ +export interface MsgRevokeAllowanceAmino { + /** granter is the address of the user granting an allowance of their funds. */ + granter: string; + /** grantee is the address of the user being granted an allowance of another user's funds. */ + grantee: string; +} +export interface MsgRevokeAllowanceAminoMsg { + type: "cosmos-sdk/MsgRevokeAllowance"; + value: MsgRevokeAllowanceAmino; +} +/** MsgRevokeAllowanceResponse defines the Msg/RevokeAllowanceResponse response type. */ +export interface MsgRevokeAllowanceResponse {} +export interface MsgRevokeAllowanceResponseProtoMsg { + typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowanceResponse"; + value: Uint8Array; +} +/** MsgRevokeAllowanceResponse defines the Msg/RevokeAllowanceResponse response type. */ +export interface MsgRevokeAllowanceResponseAmino {} +export interface MsgRevokeAllowanceResponseAminoMsg { + type: "cosmos-sdk/MsgRevokeAllowanceResponse"; + value: MsgRevokeAllowanceResponseAmino; +} +/** + * MsgPruneAllowances prunes expired fee allowances. + * + * Since cosmos-sdk 0.50 + */ +export interface MsgPruneAllowances { + /** pruner is the address of the user pruning expired allowances. */ + pruner: string; +} +export interface MsgPruneAllowancesProtoMsg { + typeUrl: "/cosmos.feegrant.v1beta1.MsgPruneAllowances"; + value: Uint8Array; +} +/** + * MsgPruneAllowances prunes expired fee allowances. + * + * Since cosmos-sdk 0.50 + */ +export interface MsgPruneAllowancesAmino { + /** pruner is the address of the user pruning expired allowances. */ + pruner: string; +} +export interface MsgPruneAllowancesAminoMsg { + type: "cosmos-sdk/MsgPruneAllowances"; + value: MsgPruneAllowancesAmino; +} +/** + * MsgPruneAllowancesResponse defines the Msg/PruneAllowancesResponse response type. + * + * Since cosmos-sdk 0.50 + */ +export interface MsgPruneAllowancesResponse {} +export interface MsgPruneAllowancesResponseProtoMsg { + typeUrl: "/cosmos.feegrant.v1beta1.MsgPruneAllowancesResponse"; + value: Uint8Array; +} +/** + * MsgPruneAllowancesResponse defines the Msg/PruneAllowancesResponse response type. + * + * Since cosmos-sdk 0.50 + */ +export interface MsgPruneAllowancesResponseAmino {} +export interface MsgPruneAllowancesResponseAminoMsg { + type: "cosmos-sdk/MsgPruneAllowancesResponse"; + value: MsgPruneAllowancesResponseAmino; +} +function createBaseMsgGrantAllowance(): MsgGrantAllowance { + return { + granter: "", + grantee: "", + allowance: undefined + }; +} +export const MsgGrantAllowance = { + typeUrl: "/cosmos.feegrant.v1beta1.MsgGrantAllowance", + aminoType: "cosmos-sdk/MsgGrantAllowance", + is(o: any): o is MsgGrantAllowance { + return o && (o.$typeUrl === MsgGrantAllowance.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string"); + }, + isAmino(o: any): o is MsgGrantAllowanceAmino { + return o && (o.$typeUrl === MsgGrantAllowance.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string"); + }, + encode(message: MsgGrantAllowance, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.allowance !== undefined) { + Any.encode(GlobalDecoderRegistry.wrapAny(message.allowance), writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgGrantAllowance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGrantAllowance(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.granter = reader.string(); + break; + case 2: + message.grantee = reader.string(); + break; + case 3: + message.allowance = GlobalDecoderRegistry.unwrapAny(reader); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgGrantAllowance { + const message = createBaseMsgGrantAllowance(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.allowance = object.allowance !== undefined && object.allowance !== null ? GlobalDecoderRegistry.fromPartial(object.allowance) : undefined; + return message; + }, + fromAmino(object: MsgGrantAllowanceAmino): MsgGrantAllowance { + const message = createBaseMsgGrantAllowance(); + if (object.granter !== undefined && object.granter !== null) { + message.granter = object.granter; + } + if (object.grantee !== undefined && object.grantee !== null) { + message.grantee = object.grantee; + } + if (object.allowance !== undefined && object.allowance !== null) { + message.allowance = GlobalDecoderRegistry.fromAminoMsg(object.allowance); + } + return message; + }, + toAmino(message: MsgGrantAllowance): MsgGrantAllowanceAmino { + const obj: any = {}; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; + obj.allowance = message.allowance ? GlobalDecoderRegistry.toAminoMsg(message.allowance) : undefined; + return obj; + }, + fromAminoMsg(object: MsgGrantAllowanceAminoMsg): MsgGrantAllowance { + return MsgGrantAllowance.fromAmino(object.value); + }, + toAminoMsg(message: MsgGrantAllowance): MsgGrantAllowanceAminoMsg { + return { + type: "cosmos-sdk/MsgGrantAllowance", + value: MsgGrantAllowance.toAmino(message) + }; + }, + fromProtoMsg(message: MsgGrantAllowanceProtoMsg): MsgGrantAllowance { + return MsgGrantAllowance.decode(message.value); + }, + toProto(message: MsgGrantAllowance): Uint8Array { + return MsgGrantAllowance.encode(message).finish(); + }, + toProtoMsg(message: MsgGrantAllowance): MsgGrantAllowanceProtoMsg { + return { + typeUrl: "/cosmos.feegrant.v1beta1.MsgGrantAllowance", + value: MsgGrantAllowance.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgGrantAllowance.typeUrl, MsgGrantAllowance); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgGrantAllowance.aminoType, MsgGrantAllowance.typeUrl); +function createBaseMsgGrantAllowanceResponse(): MsgGrantAllowanceResponse { + return {}; +} +export const MsgGrantAllowanceResponse = { + typeUrl: "/cosmos.feegrant.v1beta1.MsgGrantAllowanceResponse", + aminoType: "cosmos-sdk/MsgGrantAllowanceResponse", + is(o: any): o is MsgGrantAllowanceResponse { + return o && o.$typeUrl === MsgGrantAllowanceResponse.typeUrl; + }, + isAmino(o: any): o is MsgGrantAllowanceResponseAmino { + return o && o.$typeUrl === MsgGrantAllowanceResponse.typeUrl; + }, + encode(_: MsgGrantAllowanceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgGrantAllowanceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGrantAllowanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgGrantAllowanceResponse { + const message = createBaseMsgGrantAllowanceResponse(); + return message; + }, + fromAmino(_: MsgGrantAllowanceResponseAmino): MsgGrantAllowanceResponse { + const message = createBaseMsgGrantAllowanceResponse(); + return message; + }, + toAmino(_: MsgGrantAllowanceResponse): MsgGrantAllowanceResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgGrantAllowanceResponseAminoMsg): MsgGrantAllowanceResponse { + return MsgGrantAllowanceResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgGrantAllowanceResponse): MsgGrantAllowanceResponseAminoMsg { + return { + type: "cosmos-sdk/MsgGrantAllowanceResponse", + value: MsgGrantAllowanceResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgGrantAllowanceResponseProtoMsg): MsgGrantAllowanceResponse { + return MsgGrantAllowanceResponse.decode(message.value); + }, + toProto(message: MsgGrantAllowanceResponse): Uint8Array { + return MsgGrantAllowanceResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgGrantAllowanceResponse): MsgGrantAllowanceResponseProtoMsg { + return { + typeUrl: "/cosmos.feegrant.v1beta1.MsgGrantAllowanceResponse", + value: MsgGrantAllowanceResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgGrantAllowanceResponse.typeUrl, MsgGrantAllowanceResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgGrantAllowanceResponse.aminoType, MsgGrantAllowanceResponse.typeUrl); +function createBaseMsgRevokeAllowance(): MsgRevokeAllowance { + return { + granter: "", + grantee: "" + }; +} +export const MsgRevokeAllowance = { + typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowance", + aminoType: "cosmos-sdk/MsgRevokeAllowance", + is(o: any): o is MsgRevokeAllowance { + return o && (o.$typeUrl === MsgRevokeAllowance.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string"); + }, + isAmino(o: any): o is MsgRevokeAllowanceAmino { + return o && (o.$typeUrl === MsgRevokeAllowance.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string"); + }, + encode(message: MsgRevokeAllowance, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgRevokeAllowance { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRevokeAllowance(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.granter = reader.string(); + break; + case 2: + message.grantee = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgRevokeAllowance { + const message = createBaseMsgRevokeAllowance(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + return message; + }, + fromAmino(object: MsgRevokeAllowanceAmino): MsgRevokeAllowance { + const message = createBaseMsgRevokeAllowance(); + if (object.granter !== undefined && object.granter !== null) { + message.granter = object.granter; + } + if (object.grantee !== undefined && object.grantee !== null) { + message.grantee = object.grantee; + } + return message; + }, + toAmino(message: MsgRevokeAllowance): MsgRevokeAllowanceAmino { + const obj: any = {}; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; + return obj; + }, + fromAminoMsg(object: MsgRevokeAllowanceAminoMsg): MsgRevokeAllowance { + return MsgRevokeAllowance.fromAmino(object.value); + }, + toAminoMsg(message: MsgRevokeAllowance): MsgRevokeAllowanceAminoMsg { + return { + type: "cosmos-sdk/MsgRevokeAllowance", + value: MsgRevokeAllowance.toAmino(message) + }; + }, + fromProtoMsg(message: MsgRevokeAllowanceProtoMsg): MsgRevokeAllowance { + return MsgRevokeAllowance.decode(message.value); + }, + toProto(message: MsgRevokeAllowance): Uint8Array { + return MsgRevokeAllowance.encode(message).finish(); + }, + toProtoMsg(message: MsgRevokeAllowance): MsgRevokeAllowanceProtoMsg { + return { + typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowance", + value: MsgRevokeAllowance.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgRevokeAllowance.typeUrl, MsgRevokeAllowance); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgRevokeAllowance.aminoType, MsgRevokeAllowance.typeUrl); +function createBaseMsgRevokeAllowanceResponse(): MsgRevokeAllowanceResponse { + return {}; +} +export const MsgRevokeAllowanceResponse = { + typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowanceResponse", + aminoType: "cosmos-sdk/MsgRevokeAllowanceResponse", + is(o: any): o is MsgRevokeAllowanceResponse { + return o && o.$typeUrl === MsgRevokeAllowanceResponse.typeUrl; + }, + isAmino(o: any): o is MsgRevokeAllowanceResponseAmino { + return o && o.$typeUrl === MsgRevokeAllowanceResponse.typeUrl; + }, + encode(_: MsgRevokeAllowanceResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgRevokeAllowanceResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRevokeAllowanceResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgRevokeAllowanceResponse { + const message = createBaseMsgRevokeAllowanceResponse(); + return message; + }, + fromAmino(_: MsgRevokeAllowanceResponseAmino): MsgRevokeAllowanceResponse { + const message = createBaseMsgRevokeAllowanceResponse(); + return message; + }, + toAmino(_: MsgRevokeAllowanceResponse): MsgRevokeAllowanceResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgRevokeAllowanceResponseAminoMsg): MsgRevokeAllowanceResponse { + return MsgRevokeAllowanceResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgRevokeAllowanceResponse): MsgRevokeAllowanceResponseAminoMsg { + return { + type: "cosmos-sdk/MsgRevokeAllowanceResponse", + value: MsgRevokeAllowanceResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgRevokeAllowanceResponseProtoMsg): MsgRevokeAllowanceResponse { + return MsgRevokeAllowanceResponse.decode(message.value); + }, + toProto(message: MsgRevokeAllowanceResponse): Uint8Array { + return MsgRevokeAllowanceResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgRevokeAllowanceResponse): MsgRevokeAllowanceResponseProtoMsg { + return { + typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowanceResponse", + value: MsgRevokeAllowanceResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgRevokeAllowanceResponse.typeUrl, MsgRevokeAllowanceResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgRevokeAllowanceResponse.aminoType, MsgRevokeAllowanceResponse.typeUrl); +function createBaseMsgPruneAllowances(): MsgPruneAllowances { + return { + pruner: "" + }; +} +export const MsgPruneAllowances = { + typeUrl: "/cosmos.feegrant.v1beta1.MsgPruneAllowances", + aminoType: "cosmos-sdk/MsgPruneAllowances", + is(o: any): o is MsgPruneAllowances { + return o && (o.$typeUrl === MsgPruneAllowances.typeUrl || typeof o.pruner === "string"); + }, + isAmino(o: any): o is MsgPruneAllowancesAmino { + return o && (o.$typeUrl === MsgPruneAllowances.typeUrl || typeof o.pruner === "string"); + }, + encode(message: MsgPruneAllowances, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.pruner !== "") { + writer.uint32(10).string(message.pruner); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgPruneAllowances { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgPruneAllowances(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pruner = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgPruneAllowances { + const message = createBaseMsgPruneAllowances(); + message.pruner = object.pruner ?? ""; + return message; + }, + fromAmino(object: MsgPruneAllowancesAmino): MsgPruneAllowances { + const message = createBaseMsgPruneAllowances(); + if (object.pruner !== undefined && object.pruner !== null) { + message.pruner = object.pruner; + } + return message; + }, + toAmino(message: MsgPruneAllowances): MsgPruneAllowancesAmino { + const obj: any = {}; + obj.pruner = message.pruner === "" ? undefined : message.pruner; + return obj; + }, + fromAminoMsg(object: MsgPruneAllowancesAminoMsg): MsgPruneAllowances { + return MsgPruneAllowances.fromAmino(object.value); + }, + toAminoMsg(message: MsgPruneAllowances): MsgPruneAllowancesAminoMsg { + return { + type: "cosmos-sdk/MsgPruneAllowances", + value: MsgPruneAllowances.toAmino(message) + }; + }, + fromProtoMsg(message: MsgPruneAllowancesProtoMsg): MsgPruneAllowances { + return MsgPruneAllowances.decode(message.value); + }, + toProto(message: MsgPruneAllowances): Uint8Array { + return MsgPruneAllowances.encode(message).finish(); + }, + toProtoMsg(message: MsgPruneAllowances): MsgPruneAllowancesProtoMsg { + return { + typeUrl: "/cosmos.feegrant.v1beta1.MsgPruneAllowances", + value: MsgPruneAllowances.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgPruneAllowances.typeUrl, MsgPruneAllowances); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgPruneAllowances.aminoType, MsgPruneAllowances.typeUrl); +function createBaseMsgPruneAllowancesResponse(): MsgPruneAllowancesResponse { + return {}; +} +export const MsgPruneAllowancesResponse = { + typeUrl: "/cosmos.feegrant.v1beta1.MsgPruneAllowancesResponse", + aminoType: "cosmos-sdk/MsgPruneAllowancesResponse", + is(o: any): o is MsgPruneAllowancesResponse { + return o && o.$typeUrl === MsgPruneAllowancesResponse.typeUrl; + }, + isAmino(o: any): o is MsgPruneAllowancesResponseAmino { + return o && o.$typeUrl === MsgPruneAllowancesResponse.typeUrl; + }, + encode(_: MsgPruneAllowancesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgPruneAllowancesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgPruneAllowancesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgPruneAllowancesResponse { + const message = createBaseMsgPruneAllowancesResponse(); + return message; + }, + fromAmino(_: MsgPruneAllowancesResponseAmino): MsgPruneAllowancesResponse { + const message = createBaseMsgPruneAllowancesResponse(); + return message; + }, + toAmino(_: MsgPruneAllowancesResponse): MsgPruneAllowancesResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgPruneAllowancesResponseAminoMsg): MsgPruneAllowancesResponse { + return MsgPruneAllowancesResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgPruneAllowancesResponse): MsgPruneAllowancesResponseAminoMsg { + return { + type: "cosmos-sdk/MsgPruneAllowancesResponse", + value: MsgPruneAllowancesResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgPruneAllowancesResponseProtoMsg): MsgPruneAllowancesResponse { + return MsgPruneAllowancesResponse.decode(message.value); + }, + toProto(message: MsgPruneAllowancesResponse): Uint8Array { + return MsgPruneAllowancesResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgPruneAllowancesResponse): MsgPruneAllowancesResponseProtoMsg { + return { + typeUrl: "/cosmos.feegrant.v1beta1.MsgPruneAllowancesResponse", + value: MsgPruneAllowancesResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgPruneAllowancesResponse.typeUrl, MsgPruneAllowancesResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgPruneAllowancesResponse.aminoType, MsgPruneAllowancesResponse.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/gov/v1/gov.ts b/libs/interchain-query/src/cosmos/gov/v1/gov.ts new file mode 100644 index 00000000..434920f3 --- /dev/null +++ b/libs/interchain-query/src/cosmos/gov/v1/gov.ts @@ -0,0 +1,1843 @@ +import { Coin, CoinAmino } from "../../base/v1beta1/coin"; +import { Any, AnyAmino } from "../../../google/protobuf/any"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Duration, DurationAmino } from "../../../google/protobuf/duration"; +import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; +/** VoteOption enumerates the valid vote options for a given governance proposal. */ +export enum VoteOption { + /** VOTE_OPTION_UNSPECIFIED - VOTE_OPTION_UNSPECIFIED defines a no-op vote option. */ + VOTE_OPTION_UNSPECIFIED = 0, + /** VOTE_OPTION_YES - VOTE_OPTION_YES defines a yes vote option. */ + VOTE_OPTION_YES = 1, + /** VOTE_OPTION_ABSTAIN - VOTE_OPTION_ABSTAIN defines an abstain vote option. */ + VOTE_OPTION_ABSTAIN = 2, + /** VOTE_OPTION_NO - VOTE_OPTION_NO defines a no vote option. */ + VOTE_OPTION_NO = 3, + /** VOTE_OPTION_NO_WITH_VETO - VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. */ + VOTE_OPTION_NO_WITH_VETO = 4, + UNRECOGNIZED = -1, +} +export const VoteOptionAmino = VoteOption; +export function voteOptionFromJSON(object: any): VoteOption { + switch (object) { + case 0: + case "VOTE_OPTION_UNSPECIFIED": + return VoteOption.VOTE_OPTION_UNSPECIFIED; + case 1: + case "VOTE_OPTION_YES": + return VoteOption.VOTE_OPTION_YES; + case 2: + case "VOTE_OPTION_ABSTAIN": + return VoteOption.VOTE_OPTION_ABSTAIN; + case 3: + case "VOTE_OPTION_NO": + return VoteOption.VOTE_OPTION_NO; + case 4: + case "VOTE_OPTION_NO_WITH_VETO": + return VoteOption.VOTE_OPTION_NO_WITH_VETO; + case -1: + case "UNRECOGNIZED": + default: + return VoteOption.UNRECOGNIZED; + } +} +export function voteOptionToJSON(object: VoteOption): string { + switch (object) { + case VoteOption.VOTE_OPTION_UNSPECIFIED: + return "VOTE_OPTION_UNSPECIFIED"; + case VoteOption.VOTE_OPTION_YES: + return "VOTE_OPTION_YES"; + case VoteOption.VOTE_OPTION_ABSTAIN: + return "VOTE_OPTION_ABSTAIN"; + case VoteOption.VOTE_OPTION_NO: + return "VOTE_OPTION_NO"; + case VoteOption.VOTE_OPTION_NO_WITH_VETO: + return "VOTE_OPTION_NO_WITH_VETO"; + case VoteOption.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** ProposalStatus enumerates the valid statuses of a proposal. */ +export enum ProposalStatus { + /** PROPOSAL_STATUS_UNSPECIFIED - PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status. */ + PROPOSAL_STATUS_UNSPECIFIED = 0, + /** + * PROPOSAL_STATUS_DEPOSIT_PERIOD - PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit + * period. + */ + PROPOSAL_STATUS_DEPOSIT_PERIOD = 1, + /** + * PROPOSAL_STATUS_VOTING_PERIOD - PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting + * period. + */ + PROPOSAL_STATUS_VOTING_PERIOD = 2, + /** + * PROPOSAL_STATUS_PASSED - PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has + * passed. + */ + PROPOSAL_STATUS_PASSED = 3, + /** + * PROPOSAL_STATUS_REJECTED - PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has + * been rejected. + */ + PROPOSAL_STATUS_REJECTED = 4, + /** + * PROPOSAL_STATUS_FAILED - PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has + * failed. + */ + PROPOSAL_STATUS_FAILED = 5, + UNRECOGNIZED = -1, +} +export const ProposalStatusAmino = ProposalStatus; +export function proposalStatusFromJSON(object: any): ProposalStatus { + switch (object) { + case 0: + case "PROPOSAL_STATUS_UNSPECIFIED": + return ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED; + case 1: + case "PROPOSAL_STATUS_DEPOSIT_PERIOD": + return ProposalStatus.PROPOSAL_STATUS_DEPOSIT_PERIOD; + case 2: + case "PROPOSAL_STATUS_VOTING_PERIOD": + return ProposalStatus.PROPOSAL_STATUS_VOTING_PERIOD; + case 3: + case "PROPOSAL_STATUS_PASSED": + return ProposalStatus.PROPOSAL_STATUS_PASSED; + case 4: + case "PROPOSAL_STATUS_REJECTED": + return ProposalStatus.PROPOSAL_STATUS_REJECTED; + case 5: + case "PROPOSAL_STATUS_FAILED": + return ProposalStatus.PROPOSAL_STATUS_FAILED; + case -1: + case "UNRECOGNIZED": + default: + return ProposalStatus.UNRECOGNIZED; + } +} +export function proposalStatusToJSON(object: ProposalStatus): string { + switch (object) { + case ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED: + return "PROPOSAL_STATUS_UNSPECIFIED"; + case ProposalStatus.PROPOSAL_STATUS_DEPOSIT_PERIOD: + return "PROPOSAL_STATUS_DEPOSIT_PERIOD"; + case ProposalStatus.PROPOSAL_STATUS_VOTING_PERIOD: + return "PROPOSAL_STATUS_VOTING_PERIOD"; + case ProposalStatus.PROPOSAL_STATUS_PASSED: + return "PROPOSAL_STATUS_PASSED"; + case ProposalStatus.PROPOSAL_STATUS_REJECTED: + return "PROPOSAL_STATUS_REJECTED"; + case ProposalStatus.PROPOSAL_STATUS_FAILED: + return "PROPOSAL_STATUS_FAILED"; + case ProposalStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** WeightedVoteOption defines a unit of vote for vote split. */ +export interface WeightedVoteOption { + /** option defines the valid vote options, it must not contain duplicate vote options. */ + option: VoteOption; + /** weight is the vote weight associated with the vote option. */ + weight: string; +} +export interface WeightedVoteOptionProtoMsg { + typeUrl: "/cosmos.gov.v1.WeightedVoteOption"; + value: Uint8Array; +} +/** WeightedVoteOption defines a unit of vote for vote split. */ +export interface WeightedVoteOptionAmino { + /** option defines the valid vote options, it must not contain duplicate vote options. */ + option: VoteOption; + /** weight is the vote weight associated with the vote option. */ + weight: string; +} +export interface WeightedVoteOptionAminoMsg { + type: "cosmos-sdk/v1/WeightedVoteOption"; + value: WeightedVoteOptionAmino; +} +/** + * Deposit defines an amount deposited by an account address to an active + * proposal. + */ +export interface Deposit { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** amount to be deposited by depositor. */ + amount: Coin[]; +} +export interface DepositProtoMsg { + typeUrl: "/cosmos.gov.v1.Deposit"; + value: Uint8Array; +} +/** + * Deposit defines an amount deposited by an account address to an active + * proposal. + */ +export interface DepositAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** amount to be deposited by depositor. */ + amount: CoinAmino[]; +} +export interface DepositAminoMsg { + type: "cosmos-sdk/v1/Deposit"; + value: DepositAmino; +} +/** Proposal defines the core field members of a governance proposal. */ +export interface Proposal { + /** id defines the unique id of the proposal. */ + id: bigint; + /** messages are the arbitrary messages to be executed if the proposal passes. */ + messages: Any[]; + /** status defines the proposal status. */ + status: ProposalStatus; + /** + * final_tally_result is the final tally result of the proposal. When + * querying a proposal via gRPC, this field is not populated until the + * proposal's voting period has ended. + */ + finalTallyResult?: TallyResult; + /** submit_time is the time of proposal submission. */ + submitTime?: Date; + /** deposit_end_time is the end time for deposition. */ + depositEndTime?: Date; + /** total_deposit is the total deposit on the proposal. */ + totalDeposit: Coin[]; + /** voting_start_time is the starting time to vote on a proposal. */ + votingStartTime?: Date; + /** voting_end_time is the end time of voting on a proposal. */ + votingEndTime?: Date; + /** + * metadata is any arbitrary metadata attached to the proposal. + * the recommended format of the metadata is to be found here: + * https://docs.cosmos.network/v0.47/modules/gov#proposal-3 + */ + metadata: string; + /** + * title is the title of the proposal + * + * Since: cosmos-sdk 0.47 + */ + title: string; + /** + * summary is a short summary of the proposal + * + * Since: cosmos-sdk 0.47 + */ + summary: string; + /** + * proposer is the address of the proposal sumbitter + * + * Since: cosmos-sdk 0.47 + */ + proposer: string; + /** + * expedited defines if the proposal is expedited + * + * Since: cosmos-sdk 0.50 + */ + expedited: boolean; + /** + * failed_reason defines the reason why the proposal failed + * + * Since: cosmos-sdk 0.50 + */ + failedReason: string; +} +export interface ProposalProtoMsg { + typeUrl: "/cosmos.gov.v1.Proposal"; + value: Uint8Array; +} +/** Proposal defines the core field members of a governance proposal. */ +export interface ProposalAmino { + /** id defines the unique id of the proposal. */ + id: string; + /** messages are the arbitrary messages to be executed if the proposal passes. */ + messages: AnyAmino[]; + /** status defines the proposal status. */ + status: ProposalStatus; + /** + * final_tally_result is the final tally result of the proposal. When + * querying a proposal via gRPC, this field is not populated until the + * proposal's voting period has ended. + */ + final_tally_result?: TallyResultAmino; + /** submit_time is the time of proposal submission. */ + submit_time?: string; + /** deposit_end_time is the end time for deposition. */ + deposit_end_time?: string; + /** total_deposit is the total deposit on the proposal. */ + total_deposit: CoinAmino[]; + /** voting_start_time is the starting time to vote on a proposal. */ + voting_start_time?: string; + /** voting_end_time is the end time of voting on a proposal. */ + voting_end_time?: string; + /** + * metadata is any arbitrary metadata attached to the proposal. + * the recommended format of the metadata is to be found here: + * https://docs.cosmos.network/v0.47/modules/gov#proposal-3 + */ + metadata: string; + /** + * title is the title of the proposal + * + * Since: cosmos-sdk 0.47 + */ + title: string; + /** + * summary is a short summary of the proposal + * + * Since: cosmos-sdk 0.47 + */ + summary: string; + /** + * proposer is the address of the proposal sumbitter + * + * Since: cosmos-sdk 0.47 + */ + proposer: string; + /** + * expedited defines if the proposal is expedited + * + * Since: cosmos-sdk 0.50 + */ + expedited: boolean; + /** + * failed_reason defines the reason why the proposal failed + * + * Since: cosmos-sdk 0.50 + */ + failed_reason: string; +} +export interface ProposalAminoMsg { + type: "cosmos-sdk/v1/Proposal"; + value: ProposalAmino; +} +/** TallyResult defines a standard tally for a governance proposal. */ +export interface TallyResult { + /** yes_count is the number of yes votes on a proposal. */ + yesCount: string; + /** abstain_count is the number of abstain votes on a proposal. */ + abstainCount: string; + /** no_count is the number of no votes on a proposal. */ + noCount: string; + /** no_with_veto_count is the number of no with veto votes on a proposal. */ + noWithVetoCount: string; +} +export interface TallyResultProtoMsg { + typeUrl: "/cosmos.gov.v1.TallyResult"; + value: Uint8Array; +} +/** TallyResult defines a standard tally for a governance proposal. */ +export interface TallyResultAmino { + /** yes_count is the number of yes votes on a proposal. */ + yes_count: string; + /** abstain_count is the number of abstain votes on a proposal. */ + abstain_count: string; + /** no_count is the number of no votes on a proposal. */ + no_count: string; + /** no_with_veto_count is the number of no with veto votes on a proposal. */ + no_with_veto_count: string; +} +export interface TallyResultAminoMsg { + type: "cosmos-sdk/v1/TallyResult"; + value: TallyResultAmino; +} +/** + * Vote defines a vote on a governance proposal. + * A Vote consists of a proposal ID, the voter, and the vote option. + */ +export interface Vote { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; + /** voter is the voter address of the proposal. */ + voter: string; + /** options is the weighted vote options. */ + options: WeightedVoteOption[]; + /** + * metadata is any arbitrary metadata attached to the vote. + * the recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/gov#vote-5 + */ + metadata: string; +} +export interface VoteProtoMsg { + typeUrl: "/cosmos.gov.v1.Vote"; + value: Uint8Array; +} +/** + * Vote defines a vote on a governance proposal. + * A Vote consists of a proposal ID, the voter, and the vote option. + */ +export interface VoteAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** voter is the voter address of the proposal. */ + voter: string; + /** options is the weighted vote options. */ + options: WeightedVoteOptionAmino[]; + /** + * metadata is any arbitrary metadata attached to the vote. + * the recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/gov#vote-5 + */ + metadata: string; +} +export interface VoteAminoMsg { + type: "cosmos-sdk/v1/Vote"; + value: VoteAmino; +} +/** DepositParams defines the params for deposits on governance proposals. */ +/** @deprecated */ +export interface DepositParams { + /** Minimum deposit for a proposal to enter voting period. */ + minDeposit: Coin[]; + /** + * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + * months. + */ + maxDepositPeriod?: Duration; +} +export interface DepositParamsProtoMsg { + typeUrl: "/cosmos.gov.v1.DepositParams"; + value: Uint8Array; +} +/** DepositParams defines the params for deposits on governance proposals. */ +/** @deprecated */ +export interface DepositParamsAmino { + /** Minimum deposit for a proposal to enter voting period. */ + min_deposit: CoinAmino[]; + /** + * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + * months. + */ + max_deposit_period?: DurationAmino; +} +export interface DepositParamsAminoMsg { + type: "cosmos-sdk/v1/DepositParams"; + value: DepositParamsAmino; +} +/** VotingParams defines the params for voting on governance proposals. */ +/** @deprecated */ +export interface VotingParams { + /** Duration of the voting period. */ + votingPeriod?: Duration; +} +export interface VotingParamsProtoMsg { + typeUrl: "/cosmos.gov.v1.VotingParams"; + value: Uint8Array; +} +/** VotingParams defines the params for voting on governance proposals. */ +/** @deprecated */ +export interface VotingParamsAmino { + /** Duration of the voting period. */ + voting_period?: DurationAmino; +} +export interface VotingParamsAminoMsg { + type: "cosmos-sdk/v1/VotingParams"; + value: VotingParamsAmino; +} +/** TallyParams defines the params for tallying votes on governance proposals. */ +/** @deprecated */ +export interface TallyParams { + /** + * Minimum percentage of total stake needed to vote for a result to be + * considered valid. + */ + quorum: string; + /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. */ + threshold: string; + /** + * Minimum value of Veto votes to Total votes ratio for proposal to be + * vetoed. Default value: 1/3. + */ + vetoThreshold: string; +} +export interface TallyParamsProtoMsg { + typeUrl: "/cosmos.gov.v1.TallyParams"; + value: Uint8Array; +} +/** TallyParams defines the params for tallying votes on governance proposals. */ +/** @deprecated */ +export interface TallyParamsAmino { + /** + * Minimum percentage of total stake needed to vote for a result to be + * considered valid. + */ + quorum: string; + /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. */ + threshold: string; + /** + * Minimum value of Veto votes to Total votes ratio for proposal to be + * vetoed. Default value: 1/3. + */ + veto_threshold: string; +} +export interface TallyParamsAminoMsg { + type: "cosmos-sdk/v1/TallyParams"; + value: TallyParamsAmino; +} +/** + * Params defines the parameters for the x/gov module. + * + * Since: cosmos-sdk 0.47 + */ +export interface Params { + /** Minimum deposit for a proposal to enter voting period. */ + minDeposit: Coin[]; + /** + * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + * months. + */ + maxDepositPeriod?: Duration; + /** Duration of the voting period. */ + votingPeriod?: Duration; + /** + * Minimum percentage of total stake needed to vote for a result to be + * considered valid. + */ + quorum: string; + /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. */ + threshold: string; + /** + * Minimum value of Veto votes to Total votes ratio for proposal to be + * vetoed. Default value: 1/3. + */ + vetoThreshold: string; + /** The ratio representing the proportion of the deposit value that must be paid at proposal submission. */ + minInitialDepositRatio: string; + /** + * The cancel ratio which will not be returned back to the depositors when a proposal is cancelled. + * + * Since: cosmos-sdk 0.50 + */ + proposalCancelRatio: string; + /** + * The address which will receive (proposal_cancel_ratio * deposit) proposal deposits. + * If empty, the (proposal_cancel_ratio * deposit) proposal deposits will be burned. + * + * Since: cosmos-sdk 0.50 + */ + proposalCancelDest: string; + /** + * Duration of the voting period of an expedited proposal. + * + * Since: cosmos-sdk 0.50 + */ + expeditedVotingPeriod?: Duration; + /** + * Minimum proportion of Yes votes for proposal to pass. Default value: 0.67. + * + * Since: cosmos-sdk 0.50 + */ + expeditedThreshold: string; + /** Minimum expedited deposit for a proposal to enter voting period. */ + expeditedMinDeposit: Coin[]; + /** burn deposits if a proposal does not meet quorum */ + burnVoteQuorum: boolean; + /** burn deposits if the proposal does not enter voting period */ + burnProposalDepositPrevote: boolean; + /** burn deposits if quorum with vote type no_veto is met */ + burnVoteVeto: boolean; + /** + * The ratio representing the proportion of the deposit value minimum that must be met when making a deposit. + * Default value: 0.01. Meaning that for a chain with a min_deposit of 100stake, a deposit of 1stake would be + * required. + * + * Since: cosmos-sdk 0.50 + */ + minDepositRatio: string; +} +export interface ParamsProtoMsg { + typeUrl: "/cosmos.gov.v1.Params"; + value: Uint8Array; +} +/** + * Params defines the parameters for the x/gov module. + * + * Since: cosmos-sdk 0.47 + */ +export interface ParamsAmino { + /** Minimum deposit for a proposal to enter voting period. */ + min_deposit: CoinAmino[]; + /** + * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + * months. + */ + max_deposit_period?: DurationAmino; + /** Duration of the voting period. */ + voting_period?: DurationAmino; + /** + * Minimum percentage of total stake needed to vote for a result to be + * considered valid. + */ + quorum: string; + /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. */ + threshold: string; + /** + * Minimum value of Veto votes to Total votes ratio for proposal to be + * vetoed. Default value: 1/3. + */ + veto_threshold: string; + /** The ratio representing the proportion of the deposit value that must be paid at proposal submission. */ + min_initial_deposit_ratio: string; + /** + * The cancel ratio which will not be returned back to the depositors when a proposal is cancelled. + * + * Since: cosmos-sdk 0.50 + */ + proposal_cancel_ratio: string; + /** + * The address which will receive (proposal_cancel_ratio * deposit) proposal deposits. + * If empty, the (proposal_cancel_ratio * deposit) proposal deposits will be burned. + * + * Since: cosmos-sdk 0.50 + */ + proposal_cancel_dest: string; + /** + * Duration of the voting period of an expedited proposal. + * + * Since: cosmos-sdk 0.50 + */ + expedited_voting_period?: DurationAmino; + /** + * Minimum proportion of Yes votes for proposal to pass. Default value: 0.67. + * + * Since: cosmos-sdk 0.50 + */ + expedited_threshold: string; + /** Minimum expedited deposit for a proposal to enter voting period. */ + expedited_min_deposit: CoinAmino[]; + /** burn deposits if a proposal does not meet quorum */ + burn_vote_quorum: boolean; + /** burn deposits if the proposal does not enter voting period */ + burn_proposal_deposit_prevote: boolean; + /** burn deposits if quorum with vote type no_veto is met */ + burn_vote_veto: boolean; + /** + * The ratio representing the proportion of the deposit value minimum that must be met when making a deposit. + * Default value: 0.01. Meaning that for a chain with a min_deposit of 100stake, a deposit of 1stake would be + * required. + * + * Since: cosmos-sdk 0.50 + */ + min_deposit_ratio: string; +} +export interface ParamsAminoMsg { + type: "cosmos-sdk/v1/Params"; + value: ParamsAmino; +} +function createBaseWeightedVoteOption(): WeightedVoteOption { + return { + option: 0, + weight: "" + }; +} +export const WeightedVoteOption = { + typeUrl: "/cosmos.gov.v1.WeightedVoteOption", + aminoType: "cosmos-sdk/v1/WeightedVoteOption", + is(o: any): o is WeightedVoteOption { + return o && (o.$typeUrl === WeightedVoteOption.typeUrl || isSet(o.option) && typeof o.weight === "string"); + }, + isAmino(o: any): o is WeightedVoteOptionAmino { + return o && (o.$typeUrl === WeightedVoteOption.typeUrl || isSet(o.option) && typeof o.weight === "string"); + }, + encode(message: WeightedVoteOption, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.option !== 0) { + writer.uint32(8).int32(message.option); + } + if (message.weight !== "") { + writer.uint32(18).string(message.weight); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): WeightedVoteOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWeightedVoteOption(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.option = (reader.int32() as any); + break; + case 2: + message.weight = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): WeightedVoteOption { + const message = createBaseWeightedVoteOption(); + message.option = object.option ?? 0; + message.weight = object.weight ?? ""; + return message; + }, + fromAmino(object: WeightedVoteOptionAmino): WeightedVoteOption { + const message = createBaseWeightedVoteOption(); + if (object.option !== undefined && object.option !== null) { + message.option = object.option; + } + if (object.weight !== undefined && object.weight !== null) { + message.weight = object.weight; + } + return message; + }, + toAmino(message: WeightedVoteOption): WeightedVoteOptionAmino { + const obj: any = {}; + obj.option = message.option === 0 ? undefined : message.option; + obj.weight = message.weight === "" ? undefined : message.weight; + return obj; + }, + fromAminoMsg(object: WeightedVoteOptionAminoMsg): WeightedVoteOption { + return WeightedVoteOption.fromAmino(object.value); + }, + toAminoMsg(message: WeightedVoteOption): WeightedVoteOptionAminoMsg { + return { + type: "cosmos-sdk/v1/WeightedVoteOption", + value: WeightedVoteOption.toAmino(message) + }; + }, + fromProtoMsg(message: WeightedVoteOptionProtoMsg): WeightedVoteOption { + return WeightedVoteOption.decode(message.value); + }, + toProto(message: WeightedVoteOption): Uint8Array { + return WeightedVoteOption.encode(message).finish(); + }, + toProtoMsg(message: WeightedVoteOption): WeightedVoteOptionProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.WeightedVoteOption", + value: WeightedVoteOption.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(WeightedVoteOption.typeUrl, WeightedVoteOption); +GlobalDecoderRegistry.registerAminoProtoMapping(WeightedVoteOption.aminoType, WeightedVoteOption.typeUrl); +function createBaseDeposit(): Deposit { + return { + proposalId: BigInt(0), + depositor: "", + amount: [] + }; +} +export const Deposit = { + typeUrl: "/cosmos.gov.v1.Deposit", + aminoType: "cosmos-sdk/v1/Deposit", + is(o: any): o is Deposit { + return o && (o.$typeUrl === Deposit.typeUrl || typeof o.proposalId === "bigint" && typeof o.depositor === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0]))); + }, + isAmino(o: any): o is DepositAmino { + return o && (o.$typeUrl === Deposit.typeUrl || typeof o.proposal_id === "bigint" && typeof o.depositor === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0]))); + }, + encode(message: Deposit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Deposit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.depositor = reader.string(); + break; + case 3: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Deposit { + const message = createBaseDeposit(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: DepositAmino): Deposit { + const message = createBaseDeposit(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.depositor !== undefined && object.depositor !== null) { + message.depositor = object.depositor; + } + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: Deposit): DepositAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId?.toString() : undefined; + obj.depositor = message.depositor === "" ? undefined : message.depositor; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = message.amount; + } + return obj; + }, + fromAminoMsg(object: DepositAminoMsg): Deposit { + return Deposit.fromAmino(object.value); + }, + toAminoMsg(message: Deposit): DepositAminoMsg { + return { + type: "cosmos-sdk/v1/Deposit", + value: Deposit.toAmino(message) + }; + }, + fromProtoMsg(message: DepositProtoMsg): Deposit { + return Deposit.decode(message.value); + }, + toProto(message: Deposit): Uint8Array { + return Deposit.encode(message).finish(); + }, + toProtoMsg(message: Deposit): DepositProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.Deposit", + value: Deposit.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Deposit.typeUrl, Deposit); +GlobalDecoderRegistry.registerAminoProtoMapping(Deposit.aminoType, Deposit.typeUrl); +function createBaseProposal(): Proposal { + return { + id: BigInt(0), + messages: [], + status: 0, + finalTallyResult: undefined, + submitTime: undefined, + depositEndTime: undefined, + totalDeposit: [], + votingStartTime: undefined, + votingEndTime: undefined, + metadata: "", + title: "", + summary: "", + proposer: "", + expedited: false, + failedReason: "" + }; +} +export const Proposal = { + typeUrl: "/cosmos.gov.v1.Proposal", + aminoType: "cosmos-sdk/v1/Proposal", + is(o: any): o is Proposal { + return o && (o.$typeUrl === Proposal.typeUrl || typeof o.id === "bigint" && Array.isArray(o.messages) && (!o.messages.length || Any.is(o.messages[0])) && isSet(o.status) && Array.isArray(o.totalDeposit) && (!o.totalDeposit.length || Coin.is(o.totalDeposit[0])) && typeof o.metadata === "string" && typeof o.title === "string" && typeof o.summary === "string" && typeof o.proposer === "string" && typeof o.expedited === "boolean" && typeof o.failedReason === "string"); + }, + isAmino(o: any): o is ProposalAmino { + return o && (o.$typeUrl === Proposal.typeUrl || typeof o.id === "bigint" && Array.isArray(o.messages) && (!o.messages.length || Any.isAmino(o.messages[0])) && isSet(o.status) && Array.isArray(o.total_deposit) && (!o.total_deposit.length || Coin.isAmino(o.total_deposit[0])) && typeof o.metadata === "string" && typeof o.title === "string" && typeof o.summary === "string" && typeof o.proposer === "string" && typeof o.expedited === "boolean" && typeof o.failed_reason === "string"); + }, + encode(message: Proposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.id !== BigInt(0)) { + writer.uint32(8).uint64(message.id); + } + for (const v of message.messages) { + Any.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.status !== 0) { + writer.uint32(24).int32(message.status); + } + if (message.finalTallyResult !== undefined) { + TallyResult.encode(message.finalTallyResult, writer.uint32(34).fork()).ldelim(); + } + if (message.submitTime !== undefined) { + Timestamp.encode(toTimestamp(message.submitTime), writer.uint32(42).fork()).ldelim(); + } + if (message.depositEndTime !== undefined) { + Timestamp.encode(toTimestamp(message.depositEndTime), writer.uint32(50).fork()).ldelim(); + } + for (const v of message.totalDeposit) { + Coin.encode(v!, writer.uint32(58).fork()).ldelim(); + } + if (message.votingStartTime !== undefined) { + Timestamp.encode(toTimestamp(message.votingStartTime), writer.uint32(66).fork()).ldelim(); + } + if (message.votingEndTime !== undefined) { + Timestamp.encode(toTimestamp(message.votingEndTime), writer.uint32(74).fork()).ldelim(); + } + if (message.metadata !== "") { + writer.uint32(82).string(message.metadata); + } + if (message.title !== "") { + writer.uint32(90).string(message.title); + } + if (message.summary !== "") { + writer.uint32(98).string(message.summary); + } + if (message.proposer !== "") { + writer.uint32(106).string(message.proposer); + } + if (message.expedited === true) { + writer.uint32(112).bool(message.expedited); + } + if (message.failedReason !== "") { + writer.uint32(122).string(message.failedReason); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Proposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.uint64(); + break; + case 2: + message.messages.push(Any.decode(reader, reader.uint32())); + break; + case 3: + message.status = (reader.int32() as any); + break; + case 4: + message.finalTallyResult = TallyResult.decode(reader, reader.uint32()); + break; + case 5: + message.submitTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 6: + message.depositEndTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 7: + message.totalDeposit.push(Coin.decode(reader, reader.uint32())); + break; + case 8: + message.votingStartTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 9: + message.votingEndTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 10: + message.metadata = reader.string(); + break; + case 11: + message.title = reader.string(); + break; + case 12: + message.summary = reader.string(); + break; + case 13: + message.proposer = reader.string(); + break; + case 14: + message.expedited = reader.bool(); + break; + case 15: + message.failedReason = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Proposal { + const message = createBaseProposal(); + message.id = object.id !== undefined && object.id !== null ? BigInt(object.id.toString()) : BigInt(0); + message.messages = object.messages?.map(e => Any.fromPartial(e)) || []; + message.status = object.status ?? 0; + message.finalTallyResult = object.finalTallyResult !== undefined && object.finalTallyResult !== null ? TallyResult.fromPartial(object.finalTallyResult) : undefined; + message.submitTime = object.submitTime ?? undefined; + message.depositEndTime = object.depositEndTime ?? undefined; + message.totalDeposit = object.totalDeposit?.map(e => Coin.fromPartial(e)) || []; + message.votingStartTime = object.votingStartTime ?? undefined; + message.votingEndTime = object.votingEndTime ?? undefined; + message.metadata = object.metadata ?? ""; + message.title = object.title ?? ""; + message.summary = object.summary ?? ""; + message.proposer = object.proposer ?? ""; + message.expedited = object.expedited ?? false; + message.failedReason = object.failedReason ?? ""; + return message; + }, + fromAmino(object: ProposalAmino): Proposal { + const message = createBaseProposal(); + if (object.id !== undefined && object.id !== null) { + message.id = BigInt(object.id); + } + message.messages = object.messages?.map(e => Any.fromAmino(e)) || []; + if (object.status !== undefined && object.status !== null) { + message.status = object.status; + } + if (object.final_tally_result !== undefined && object.final_tally_result !== null) { + message.finalTallyResult = TallyResult.fromAmino(object.final_tally_result); + } + if (object.submit_time !== undefined && object.submit_time !== null) { + message.submitTime = fromTimestamp(Timestamp.fromAmino(object.submit_time)); + } + if (object.deposit_end_time !== undefined && object.deposit_end_time !== null) { + message.depositEndTime = fromTimestamp(Timestamp.fromAmino(object.deposit_end_time)); + } + message.totalDeposit = object.total_deposit?.map(e => Coin.fromAmino(e)) || []; + if (object.voting_start_time !== undefined && object.voting_start_time !== null) { + message.votingStartTime = fromTimestamp(Timestamp.fromAmino(object.voting_start_time)); + } + if (object.voting_end_time !== undefined && object.voting_end_time !== null) { + message.votingEndTime = fromTimestamp(Timestamp.fromAmino(object.voting_end_time)); + } + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.summary !== undefined && object.summary !== null) { + message.summary = object.summary; + } + if (object.proposer !== undefined && object.proposer !== null) { + message.proposer = object.proposer; + } + if (object.expedited !== undefined && object.expedited !== null) { + message.expedited = object.expedited; + } + if (object.failed_reason !== undefined && object.failed_reason !== null) { + message.failedReason = object.failed_reason; + } + return message; + }, + toAmino(message: Proposal): ProposalAmino { + const obj: any = {}; + obj.id = message.id !== BigInt(0) ? message.id?.toString() : undefined; + if (message.messages) { + obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.messages = message.messages; + } + obj.status = message.status === 0 ? undefined : message.status; + obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; + obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : undefined; + obj.deposit_end_time = message.depositEndTime ? Timestamp.toAmino(toTimestamp(message.depositEndTime)) : undefined; + if (message.totalDeposit) { + obj.total_deposit = message.totalDeposit.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.total_deposit = message.totalDeposit; + } + obj.voting_start_time = message.votingStartTime ? Timestamp.toAmino(toTimestamp(message.votingStartTime)) : undefined; + obj.voting_end_time = message.votingEndTime ? Timestamp.toAmino(toTimestamp(message.votingEndTime)) : undefined; + obj.metadata = message.metadata === "" ? undefined : message.metadata; + obj.title = message.title === "" ? undefined : message.title; + obj.summary = message.summary === "" ? undefined : message.summary; + obj.proposer = message.proposer === "" ? undefined : message.proposer; + obj.expedited = message.expedited === false ? undefined : message.expedited; + obj.failed_reason = message.failedReason === "" ? undefined : message.failedReason; + return obj; + }, + fromAminoMsg(object: ProposalAminoMsg): Proposal { + return Proposal.fromAmino(object.value); + }, + toAminoMsg(message: Proposal): ProposalAminoMsg { + return { + type: "cosmos-sdk/v1/Proposal", + value: Proposal.toAmino(message) + }; + }, + fromProtoMsg(message: ProposalProtoMsg): Proposal { + return Proposal.decode(message.value); + }, + toProto(message: Proposal): Uint8Array { + return Proposal.encode(message).finish(); + }, + toProtoMsg(message: Proposal): ProposalProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.Proposal", + value: Proposal.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Proposal.typeUrl, Proposal); +GlobalDecoderRegistry.registerAminoProtoMapping(Proposal.aminoType, Proposal.typeUrl); +function createBaseTallyResult(): TallyResult { + return { + yesCount: "", + abstainCount: "", + noCount: "", + noWithVetoCount: "" + }; +} +export const TallyResult = { + typeUrl: "/cosmos.gov.v1.TallyResult", + aminoType: "cosmos-sdk/v1/TallyResult", + is(o: any): o is TallyResult { + return o && (o.$typeUrl === TallyResult.typeUrl || typeof o.yesCount === "string" && typeof o.abstainCount === "string" && typeof o.noCount === "string" && typeof o.noWithVetoCount === "string"); + }, + isAmino(o: any): o is TallyResultAmino { + return o && (o.$typeUrl === TallyResult.typeUrl || typeof o.yes_count === "string" && typeof o.abstain_count === "string" && typeof o.no_count === "string" && typeof o.no_with_veto_count === "string"); + }, + encode(message: TallyResult, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.yesCount !== "") { + writer.uint32(10).string(message.yesCount); + } + if (message.abstainCount !== "") { + writer.uint32(18).string(message.abstainCount); + } + if (message.noCount !== "") { + writer.uint32(26).string(message.noCount); + } + if (message.noWithVetoCount !== "") { + writer.uint32(34).string(message.noWithVetoCount); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TallyResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTallyResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.yesCount = reader.string(); + break; + case 2: + message.abstainCount = reader.string(); + break; + case 3: + message.noCount = reader.string(); + break; + case 4: + message.noWithVetoCount = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): TallyResult { + const message = createBaseTallyResult(); + message.yesCount = object.yesCount ?? ""; + message.abstainCount = object.abstainCount ?? ""; + message.noCount = object.noCount ?? ""; + message.noWithVetoCount = object.noWithVetoCount ?? ""; + return message; + }, + fromAmino(object: TallyResultAmino): TallyResult { + const message = createBaseTallyResult(); + if (object.yes_count !== undefined && object.yes_count !== null) { + message.yesCount = object.yes_count; + } + if (object.abstain_count !== undefined && object.abstain_count !== null) { + message.abstainCount = object.abstain_count; + } + if (object.no_count !== undefined && object.no_count !== null) { + message.noCount = object.no_count; + } + if (object.no_with_veto_count !== undefined && object.no_with_veto_count !== null) { + message.noWithVetoCount = object.no_with_veto_count; + } + return message; + }, + toAmino(message: TallyResult): TallyResultAmino { + const obj: any = {}; + obj.yes_count = message.yesCount === "" ? undefined : message.yesCount; + obj.abstain_count = message.abstainCount === "" ? undefined : message.abstainCount; + obj.no_count = message.noCount === "" ? undefined : message.noCount; + obj.no_with_veto_count = message.noWithVetoCount === "" ? undefined : message.noWithVetoCount; + return obj; + }, + fromAminoMsg(object: TallyResultAminoMsg): TallyResult { + return TallyResult.fromAmino(object.value); + }, + toAminoMsg(message: TallyResult): TallyResultAminoMsg { + return { + type: "cosmos-sdk/v1/TallyResult", + value: TallyResult.toAmino(message) + }; + }, + fromProtoMsg(message: TallyResultProtoMsg): TallyResult { + return TallyResult.decode(message.value); + }, + toProto(message: TallyResult): Uint8Array { + return TallyResult.encode(message).finish(); + }, + toProtoMsg(message: TallyResult): TallyResultProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.TallyResult", + value: TallyResult.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(TallyResult.typeUrl, TallyResult); +GlobalDecoderRegistry.registerAminoProtoMapping(TallyResult.aminoType, TallyResult.typeUrl); +function createBaseVote(): Vote { + return { + proposalId: BigInt(0), + voter: "", + options: [], + metadata: "" + }; +} +export const Vote = { + typeUrl: "/cosmos.gov.v1.Vote", + aminoType: "cosmos-sdk/v1/Vote", + is(o: any): o is Vote { + return o && (o.$typeUrl === Vote.typeUrl || typeof o.proposalId === "bigint" && typeof o.voter === "string" && Array.isArray(o.options) && (!o.options.length || WeightedVoteOption.is(o.options[0])) && typeof o.metadata === "string"); + }, + isAmino(o: any): o is VoteAmino { + return o && (o.$typeUrl === Vote.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string" && Array.isArray(o.options) && (!o.options.length || WeightedVoteOption.isAmino(o.options[0])) && typeof o.metadata === "string"); + }, + encode(message: Vote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + for (const v of message.options) { + WeightedVoteOption.encode(v!, writer.uint32(34).fork()).ldelim(); + } + if (message.metadata !== "") { + writer.uint32(42).string(message.metadata); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Vote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.voter = reader.string(); + break; + case 4: + message.options.push(WeightedVoteOption.decode(reader, reader.uint32())); + break; + case 5: + message.metadata = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Vote { + const message = createBaseVote(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.voter = object.voter ?? ""; + message.options = object.options?.map(e => WeightedVoteOption.fromPartial(e)) || []; + message.metadata = object.metadata ?? ""; + return message; + }, + fromAmino(object: VoteAmino): Vote { + const message = createBaseVote(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.voter !== undefined && object.voter !== null) { + message.voter = object.voter; + } + message.options = object.options?.map(e => WeightedVoteOption.fromAmino(e)) || []; + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + return message; + }, + toAmino(message: Vote): VoteAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId?.toString() : undefined; + obj.voter = message.voter === "" ? undefined : message.voter; + if (message.options) { + obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); + } else { + obj.options = message.options; + } + obj.metadata = message.metadata === "" ? undefined : message.metadata; + return obj; + }, + fromAminoMsg(object: VoteAminoMsg): Vote { + return Vote.fromAmino(object.value); + }, + toAminoMsg(message: Vote): VoteAminoMsg { + return { + type: "cosmos-sdk/v1/Vote", + value: Vote.toAmino(message) + }; + }, + fromProtoMsg(message: VoteProtoMsg): Vote { + return Vote.decode(message.value); + }, + toProto(message: Vote): Uint8Array { + return Vote.encode(message).finish(); + }, + toProtoMsg(message: Vote): VoteProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.Vote", + value: Vote.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Vote.typeUrl, Vote); +GlobalDecoderRegistry.registerAminoProtoMapping(Vote.aminoType, Vote.typeUrl); +function createBaseDepositParams(): DepositParams { + return { + minDeposit: [], + maxDepositPeriod: undefined + }; +} +export const DepositParams = { + typeUrl: "/cosmos.gov.v1.DepositParams", + aminoType: "cosmos-sdk/v1/DepositParams", + is(o: any): o is DepositParams { + return o && (o.$typeUrl === DepositParams.typeUrl || Array.isArray(o.minDeposit) && (!o.minDeposit.length || Coin.is(o.minDeposit[0]))); + }, + isAmino(o: any): o is DepositParamsAmino { + return o && (o.$typeUrl === DepositParams.typeUrl || Array.isArray(o.min_deposit) && (!o.min_deposit.length || Coin.isAmino(o.min_deposit[0]))); + }, + encode(message: DepositParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.minDeposit) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.maxDepositPeriod !== undefined) { + Duration.encode(message.maxDepositPeriod, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DepositParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDepositParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.minDeposit.push(Coin.decode(reader, reader.uint32())); + break; + case 2: + message.maxDepositPeriod = Duration.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): DepositParams { + const message = createBaseDepositParams(); + message.minDeposit = object.minDeposit?.map(e => Coin.fromPartial(e)) || []; + message.maxDepositPeriod = object.maxDepositPeriod !== undefined && object.maxDepositPeriod !== null ? Duration.fromPartial(object.maxDepositPeriod) : undefined; + return message; + }, + fromAmino(object: DepositParamsAmino): DepositParams { + const message = createBaseDepositParams(); + message.minDeposit = object.min_deposit?.map(e => Coin.fromAmino(e)) || []; + if (object.max_deposit_period !== undefined && object.max_deposit_period !== null) { + message.maxDepositPeriod = Duration.fromAmino(object.max_deposit_period); + } + return message; + }, + toAmino(message: DepositParams): DepositParamsAmino { + const obj: any = {}; + if (message.minDeposit) { + obj.min_deposit = message.minDeposit.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.min_deposit = message.minDeposit; + } + obj.max_deposit_period = message.maxDepositPeriod ? Duration.toAmino(message.maxDepositPeriod) : undefined; + return obj; + }, + fromAminoMsg(object: DepositParamsAminoMsg): DepositParams { + return DepositParams.fromAmino(object.value); + }, + toAminoMsg(message: DepositParams): DepositParamsAminoMsg { + return { + type: "cosmos-sdk/v1/DepositParams", + value: DepositParams.toAmino(message) + }; + }, + fromProtoMsg(message: DepositParamsProtoMsg): DepositParams { + return DepositParams.decode(message.value); + }, + toProto(message: DepositParams): Uint8Array { + return DepositParams.encode(message).finish(); + }, + toProtoMsg(message: DepositParams): DepositParamsProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.DepositParams", + value: DepositParams.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(DepositParams.typeUrl, DepositParams); +GlobalDecoderRegistry.registerAminoProtoMapping(DepositParams.aminoType, DepositParams.typeUrl); +function createBaseVotingParams(): VotingParams { + return { + votingPeriod: undefined + }; +} +export const VotingParams = { + typeUrl: "/cosmos.gov.v1.VotingParams", + aminoType: "cosmos-sdk/v1/VotingParams", + is(o: any): o is VotingParams { + return o && o.$typeUrl === VotingParams.typeUrl; + }, + isAmino(o: any): o is VotingParamsAmino { + return o && o.$typeUrl === VotingParams.typeUrl; + }, + encode(message: VotingParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.votingPeriod !== undefined) { + Duration.encode(message.votingPeriod, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): VotingParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVotingParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.votingPeriod = Duration.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): VotingParams { + const message = createBaseVotingParams(); + message.votingPeriod = object.votingPeriod !== undefined && object.votingPeriod !== null ? Duration.fromPartial(object.votingPeriod) : undefined; + return message; + }, + fromAmino(object: VotingParamsAmino): VotingParams { + const message = createBaseVotingParams(); + if (object.voting_period !== undefined && object.voting_period !== null) { + message.votingPeriod = Duration.fromAmino(object.voting_period); + } + return message; + }, + toAmino(message: VotingParams): VotingParamsAmino { + const obj: any = {}; + obj.voting_period = message.votingPeriod ? Duration.toAmino(message.votingPeriod) : undefined; + return obj; + }, + fromAminoMsg(object: VotingParamsAminoMsg): VotingParams { + return VotingParams.fromAmino(object.value); + }, + toAminoMsg(message: VotingParams): VotingParamsAminoMsg { + return { + type: "cosmos-sdk/v1/VotingParams", + value: VotingParams.toAmino(message) + }; + }, + fromProtoMsg(message: VotingParamsProtoMsg): VotingParams { + return VotingParams.decode(message.value); + }, + toProto(message: VotingParams): Uint8Array { + return VotingParams.encode(message).finish(); + }, + toProtoMsg(message: VotingParams): VotingParamsProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.VotingParams", + value: VotingParams.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(VotingParams.typeUrl, VotingParams); +GlobalDecoderRegistry.registerAminoProtoMapping(VotingParams.aminoType, VotingParams.typeUrl); +function createBaseTallyParams(): TallyParams { + return { + quorum: "", + threshold: "", + vetoThreshold: "" + }; +} +export const TallyParams = { + typeUrl: "/cosmos.gov.v1.TallyParams", + aminoType: "cosmos-sdk/v1/TallyParams", + is(o: any): o is TallyParams { + return o && (o.$typeUrl === TallyParams.typeUrl || typeof o.quorum === "string" && typeof o.threshold === "string" && typeof o.vetoThreshold === "string"); + }, + isAmino(o: any): o is TallyParamsAmino { + return o && (o.$typeUrl === TallyParams.typeUrl || typeof o.quorum === "string" && typeof o.threshold === "string" && typeof o.veto_threshold === "string"); + }, + encode(message: TallyParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.quorum !== "") { + writer.uint32(10).string(message.quorum); + } + if (message.threshold !== "") { + writer.uint32(18).string(message.threshold); + } + if (message.vetoThreshold !== "") { + writer.uint32(26).string(message.vetoThreshold); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TallyParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTallyParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.quorum = reader.string(); + break; + case 2: + message.threshold = reader.string(); + break; + case 3: + message.vetoThreshold = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): TallyParams { + const message = createBaseTallyParams(); + message.quorum = object.quorum ?? ""; + message.threshold = object.threshold ?? ""; + message.vetoThreshold = object.vetoThreshold ?? ""; + return message; + }, + fromAmino(object: TallyParamsAmino): TallyParams { + const message = createBaseTallyParams(); + if (object.quorum !== undefined && object.quorum !== null) { + message.quorum = object.quorum; + } + if (object.threshold !== undefined && object.threshold !== null) { + message.threshold = object.threshold; + } + if (object.veto_threshold !== undefined && object.veto_threshold !== null) { + message.vetoThreshold = object.veto_threshold; + } + return message; + }, + toAmino(message: TallyParams): TallyParamsAmino { + const obj: any = {}; + obj.quorum = message.quorum === "" ? undefined : message.quorum; + obj.threshold = message.threshold === "" ? undefined : message.threshold; + obj.veto_threshold = message.vetoThreshold === "" ? undefined : message.vetoThreshold; + return obj; + }, + fromAminoMsg(object: TallyParamsAminoMsg): TallyParams { + return TallyParams.fromAmino(object.value); + }, + toAminoMsg(message: TallyParams): TallyParamsAminoMsg { + return { + type: "cosmos-sdk/v1/TallyParams", + value: TallyParams.toAmino(message) + }; + }, + fromProtoMsg(message: TallyParamsProtoMsg): TallyParams { + return TallyParams.decode(message.value); + }, + toProto(message: TallyParams): Uint8Array { + return TallyParams.encode(message).finish(); + }, + toProtoMsg(message: TallyParams): TallyParamsProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.TallyParams", + value: TallyParams.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(TallyParams.typeUrl, TallyParams); +GlobalDecoderRegistry.registerAminoProtoMapping(TallyParams.aminoType, TallyParams.typeUrl); +function createBaseParams(): Params { + return { + minDeposit: [], + maxDepositPeriod: undefined, + votingPeriod: undefined, + quorum: "", + threshold: "", + vetoThreshold: "", + minInitialDepositRatio: "", + proposalCancelRatio: "", + proposalCancelDest: "", + expeditedVotingPeriod: undefined, + expeditedThreshold: "", + expeditedMinDeposit: [], + burnVoteQuorum: false, + burnProposalDepositPrevote: false, + burnVoteVeto: false, + minDepositRatio: "" + }; +} +export const Params = { + typeUrl: "/cosmos.gov.v1.Params", + aminoType: "cosmos-sdk/v1/Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || Array.isArray(o.minDeposit) && (!o.minDeposit.length || Coin.is(o.minDeposit[0])) && typeof o.quorum === "string" && typeof o.threshold === "string" && typeof o.vetoThreshold === "string" && typeof o.minInitialDepositRatio === "string" && typeof o.proposalCancelRatio === "string" && typeof o.proposalCancelDest === "string" && typeof o.expeditedThreshold === "string" && Array.isArray(o.expeditedMinDeposit) && (!o.expeditedMinDeposit.length || Coin.is(o.expeditedMinDeposit[0])) && typeof o.burnVoteQuorum === "boolean" && typeof o.burnProposalDepositPrevote === "boolean" && typeof o.burnVoteVeto === "boolean" && typeof o.minDepositRatio === "string"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || Array.isArray(o.min_deposit) && (!o.min_deposit.length || Coin.isAmino(o.min_deposit[0])) && typeof o.quorum === "string" && typeof o.threshold === "string" && typeof o.veto_threshold === "string" && typeof o.min_initial_deposit_ratio === "string" && typeof o.proposal_cancel_ratio === "string" && typeof o.proposal_cancel_dest === "string" && typeof o.expedited_threshold === "string" && Array.isArray(o.expedited_min_deposit) && (!o.expedited_min_deposit.length || Coin.isAmino(o.expedited_min_deposit[0])) && typeof o.burn_vote_quorum === "boolean" && typeof o.burn_proposal_deposit_prevote === "boolean" && typeof o.burn_vote_veto === "boolean" && typeof o.min_deposit_ratio === "string"); + }, + encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.minDeposit) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.maxDepositPeriod !== undefined) { + Duration.encode(message.maxDepositPeriod, writer.uint32(18).fork()).ldelim(); + } + if (message.votingPeriod !== undefined) { + Duration.encode(message.votingPeriod, writer.uint32(26).fork()).ldelim(); + } + if (message.quorum !== "") { + writer.uint32(34).string(message.quorum); + } + if (message.threshold !== "") { + writer.uint32(42).string(message.threshold); + } + if (message.vetoThreshold !== "") { + writer.uint32(50).string(message.vetoThreshold); + } + if (message.minInitialDepositRatio !== "") { + writer.uint32(58).string(message.minInitialDepositRatio); + } + if (message.proposalCancelRatio !== "") { + writer.uint32(66).string(message.proposalCancelRatio); + } + if (message.proposalCancelDest !== "") { + writer.uint32(74).string(message.proposalCancelDest); + } + if (message.expeditedVotingPeriod !== undefined) { + Duration.encode(message.expeditedVotingPeriod, writer.uint32(82).fork()).ldelim(); + } + if (message.expeditedThreshold !== "") { + writer.uint32(90).string(message.expeditedThreshold); + } + for (const v of message.expeditedMinDeposit) { + Coin.encode(v!, writer.uint32(98).fork()).ldelim(); + } + if (message.burnVoteQuorum === true) { + writer.uint32(104).bool(message.burnVoteQuorum); + } + if (message.burnProposalDepositPrevote === true) { + writer.uint32(112).bool(message.burnProposalDepositPrevote); + } + if (message.burnVoteVeto === true) { + writer.uint32(120).bool(message.burnVoteVeto); + } + if (message.minDepositRatio !== "") { + writer.uint32(130).string(message.minDepositRatio); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.minDeposit.push(Coin.decode(reader, reader.uint32())); + break; + case 2: + message.maxDepositPeriod = Duration.decode(reader, reader.uint32()); + break; + case 3: + message.votingPeriod = Duration.decode(reader, reader.uint32()); + break; + case 4: + message.quorum = reader.string(); + break; + case 5: + message.threshold = reader.string(); + break; + case 6: + message.vetoThreshold = reader.string(); + break; + case 7: + message.minInitialDepositRatio = reader.string(); + break; + case 8: + message.proposalCancelRatio = reader.string(); + break; + case 9: + message.proposalCancelDest = reader.string(); + break; + case 10: + message.expeditedVotingPeriod = Duration.decode(reader, reader.uint32()); + break; + case 11: + message.expeditedThreshold = reader.string(); + break; + case 12: + message.expeditedMinDeposit.push(Coin.decode(reader, reader.uint32())); + break; + case 13: + message.burnVoteQuorum = reader.bool(); + break; + case 14: + message.burnProposalDepositPrevote = reader.bool(); + break; + case 15: + message.burnVoteVeto = reader.bool(); + break; + case 16: + message.minDepositRatio = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Params { + const message = createBaseParams(); + message.minDeposit = object.minDeposit?.map(e => Coin.fromPartial(e)) || []; + message.maxDepositPeriod = object.maxDepositPeriod !== undefined && object.maxDepositPeriod !== null ? Duration.fromPartial(object.maxDepositPeriod) : undefined; + message.votingPeriod = object.votingPeriod !== undefined && object.votingPeriod !== null ? Duration.fromPartial(object.votingPeriod) : undefined; + message.quorum = object.quorum ?? ""; + message.threshold = object.threshold ?? ""; + message.vetoThreshold = object.vetoThreshold ?? ""; + message.minInitialDepositRatio = object.minInitialDepositRatio ?? ""; + message.proposalCancelRatio = object.proposalCancelRatio ?? ""; + message.proposalCancelDest = object.proposalCancelDest ?? ""; + message.expeditedVotingPeriod = object.expeditedVotingPeriod !== undefined && object.expeditedVotingPeriod !== null ? Duration.fromPartial(object.expeditedVotingPeriod) : undefined; + message.expeditedThreshold = object.expeditedThreshold ?? ""; + message.expeditedMinDeposit = object.expeditedMinDeposit?.map(e => Coin.fromPartial(e)) || []; + message.burnVoteQuorum = object.burnVoteQuorum ?? false; + message.burnProposalDepositPrevote = object.burnProposalDepositPrevote ?? false; + message.burnVoteVeto = object.burnVoteVeto ?? false; + message.minDepositRatio = object.minDepositRatio ?? ""; + return message; + }, + fromAmino(object: ParamsAmino): Params { + const message = createBaseParams(); + message.minDeposit = object.min_deposit?.map(e => Coin.fromAmino(e)) || []; + if (object.max_deposit_period !== undefined && object.max_deposit_period !== null) { + message.maxDepositPeriod = Duration.fromAmino(object.max_deposit_period); + } + if (object.voting_period !== undefined && object.voting_period !== null) { + message.votingPeriod = Duration.fromAmino(object.voting_period); + } + if (object.quorum !== undefined && object.quorum !== null) { + message.quorum = object.quorum; + } + if (object.threshold !== undefined && object.threshold !== null) { + message.threshold = object.threshold; + } + if (object.veto_threshold !== undefined && object.veto_threshold !== null) { + message.vetoThreshold = object.veto_threshold; + } + if (object.min_initial_deposit_ratio !== undefined && object.min_initial_deposit_ratio !== null) { + message.minInitialDepositRatio = object.min_initial_deposit_ratio; + } + if (object.proposal_cancel_ratio !== undefined && object.proposal_cancel_ratio !== null) { + message.proposalCancelRatio = object.proposal_cancel_ratio; + } + if (object.proposal_cancel_dest !== undefined && object.proposal_cancel_dest !== null) { + message.proposalCancelDest = object.proposal_cancel_dest; + } + if (object.expedited_voting_period !== undefined && object.expedited_voting_period !== null) { + message.expeditedVotingPeriod = Duration.fromAmino(object.expedited_voting_period); + } + if (object.expedited_threshold !== undefined && object.expedited_threshold !== null) { + message.expeditedThreshold = object.expedited_threshold; + } + message.expeditedMinDeposit = object.expedited_min_deposit?.map(e => Coin.fromAmino(e)) || []; + if (object.burn_vote_quorum !== undefined && object.burn_vote_quorum !== null) { + message.burnVoteQuorum = object.burn_vote_quorum; + } + if (object.burn_proposal_deposit_prevote !== undefined && object.burn_proposal_deposit_prevote !== null) { + message.burnProposalDepositPrevote = object.burn_proposal_deposit_prevote; + } + if (object.burn_vote_veto !== undefined && object.burn_vote_veto !== null) { + message.burnVoteVeto = object.burn_vote_veto; + } + if (object.min_deposit_ratio !== undefined && object.min_deposit_ratio !== null) { + message.minDepositRatio = object.min_deposit_ratio; + } + return message; + }, + toAmino(message: Params): ParamsAmino { + const obj: any = {}; + if (message.minDeposit) { + obj.min_deposit = message.minDeposit.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.min_deposit = message.minDeposit; + } + obj.max_deposit_period = message.maxDepositPeriod ? Duration.toAmino(message.maxDepositPeriod) : undefined; + obj.voting_period = message.votingPeriod ? Duration.toAmino(message.votingPeriod) : undefined; + obj.quorum = message.quorum === "" ? undefined : message.quorum; + obj.threshold = message.threshold === "" ? undefined : message.threshold; + obj.veto_threshold = message.vetoThreshold === "" ? undefined : message.vetoThreshold; + obj.min_initial_deposit_ratio = message.minInitialDepositRatio === "" ? undefined : message.minInitialDepositRatio; + obj.proposal_cancel_ratio = message.proposalCancelRatio === "" ? undefined : message.proposalCancelRatio; + obj.proposal_cancel_dest = message.proposalCancelDest === "" ? undefined : message.proposalCancelDest; + obj.expedited_voting_period = message.expeditedVotingPeriod ? Duration.toAmino(message.expeditedVotingPeriod) : undefined; + obj.expedited_threshold = message.expeditedThreshold === "" ? undefined : message.expeditedThreshold; + if (message.expeditedMinDeposit) { + obj.expedited_min_deposit = message.expeditedMinDeposit.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.expedited_min_deposit = message.expeditedMinDeposit; + } + obj.burn_vote_quorum = message.burnVoteQuorum === false ? undefined : message.burnVoteQuorum; + obj.burn_proposal_deposit_prevote = message.burnProposalDepositPrevote === false ? undefined : message.burnProposalDepositPrevote; + obj.burn_vote_veto = message.burnVoteVeto === false ? undefined : message.burnVoteVeto; + obj.min_deposit_ratio = message.minDepositRatio === "" ? undefined : message.minDepositRatio; + return obj; + }, + fromAminoMsg(object: ParamsAminoMsg): Params { + return Params.fromAmino(object.value); + }, + toAminoMsg(message: Params): ParamsAminoMsg { + return { + type: "cosmos-sdk/v1/Params", + value: Params.toAmino(message) + }; + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.Params", + value: Params.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Params.typeUrl, Params); +GlobalDecoderRegistry.registerAminoProtoMapping(Params.aminoType, Params.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/gov/v1/tx.rpc.func.ts b/libs/interchain-query/src/cosmos/gov/v1/tx.rpc.func.ts new file mode 100644 index 00000000..cb094f2e --- /dev/null +++ b/libs/interchain-query/src/cosmos/gov/v1/tx.rpc.func.ts @@ -0,0 +1,67 @@ +import { buildTx, SigningClientResolver } from "../../../helper-func-types"; +import { buildUseMutation } from "../../../react-query"; +import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; +import { MsgSubmitProposal, MsgExecLegacyContent, MsgVote, MsgVoteWeighted, MsgDeposit, MsgUpdateParams, MsgCancelProposal } from "./tx"; +export const createSubmitProposal = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgSubmitProposal.typeUrl, + encoders: toEncoders(MsgSubmitProposal), + converters: toConverters(MsgSubmitProposal) +}); +export const useSubmitProposal = buildUseMutation({ + builderMutationFn: createSubmitProposal +}); +export const createExecLegacyContent = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgExecLegacyContent.typeUrl, + encoders: toEncoders(MsgExecLegacyContent), + converters: toConverters(MsgExecLegacyContent) +}); +export const useExecLegacyContent = buildUseMutation({ + builderMutationFn: createExecLegacyContent +}); +export const createVote = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgVote.typeUrl, + encoders: toEncoders(MsgVote), + converters: toConverters(MsgVote) +}); +export const useVote = buildUseMutation({ + builderMutationFn: createVote +}); +export const createVoteWeighted = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgVoteWeighted.typeUrl, + encoders: toEncoders(MsgVoteWeighted), + converters: toConverters(MsgVoteWeighted) +}); +export const useVoteWeighted = buildUseMutation({ + builderMutationFn: createVoteWeighted +}); +export const createDeposit = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgDeposit.typeUrl, + encoders: toEncoders(MsgDeposit), + converters: toConverters(MsgDeposit) +}); +export const useDeposit = buildUseMutation({ + builderMutationFn: createDeposit +}); +export const createUpdateParams = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgUpdateParams.typeUrl, + encoders: toEncoders(MsgUpdateParams), + converters: toConverters(MsgUpdateParams) +}); +export const useUpdateParams = buildUseMutation({ + builderMutationFn: createUpdateParams +}); +export const createCancelProposal = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgCancelProposal.typeUrl, + encoders: toEncoders(MsgCancelProposal), + converters: toConverters(MsgCancelProposal) +}); +export const useCancelProposal = buildUseMutation({ + builderMutationFn: createCancelProposal +}); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/gov/v1/tx.ts b/libs/interchain-query/src/cosmos/gov/v1/tx.ts new file mode 100644 index 00000000..f9003793 --- /dev/null +++ b/libs/interchain-query/src/cosmos/gov/v1/tx.ts @@ -0,0 +1,1655 @@ +import { Any, AnyProtoMsg, AnyAmino } from "../../../google/protobuf/any"; +import { Coin, CoinAmino } from "../../base/v1beta1/coin"; +import { VoteOption, WeightedVoteOption, WeightedVoteOptionAmino, Params, ParamsAmino } from "./gov"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { CommunityPoolSpendProposal, CommunityPoolSpendProposalProtoMsg, CommunityPoolSpendProposalWithDeposit, CommunityPoolSpendProposalWithDepositProtoMsg } from "../../distribution/v1beta1/distribution"; +import { TextProposal, TextProposalProtoMsg } from "../v1beta1/gov"; +import { SoftwareUpgradeProposal, SoftwareUpgradeProposalProtoMsg, CancelSoftwareUpgradeProposal, CancelSoftwareUpgradeProposalProtoMsg } from "../../upgrade/v1beta1/upgrade"; +import { ClientUpdateProposal, ClientUpdateProposalProtoMsg, UpgradeProposal, UpgradeProposalProtoMsg } from "../../../ibc/core/client/v1/client"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial, isSet, toTimestamp, fromTimestamp } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; +/** + * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary + * proposal Content. + */ +export interface MsgSubmitProposal { + /** messages are the arbitrary messages to be executed if proposal passes. */ + messages: Any[]; + /** initial_deposit is the deposit value that must be paid at proposal submission. */ + initialDeposit: Coin[]; + /** proposer is the account address of the proposer. */ + proposer: string; + /** metadata is any arbitrary metadata attached to the proposal. */ + metadata: string; + /** + * title is the title of the proposal. + * + * Since: cosmos-sdk 0.47 + */ + title: string; + /** + * summary is the summary of the proposal + * + * Since: cosmos-sdk 0.47 + */ + summary: string; + /** + * expedited defines if the proposal is expedited or not + * + * Since: cosmos-sdk 0.50 + */ + expedited: boolean; +} +export interface MsgSubmitProposalProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgSubmitProposal"; + value: Uint8Array; +} +/** + * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary + * proposal Content. + */ +export interface MsgSubmitProposalAmino { + /** messages are the arbitrary messages to be executed if proposal passes. */ + messages: AnyAmino[]; + /** initial_deposit is the deposit value that must be paid at proposal submission. */ + initial_deposit: CoinAmino[]; + /** proposer is the account address of the proposer. */ + proposer: string; + /** metadata is any arbitrary metadata attached to the proposal. */ + metadata: string; + /** + * title is the title of the proposal. + * + * Since: cosmos-sdk 0.47 + */ + title: string; + /** + * summary is the summary of the proposal + * + * Since: cosmos-sdk 0.47 + */ + summary: string; + /** + * expedited defines if the proposal is expedited or not + * + * Since: cosmos-sdk 0.50 + */ + expedited: boolean; +} +export interface MsgSubmitProposalAminoMsg { + type: "cosmos-sdk/v1/MsgSubmitProposal"; + value: MsgSubmitProposalAmino; +} +/** MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. */ +export interface MsgSubmitProposalResponse { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; +} +export interface MsgSubmitProposalResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgSubmitProposalResponse"; + value: Uint8Array; +} +/** MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. */ +export interface MsgSubmitProposalResponseAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; +} +export interface MsgSubmitProposalResponseAminoMsg { + type: "cosmos-sdk/v1/MsgSubmitProposalResponse"; + value: MsgSubmitProposalResponseAmino; +} +/** + * MsgExecLegacyContent is used to wrap the legacy content field into a message. + * This ensures backwards compatibility with v1beta1.MsgSubmitProposal. + */ +export interface MsgExecLegacyContent { + /** content is the proposal's content. */ + content?: CommunityPoolSpendProposal | CommunityPoolSpendProposalWithDeposit | TextProposal | SoftwareUpgradeProposal | CancelSoftwareUpgradeProposal | ClientUpdateProposal | UpgradeProposal | Any | undefined; + /** authority must be the gov module address. */ + authority: string; +} +export interface MsgExecLegacyContentProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgExecLegacyContent"; + value: Uint8Array; +} +export type MsgExecLegacyContentEncoded = Omit & { + /** content is the proposal's content. */content?: CommunityPoolSpendProposalProtoMsg | CommunityPoolSpendProposalWithDepositProtoMsg | TextProposalProtoMsg | SoftwareUpgradeProposalProtoMsg | CancelSoftwareUpgradeProposalProtoMsg | ClientUpdateProposalProtoMsg | UpgradeProposalProtoMsg | AnyProtoMsg | undefined; +}; +/** + * MsgExecLegacyContent is used to wrap the legacy content field into a message. + * This ensures backwards compatibility with v1beta1.MsgSubmitProposal. + */ +export interface MsgExecLegacyContentAmino { + /** content is the proposal's content. */ + content?: AnyAmino; + /** authority must be the gov module address. */ + authority: string; +} +export interface MsgExecLegacyContentAminoMsg { + type: "cosmos-sdk/v1/MsgExecLegacyContent"; + value: MsgExecLegacyContentAmino; +} +/** MsgExecLegacyContentResponse defines the Msg/ExecLegacyContent response type. */ +export interface MsgExecLegacyContentResponse {} +export interface MsgExecLegacyContentResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgExecLegacyContentResponse"; + value: Uint8Array; +} +/** MsgExecLegacyContentResponse defines the Msg/ExecLegacyContent response type. */ +export interface MsgExecLegacyContentResponseAmino {} +export interface MsgExecLegacyContentResponseAminoMsg { + type: "cosmos-sdk/v1/MsgExecLegacyContentResponse"; + value: MsgExecLegacyContentResponseAmino; +} +/** MsgVote defines a message to cast a vote. */ +export interface MsgVote { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; + /** voter is the voter address for the proposal. */ + voter: string; + /** option defines the vote option. */ + option: VoteOption; + /** metadata is any arbitrary metadata attached to the Vote. */ + metadata: string; +} +export interface MsgVoteProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgVote"; + value: Uint8Array; +} +/** MsgVote defines a message to cast a vote. */ +export interface MsgVoteAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** voter is the voter address for the proposal. */ + voter: string; + /** option defines the vote option. */ + option: VoteOption; + /** metadata is any arbitrary metadata attached to the Vote. */ + metadata: string; +} +export interface MsgVoteAminoMsg { + type: "cosmos-sdk/v1/MsgVote"; + value: MsgVoteAmino; +} +/** MsgVoteResponse defines the Msg/Vote response type. */ +export interface MsgVoteResponse {} +export interface MsgVoteResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgVoteResponse"; + value: Uint8Array; +} +/** MsgVoteResponse defines the Msg/Vote response type. */ +export interface MsgVoteResponseAmino {} +export interface MsgVoteResponseAminoMsg { + type: "cosmos-sdk/v1/MsgVoteResponse"; + value: MsgVoteResponseAmino; +} +/** MsgVoteWeighted defines a message to cast a vote. */ +export interface MsgVoteWeighted { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; + /** voter is the voter address for the proposal. */ + voter: string; + /** options defines the weighted vote options. */ + options: WeightedVoteOption[]; + /** metadata is any arbitrary metadata attached to the VoteWeighted. */ + metadata: string; +} +export interface MsgVoteWeightedProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgVoteWeighted"; + value: Uint8Array; +} +/** MsgVoteWeighted defines a message to cast a vote. */ +export interface MsgVoteWeightedAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** voter is the voter address for the proposal. */ + voter: string; + /** options defines the weighted vote options. */ + options: WeightedVoteOptionAmino[]; + /** metadata is any arbitrary metadata attached to the VoteWeighted. */ + metadata: string; +} +export interface MsgVoteWeightedAminoMsg { + type: "cosmos-sdk/v1/MsgVoteWeighted"; + value: MsgVoteWeightedAmino; +} +/** MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. */ +export interface MsgVoteWeightedResponse {} +export interface MsgVoteWeightedResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgVoteWeightedResponse"; + value: Uint8Array; +} +/** MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. */ +export interface MsgVoteWeightedResponseAmino {} +export interface MsgVoteWeightedResponseAminoMsg { + type: "cosmos-sdk/v1/MsgVoteWeightedResponse"; + value: MsgVoteWeightedResponseAmino; +} +/** MsgDeposit defines a message to submit a deposit to an existing proposal. */ +export interface MsgDeposit { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** amount to be deposited by depositor. */ + amount: Coin[]; +} +export interface MsgDepositProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgDeposit"; + value: Uint8Array; +} +/** MsgDeposit defines a message to submit a deposit to an existing proposal. */ +export interface MsgDepositAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** amount to be deposited by depositor. */ + amount: CoinAmino[]; +} +export interface MsgDepositAminoMsg { + type: "cosmos-sdk/v1/MsgDeposit"; + value: MsgDepositAmino; +} +/** MsgDepositResponse defines the Msg/Deposit response type. */ +export interface MsgDepositResponse {} +export interface MsgDepositResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgDepositResponse"; + value: Uint8Array; +} +/** MsgDepositResponse defines the Msg/Deposit response type. */ +export interface MsgDepositResponseAmino {} +export interface MsgDepositResponseAminoMsg { + type: "cosmos-sdk/v1/MsgDepositResponse"; + value: MsgDepositResponseAmino; +} +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/gov parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params; +} +export interface MsgUpdateParamsProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgUpdateParams"; + value: Uint8Array; +} +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsAmino { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/gov parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: ParamsAmino; +} +export interface MsgUpdateParamsAminoMsg { + type: "cosmos-sdk/x/gov/v1/MsgUpdateParams"; + value: MsgUpdateParamsAmino; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse {} +export interface MsgUpdateParamsResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgUpdateParamsResponse"; + value: Uint8Array; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponseAmino {} +export interface MsgUpdateParamsResponseAminoMsg { + type: "cosmos-sdk/v1/MsgUpdateParamsResponse"; + value: MsgUpdateParamsResponseAmino; +} +/** + * MsgCancelProposal is the Msg/CancelProposal request type. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgCancelProposal { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; + /** proposer is the account address of the proposer. */ + proposer: string; +} +export interface MsgCancelProposalProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgCancelProposal"; + value: Uint8Array; +} +/** + * MsgCancelProposal is the Msg/CancelProposal request type. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgCancelProposalAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** proposer is the account address of the proposer. */ + proposer: string; +} +export interface MsgCancelProposalAminoMsg { + type: "cosmos-sdk/v1/MsgCancelProposal"; + value: MsgCancelProposalAmino; +} +/** + * MsgCancelProposalResponse defines the response structure for executing a + * MsgCancelProposal message. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgCancelProposalResponse { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; + /** canceled_time is the time when proposal is canceled. */ + canceledTime: Date; + /** canceled_height defines the block height at which the proposal is canceled. */ + canceledHeight: bigint; +} +export interface MsgCancelProposalResponseProtoMsg { + typeUrl: "/cosmos.gov.v1.MsgCancelProposalResponse"; + value: Uint8Array; +} +/** + * MsgCancelProposalResponse defines the response structure for executing a + * MsgCancelProposal message. + * + * Since: cosmos-sdk 0.50 + */ +export interface MsgCancelProposalResponseAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** canceled_time is the time when proposal is canceled. */ + canceled_time: string; + /** canceled_height defines the block height at which the proposal is canceled. */ + canceled_height: string; +} +export interface MsgCancelProposalResponseAminoMsg { + type: "cosmos-sdk/v1/MsgCancelProposalResponse"; + value: MsgCancelProposalResponseAmino; +} +function createBaseMsgSubmitProposal(): MsgSubmitProposal { + return { + messages: [], + initialDeposit: [], + proposer: "", + metadata: "", + title: "", + summary: "", + expedited: false + }; +} +export const MsgSubmitProposal = { + typeUrl: "/cosmos.gov.v1.MsgSubmitProposal", + aminoType: "cosmos-sdk/v1/MsgSubmitProposal", + is(o: any): o is MsgSubmitProposal { + return o && (o.$typeUrl === MsgSubmitProposal.typeUrl || Array.isArray(o.messages) && (!o.messages.length || Any.is(o.messages[0])) && Array.isArray(o.initialDeposit) && (!o.initialDeposit.length || Coin.is(o.initialDeposit[0])) && typeof o.proposer === "string" && typeof o.metadata === "string" && typeof o.title === "string" && typeof o.summary === "string" && typeof o.expedited === "boolean"); + }, + isAmino(o: any): o is MsgSubmitProposalAmino { + return o && (o.$typeUrl === MsgSubmitProposal.typeUrl || Array.isArray(o.messages) && (!o.messages.length || Any.isAmino(o.messages[0])) && Array.isArray(o.initial_deposit) && (!o.initial_deposit.length || Coin.isAmino(o.initial_deposit[0])) && typeof o.proposer === "string" && typeof o.metadata === "string" && typeof o.title === "string" && typeof o.summary === "string" && typeof o.expedited === "boolean"); + }, + encode(message: MsgSubmitProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.messages) { + Any.encode(v!, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.initialDeposit) { + Coin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.proposer !== "") { + writer.uint32(26).string(message.proposer); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + if (message.title !== "") { + writer.uint32(42).string(message.title); + } + if (message.summary !== "") { + writer.uint32(50).string(message.summary); + } + if (message.expedited === true) { + writer.uint32(56).bool(message.expedited); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.messages.push(Any.decode(reader, reader.uint32())); + break; + case 2: + message.initialDeposit.push(Coin.decode(reader, reader.uint32())); + break; + case 3: + message.proposer = reader.string(); + break; + case 4: + message.metadata = reader.string(); + break; + case 5: + message.title = reader.string(); + break; + case 6: + message.summary = reader.string(); + break; + case 7: + message.expedited = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgSubmitProposal { + const message = createBaseMsgSubmitProposal(); + message.messages = object.messages?.map(e => Any.fromPartial(e)) || []; + message.initialDeposit = object.initialDeposit?.map(e => Coin.fromPartial(e)) || []; + message.proposer = object.proposer ?? ""; + message.metadata = object.metadata ?? ""; + message.title = object.title ?? ""; + message.summary = object.summary ?? ""; + message.expedited = object.expedited ?? false; + return message; + }, + fromAmino(object: MsgSubmitProposalAmino): MsgSubmitProposal { + const message = createBaseMsgSubmitProposal(); + message.messages = object.messages?.map(e => Any.fromAmino(e)) || []; + message.initialDeposit = object.initial_deposit?.map(e => Coin.fromAmino(e)) || []; + if (object.proposer !== undefined && object.proposer !== null) { + message.proposer = object.proposer; + } + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.summary !== undefined && object.summary !== null) { + message.summary = object.summary; + } + if (object.expedited !== undefined && object.expedited !== null) { + message.expedited = object.expedited; + } + return message; + }, + toAmino(message: MsgSubmitProposal): MsgSubmitProposalAmino { + const obj: any = {}; + if (message.messages) { + obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.messages = message.messages; + } + if (message.initialDeposit) { + obj.initial_deposit = message.initialDeposit.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.initial_deposit = message.initialDeposit; + } + obj.proposer = message.proposer === "" ? undefined : message.proposer; + obj.metadata = message.metadata === "" ? undefined : message.metadata; + obj.title = message.title === "" ? undefined : message.title; + obj.summary = message.summary === "" ? undefined : message.summary; + obj.expedited = message.expedited === false ? undefined : message.expedited; + return obj; + }, + fromAminoMsg(object: MsgSubmitProposalAminoMsg): MsgSubmitProposal { + return MsgSubmitProposal.fromAmino(object.value); + }, + toAminoMsg(message: MsgSubmitProposal): MsgSubmitProposalAminoMsg { + return { + type: "cosmos-sdk/v1/MsgSubmitProposal", + value: MsgSubmitProposal.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSubmitProposalProtoMsg): MsgSubmitProposal { + return MsgSubmitProposal.decode(message.value); + }, + toProto(message: MsgSubmitProposal): Uint8Array { + return MsgSubmitProposal.encode(message).finish(); + }, + toProtoMsg(message: MsgSubmitProposal): MsgSubmitProposalProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgSubmitProposal", + value: MsgSubmitProposal.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgSubmitProposal.typeUrl, MsgSubmitProposal); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgSubmitProposal.aminoType, MsgSubmitProposal.typeUrl); +function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { + return { + proposalId: BigInt(0) + }; +} +export const MsgSubmitProposalResponse = { + typeUrl: "/cosmos.gov.v1.MsgSubmitProposalResponse", + aminoType: "cosmos-sdk/v1/MsgSubmitProposalResponse", + is(o: any): o is MsgSubmitProposalResponse { + return o && (o.$typeUrl === MsgSubmitProposalResponse.typeUrl || typeof o.proposalId === "bigint"); + }, + isAmino(o: any): o is MsgSubmitProposalResponseAmino { + return o && (o.$typeUrl === MsgSubmitProposalResponse.typeUrl || typeof o.proposal_id === "bigint"); + }, + encode(message: MsgSubmitProposalResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgSubmitProposalResponse { + const message = createBaseMsgSubmitProposalResponse(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + return message; + }, + fromAmino(object: MsgSubmitProposalResponseAmino): MsgSubmitProposalResponse { + const message = createBaseMsgSubmitProposalResponse(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + return message; + }, + toAmino(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: MsgSubmitProposalResponseAminoMsg): MsgSubmitProposalResponse { + return MsgSubmitProposalResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAminoMsg { + return { + type: "cosmos-sdk/v1/MsgSubmitProposalResponse", + value: MsgSubmitProposalResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSubmitProposalResponseProtoMsg): MsgSubmitProposalResponse { + return MsgSubmitProposalResponse.decode(message.value); + }, + toProto(message: MsgSubmitProposalResponse): Uint8Array { + return MsgSubmitProposalResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgSubmitProposalResponse", + value: MsgSubmitProposalResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgSubmitProposalResponse.typeUrl, MsgSubmitProposalResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgSubmitProposalResponse.aminoType, MsgSubmitProposalResponse.typeUrl); +function createBaseMsgExecLegacyContent(): MsgExecLegacyContent { + return { + content: undefined, + authority: "" + }; +} +export const MsgExecLegacyContent = { + typeUrl: "/cosmos.gov.v1.MsgExecLegacyContent", + aminoType: "cosmos-sdk/v1/MsgExecLegacyContent", + is(o: any): o is MsgExecLegacyContent { + return o && (o.$typeUrl === MsgExecLegacyContent.typeUrl || typeof o.authority === "string"); + }, + isAmino(o: any): o is MsgExecLegacyContentAmino { + return o && (o.$typeUrl === MsgExecLegacyContent.typeUrl || typeof o.authority === "string"); + }, + encode(message: MsgExecLegacyContent, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.content !== undefined) { + Any.encode(GlobalDecoderRegistry.wrapAny(message.content), writer.uint32(10).fork()).ldelim(); + } + if (message.authority !== "") { + writer.uint32(18).string(message.authority); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgExecLegacyContent { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExecLegacyContent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.content = GlobalDecoderRegistry.unwrapAny(reader); + break; + case 2: + message.authority = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgExecLegacyContent { + const message = createBaseMsgExecLegacyContent(); + message.content = object.content !== undefined && object.content !== null ? GlobalDecoderRegistry.fromPartial(object.content) : undefined; + message.authority = object.authority ?? ""; + return message; + }, + fromAmino(object: MsgExecLegacyContentAmino): MsgExecLegacyContent { + const message = createBaseMsgExecLegacyContent(); + if (object.content !== undefined && object.content !== null) { + message.content = GlobalDecoderRegistry.fromAminoMsg(object.content); + } + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + return message; + }, + toAmino(message: MsgExecLegacyContent): MsgExecLegacyContentAmino { + const obj: any = {}; + obj.content = message.content ? GlobalDecoderRegistry.toAminoMsg(message.content) : undefined; + obj.authority = message.authority === "" ? undefined : message.authority; + return obj; + }, + fromAminoMsg(object: MsgExecLegacyContentAminoMsg): MsgExecLegacyContent { + return MsgExecLegacyContent.fromAmino(object.value); + }, + toAminoMsg(message: MsgExecLegacyContent): MsgExecLegacyContentAminoMsg { + return { + type: "cosmos-sdk/v1/MsgExecLegacyContent", + value: MsgExecLegacyContent.toAmino(message) + }; + }, + fromProtoMsg(message: MsgExecLegacyContentProtoMsg): MsgExecLegacyContent { + return MsgExecLegacyContent.decode(message.value); + }, + toProto(message: MsgExecLegacyContent): Uint8Array { + return MsgExecLegacyContent.encode(message).finish(); + }, + toProtoMsg(message: MsgExecLegacyContent): MsgExecLegacyContentProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgExecLegacyContent", + value: MsgExecLegacyContent.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgExecLegacyContent.typeUrl, MsgExecLegacyContent); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgExecLegacyContent.aminoType, MsgExecLegacyContent.typeUrl); +function createBaseMsgExecLegacyContentResponse(): MsgExecLegacyContentResponse { + return {}; +} +export const MsgExecLegacyContentResponse = { + typeUrl: "/cosmos.gov.v1.MsgExecLegacyContentResponse", + aminoType: "cosmos-sdk/v1/MsgExecLegacyContentResponse", + is(o: any): o is MsgExecLegacyContentResponse { + return o && o.$typeUrl === MsgExecLegacyContentResponse.typeUrl; + }, + isAmino(o: any): o is MsgExecLegacyContentResponseAmino { + return o && o.$typeUrl === MsgExecLegacyContentResponse.typeUrl; + }, + encode(_: MsgExecLegacyContentResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgExecLegacyContentResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExecLegacyContentResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgExecLegacyContentResponse { + const message = createBaseMsgExecLegacyContentResponse(); + return message; + }, + fromAmino(_: MsgExecLegacyContentResponseAmino): MsgExecLegacyContentResponse { + const message = createBaseMsgExecLegacyContentResponse(); + return message; + }, + toAmino(_: MsgExecLegacyContentResponse): MsgExecLegacyContentResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgExecLegacyContentResponseAminoMsg): MsgExecLegacyContentResponse { + return MsgExecLegacyContentResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgExecLegacyContentResponse): MsgExecLegacyContentResponseAminoMsg { + return { + type: "cosmos-sdk/v1/MsgExecLegacyContentResponse", + value: MsgExecLegacyContentResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgExecLegacyContentResponseProtoMsg): MsgExecLegacyContentResponse { + return MsgExecLegacyContentResponse.decode(message.value); + }, + toProto(message: MsgExecLegacyContentResponse): Uint8Array { + return MsgExecLegacyContentResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgExecLegacyContentResponse): MsgExecLegacyContentResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgExecLegacyContentResponse", + value: MsgExecLegacyContentResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgExecLegacyContentResponse.typeUrl, MsgExecLegacyContentResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgExecLegacyContentResponse.aminoType, MsgExecLegacyContentResponse.typeUrl); +function createBaseMsgVote(): MsgVote { + return { + proposalId: BigInt(0), + voter: "", + option: 0, + metadata: "" + }; +} +export const MsgVote = { + typeUrl: "/cosmos.gov.v1.MsgVote", + aminoType: "cosmos-sdk/v1/MsgVote", + is(o: any): o is MsgVote { + return o && (o.$typeUrl === MsgVote.typeUrl || typeof o.proposalId === "bigint" && typeof o.voter === "string" && isSet(o.option) && typeof o.metadata === "string"); + }, + isAmino(o: any): o is MsgVoteAmino { + return o && (o.$typeUrl === MsgVote.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string" && isSet(o.option) && typeof o.metadata === "string"); + }, + encode(message: MsgVote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== 0) { + writer.uint32(24).int32(message.option); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.voter = reader.string(); + break; + case 3: + message.option = (reader.int32() as any); + break; + case 4: + message.metadata = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgVote { + const message = createBaseMsgVote(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.voter = object.voter ?? ""; + message.option = object.option ?? 0; + message.metadata = object.metadata ?? ""; + return message; + }, + fromAmino(object: MsgVoteAmino): MsgVote { + const message = createBaseMsgVote(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.voter !== undefined && object.voter !== null) { + message.voter = object.voter; + } + if (object.option !== undefined && object.option !== null) { + message.option = object.option; + } + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + return message; + }, + toAmino(message: MsgVote): MsgVoteAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId?.toString() : "0"; + obj.voter = message.voter === "" ? undefined : message.voter; + obj.option = message.option === 0 ? undefined : message.option; + obj.metadata = message.metadata === "" ? undefined : message.metadata; + return obj; + }, + fromAminoMsg(object: MsgVoteAminoMsg): MsgVote { + return MsgVote.fromAmino(object.value); + }, + toAminoMsg(message: MsgVote): MsgVoteAminoMsg { + return { + type: "cosmos-sdk/v1/MsgVote", + value: MsgVote.toAmino(message) + }; + }, + fromProtoMsg(message: MsgVoteProtoMsg): MsgVote { + return MsgVote.decode(message.value); + }, + toProto(message: MsgVote): Uint8Array { + return MsgVote.encode(message).finish(); + }, + toProtoMsg(message: MsgVote): MsgVoteProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgVote", + value: MsgVote.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgVote.typeUrl, MsgVote); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgVote.aminoType, MsgVote.typeUrl); +function createBaseMsgVoteResponse(): MsgVoteResponse { + return {}; +} +export const MsgVoteResponse = { + typeUrl: "/cosmos.gov.v1.MsgVoteResponse", + aminoType: "cosmos-sdk/v1/MsgVoteResponse", + is(o: any): o is MsgVoteResponse { + return o && o.$typeUrl === MsgVoteResponse.typeUrl; + }, + isAmino(o: any): o is MsgVoteResponseAmino { + return o && o.$typeUrl === MsgVoteResponse.typeUrl; + }, + encode(_: MsgVoteResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgVoteResponse { + const message = createBaseMsgVoteResponse(); + return message; + }, + fromAmino(_: MsgVoteResponseAmino): MsgVoteResponse { + const message = createBaseMsgVoteResponse(); + return message; + }, + toAmino(_: MsgVoteResponse): MsgVoteResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgVoteResponseAminoMsg): MsgVoteResponse { + return MsgVoteResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgVoteResponse): MsgVoteResponseAminoMsg { + return { + type: "cosmos-sdk/v1/MsgVoteResponse", + value: MsgVoteResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgVoteResponseProtoMsg): MsgVoteResponse { + return MsgVoteResponse.decode(message.value); + }, + toProto(message: MsgVoteResponse): Uint8Array { + return MsgVoteResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgVoteResponse): MsgVoteResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgVoteResponse", + value: MsgVoteResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgVoteResponse.typeUrl, MsgVoteResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgVoteResponse.aminoType, MsgVoteResponse.typeUrl); +function createBaseMsgVoteWeighted(): MsgVoteWeighted { + return { + proposalId: BigInt(0), + voter: "", + options: [], + metadata: "" + }; +} +export const MsgVoteWeighted = { + typeUrl: "/cosmos.gov.v1.MsgVoteWeighted", + aminoType: "cosmos-sdk/v1/MsgVoteWeighted", + is(o: any): o is MsgVoteWeighted { + return o && (o.$typeUrl === MsgVoteWeighted.typeUrl || typeof o.proposalId === "bigint" && typeof o.voter === "string" && Array.isArray(o.options) && (!o.options.length || WeightedVoteOption.is(o.options[0])) && typeof o.metadata === "string"); + }, + isAmino(o: any): o is MsgVoteWeightedAmino { + return o && (o.$typeUrl === MsgVoteWeighted.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string" && Array.isArray(o.options) && (!o.options.length || WeightedVoteOption.isAmino(o.options[0])) && typeof o.metadata === "string"); + }, + encode(message: MsgVoteWeighted, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + for (const v of message.options) { + WeightedVoteOption.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteWeighted { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteWeighted(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.voter = reader.string(); + break; + case 3: + message.options.push(WeightedVoteOption.decode(reader, reader.uint32())); + break; + case 4: + message.metadata = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgVoteWeighted { + const message = createBaseMsgVoteWeighted(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.voter = object.voter ?? ""; + message.options = object.options?.map(e => WeightedVoteOption.fromPartial(e)) || []; + message.metadata = object.metadata ?? ""; + return message; + }, + fromAmino(object: MsgVoteWeightedAmino): MsgVoteWeighted { + const message = createBaseMsgVoteWeighted(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.voter !== undefined && object.voter !== null) { + message.voter = object.voter; + } + message.options = object.options?.map(e => WeightedVoteOption.fromAmino(e)) || []; + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + return message; + }, + toAmino(message: MsgVoteWeighted): MsgVoteWeightedAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId?.toString() : "0"; + obj.voter = message.voter === "" ? undefined : message.voter; + if (message.options) { + obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); + } else { + obj.options = message.options; + } + obj.metadata = message.metadata === "" ? undefined : message.metadata; + return obj; + }, + fromAminoMsg(object: MsgVoteWeightedAminoMsg): MsgVoteWeighted { + return MsgVoteWeighted.fromAmino(object.value); + }, + toAminoMsg(message: MsgVoteWeighted): MsgVoteWeightedAminoMsg { + return { + type: "cosmos-sdk/v1/MsgVoteWeighted", + value: MsgVoteWeighted.toAmino(message) + }; + }, + fromProtoMsg(message: MsgVoteWeightedProtoMsg): MsgVoteWeighted { + return MsgVoteWeighted.decode(message.value); + }, + toProto(message: MsgVoteWeighted): Uint8Array { + return MsgVoteWeighted.encode(message).finish(); + }, + toProtoMsg(message: MsgVoteWeighted): MsgVoteWeightedProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgVoteWeighted", + value: MsgVoteWeighted.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgVoteWeighted.typeUrl, MsgVoteWeighted); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgVoteWeighted.aminoType, MsgVoteWeighted.typeUrl); +function createBaseMsgVoteWeightedResponse(): MsgVoteWeightedResponse { + return {}; +} +export const MsgVoteWeightedResponse = { + typeUrl: "/cosmos.gov.v1.MsgVoteWeightedResponse", + aminoType: "cosmos-sdk/v1/MsgVoteWeightedResponse", + is(o: any): o is MsgVoteWeightedResponse { + return o && o.$typeUrl === MsgVoteWeightedResponse.typeUrl; + }, + isAmino(o: any): o is MsgVoteWeightedResponseAmino { + return o && o.$typeUrl === MsgVoteWeightedResponse.typeUrl; + }, + encode(_: MsgVoteWeightedResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteWeightedResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteWeightedResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgVoteWeightedResponse { + const message = createBaseMsgVoteWeightedResponse(); + return message; + }, + fromAmino(_: MsgVoteWeightedResponseAmino): MsgVoteWeightedResponse { + const message = createBaseMsgVoteWeightedResponse(); + return message; + }, + toAmino(_: MsgVoteWeightedResponse): MsgVoteWeightedResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgVoteWeightedResponseAminoMsg): MsgVoteWeightedResponse { + return MsgVoteWeightedResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgVoteWeightedResponse): MsgVoteWeightedResponseAminoMsg { + return { + type: "cosmos-sdk/v1/MsgVoteWeightedResponse", + value: MsgVoteWeightedResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgVoteWeightedResponseProtoMsg): MsgVoteWeightedResponse { + return MsgVoteWeightedResponse.decode(message.value); + }, + toProto(message: MsgVoteWeightedResponse): Uint8Array { + return MsgVoteWeightedResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgVoteWeightedResponse): MsgVoteWeightedResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgVoteWeightedResponse", + value: MsgVoteWeightedResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgVoteWeightedResponse.typeUrl, MsgVoteWeightedResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgVoteWeightedResponse.aminoType, MsgVoteWeightedResponse.typeUrl); +function createBaseMsgDeposit(): MsgDeposit { + return { + proposalId: BigInt(0), + depositor: "", + amount: [] + }; +} +export const MsgDeposit = { + typeUrl: "/cosmos.gov.v1.MsgDeposit", + aminoType: "cosmos-sdk/v1/MsgDeposit", + is(o: any): o is MsgDeposit { + return o && (o.$typeUrl === MsgDeposit.typeUrl || typeof o.proposalId === "bigint" && typeof o.depositor === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0]))); + }, + isAmino(o: any): o is MsgDepositAmino { + return o && (o.$typeUrl === MsgDeposit.typeUrl || typeof o.proposal_id === "bigint" && typeof o.depositor === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0]))); + }, + encode(message: MsgDeposit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeposit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.depositor = reader.string(); + break; + case 3: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgDeposit { + const message = createBaseMsgDeposit(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MsgDepositAmino): MsgDeposit { + const message = createBaseMsgDeposit(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.depositor !== undefined && object.depositor !== null) { + message.depositor = object.depositor; + } + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgDeposit): MsgDepositAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId?.toString() : "0"; + obj.depositor = message.depositor === "" ? undefined : message.depositor; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = message.amount; + } + return obj; + }, + fromAminoMsg(object: MsgDepositAminoMsg): MsgDeposit { + return MsgDeposit.fromAmino(object.value); + }, + toAminoMsg(message: MsgDeposit): MsgDepositAminoMsg { + return { + type: "cosmos-sdk/v1/MsgDeposit", + value: MsgDeposit.toAmino(message) + }; + }, + fromProtoMsg(message: MsgDepositProtoMsg): MsgDeposit { + return MsgDeposit.decode(message.value); + }, + toProto(message: MsgDeposit): Uint8Array { + return MsgDeposit.encode(message).finish(); + }, + toProtoMsg(message: MsgDeposit): MsgDepositProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgDeposit", + value: MsgDeposit.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgDeposit.typeUrl, MsgDeposit); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgDeposit.aminoType, MsgDeposit.typeUrl); +function createBaseMsgDepositResponse(): MsgDepositResponse { + return {}; +} +export const MsgDepositResponse = { + typeUrl: "/cosmos.gov.v1.MsgDepositResponse", + aminoType: "cosmos-sdk/v1/MsgDepositResponse", + is(o: any): o is MsgDepositResponse { + return o && o.$typeUrl === MsgDepositResponse.typeUrl; + }, + isAmino(o: any): o is MsgDepositResponseAmino { + return o && o.$typeUrl === MsgDepositResponse.typeUrl; + }, + encode(_: MsgDepositResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgDepositResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgDepositResponse { + const message = createBaseMsgDepositResponse(); + return message; + }, + fromAmino(_: MsgDepositResponseAmino): MsgDepositResponse { + const message = createBaseMsgDepositResponse(); + return message; + }, + toAmino(_: MsgDepositResponse): MsgDepositResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgDepositResponseAminoMsg): MsgDepositResponse { + return MsgDepositResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgDepositResponse): MsgDepositResponseAminoMsg { + return { + type: "cosmos-sdk/v1/MsgDepositResponse", + value: MsgDepositResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgDepositResponseProtoMsg): MsgDepositResponse { + return MsgDepositResponse.decode(message.value); + }, + toProto(message: MsgDepositResponse): Uint8Array { + return MsgDepositResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgDepositResponse): MsgDepositResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgDepositResponse", + value: MsgDepositResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgDepositResponse.typeUrl, MsgDepositResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgDepositResponse.aminoType, MsgDepositResponse.typeUrl); +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { + authority: "", + params: Params.fromPartial({}) + }; +} +export const MsgUpdateParams = { + typeUrl: "/cosmos.gov.v1.MsgUpdateParams", + aminoType: "cosmos-sdk/x/gov/v1/MsgUpdateParams", + is(o: any): o is MsgUpdateParams { + return o && (o.$typeUrl === MsgUpdateParams.typeUrl || typeof o.authority === "string" && Params.is(o.params)); + }, + isAmino(o: any): o is MsgUpdateParamsAmino { + return o && (o.$typeUrl === MsgUpdateParams.typeUrl || typeof o.authority === "string" && Params.isAmino(o.params)); + }, + encode(message: MsgUpdateParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + message.authority = object.authority ?? ""; + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: MsgUpdateParamsAmino): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: MsgUpdateParams): MsgUpdateParamsAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsAminoMsg): MsgUpdateParams { + return MsgUpdateParams.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParams): MsgUpdateParamsAminoMsg { + return { + type: "cosmos-sdk/x/gov/v1/MsgUpdateParams", + value: MsgUpdateParams.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsProtoMsg): MsgUpdateParams { + return MsgUpdateParams.decode(message.value); + }, + toProto(message: MsgUpdateParams): Uint8Array { + return MsgUpdateParams.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParams): MsgUpdateParamsProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgUpdateParams", + value: MsgUpdateParams.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgUpdateParams.typeUrl, MsgUpdateParams); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgUpdateParams.aminoType, MsgUpdateParams.typeUrl); +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} +export const MsgUpdateParamsResponse = { + typeUrl: "/cosmos.gov.v1.MsgUpdateParamsResponse", + aminoType: "cosmos-sdk/v1/MsgUpdateParamsResponse", + is(o: any): o is MsgUpdateParamsResponse { + return o && o.$typeUrl === MsgUpdateParamsResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateParamsResponseAmino { + return o && o.$typeUrl === MsgUpdateParamsResponse.typeUrl; + }, + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + fromAmino(_: MsgUpdateParamsResponseAmino): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + toAmino(_: MsgUpdateParamsResponse): MsgUpdateParamsResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsResponseAminoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseAminoMsg { + return { + type: "cosmos-sdk/v1/MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsResponseProtoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.decode(message.value); + }, + toProto(message: MsgUpdateParamsResponse): Uint8Array { + return MsgUpdateParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgUpdateParamsResponse.typeUrl, MsgUpdateParamsResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgUpdateParamsResponse.aminoType, MsgUpdateParamsResponse.typeUrl); +function createBaseMsgCancelProposal(): MsgCancelProposal { + return { + proposalId: BigInt(0), + proposer: "" + }; +} +export const MsgCancelProposal = { + typeUrl: "/cosmos.gov.v1.MsgCancelProposal", + aminoType: "cosmos-sdk/v1/MsgCancelProposal", + is(o: any): o is MsgCancelProposal { + return o && (o.$typeUrl === MsgCancelProposal.typeUrl || typeof o.proposalId === "bigint" && typeof o.proposer === "string"); + }, + isAmino(o: any): o is MsgCancelProposalAmino { + return o && (o.$typeUrl === MsgCancelProposal.typeUrl || typeof o.proposal_id === "bigint" && typeof o.proposer === "string"); + }, + encode(message: MsgCancelProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.proposer !== "") { + writer.uint32(18).string(message.proposer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.proposer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgCancelProposal { + const message = createBaseMsgCancelProposal(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.proposer = object.proposer ?? ""; + return message; + }, + fromAmino(object: MsgCancelProposalAmino): MsgCancelProposal { + const message = createBaseMsgCancelProposal(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.proposer !== undefined && object.proposer !== null) { + message.proposer = object.proposer; + } + return message; + }, + toAmino(message: MsgCancelProposal): MsgCancelProposalAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId?.toString() : "0"; + obj.proposer = message.proposer === "" ? undefined : message.proposer; + return obj; + }, + fromAminoMsg(object: MsgCancelProposalAminoMsg): MsgCancelProposal { + return MsgCancelProposal.fromAmino(object.value); + }, + toAminoMsg(message: MsgCancelProposal): MsgCancelProposalAminoMsg { + return { + type: "cosmos-sdk/v1/MsgCancelProposal", + value: MsgCancelProposal.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCancelProposalProtoMsg): MsgCancelProposal { + return MsgCancelProposal.decode(message.value); + }, + toProto(message: MsgCancelProposal): Uint8Array { + return MsgCancelProposal.encode(message).finish(); + }, + toProtoMsg(message: MsgCancelProposal): MsgCancelProposalProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgCancelProposal", + value: MsgCancelProposal.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgCancelProposal.typeUrl, MsgCancelProposal); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgCancelProposal.aminoType, MsgCancelProposal.typeUrl); +function createBaseMsgCancelProposalResponse(): MsgCancelProposalResponse { + return { + proposalId: BigInt(0), + canceledTime: new Date(), + canceledHeight: BigInt(0) + }; +} +export const MsgCancelProposalResponse = { + typeUrl: "/cosmos.gov.v1.MsgCancelProposalResponse", + aminoType: "cosmos-sdk/v1/MsgCancelProposalResponse", + is(o: any): o is MsgCancelProposalResponse { + return o && (o.$typeUrl === MsgCancelProposalResponse.typeUrl || typeof o.proposalId === "bigint" && Timestamp.is(o.canceledTime) && typeof o.canceledHeight === "bigint"); + }, + isAmino(o: any): o is MsgCancelProposalResponseAmino { + return o && (o.$typeUrl === MsgCancelProposalResponse.typeUrl || typeof o.proposal_id === "bigint" && Timestamp.isAmino(o.canceled_time) && typeof o.canceled_height === "bigint"); + }, + encode(message: MsgCancelProposalResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.canceledTime !== undefined) { + Timestamp.encode(toTimestamp(message.canceledTime), writer.uint32(18).fork()).ldelim(); + } + if (message.canceledHeight !== BigInt(0)) { + writer.uint32(24).uint64(message.canceledHeight); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.canceledTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 3: + message.canceledHeight = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgCancelProposalResponse { + const message = createBaseMsgCancelProposalResponse(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.canceledTime = object.canceledTime ?? undefined; + message.canceledHeight = object.canceledHeight !== undefined && object.canceledHeight !== null ? BigInt(object.canceledHeight.toString()) : BigInt(0); + return message; + }, + fromAmino(object: MsgCancelProposalResponseAmino): MsgCancelProposalResponse { + const message = createBaseMsgCancelProposalResponse(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.canceled_time !== undefined && object.canceled_time !== null) { + message.canceledTime = fromTimestamp(Timestamp.fromAmino(object.canceled_time)); + } + if (object.canceled_height !== undefined && object.canceled_height !== null) { + message.canceledHeight = BigInt(object.canceled_height); + } + return message; + }, + toAmino(message: MsgCancelProposalResponse): MsgCancelProposalResponseAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId?.toString() : "0"; + obj.canceled_time = message.canceledTime ? Timestamp.toAmino(toTimestamp(message.canceledTime)) : undefined; + obj.canceled_height = message.canceledHeight !== BigInt(0) ? message.canceledHeight?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: MsgCancelProposalResponseAminoMsg): MsgCancelProposalResponse { + return MsgCancelProposalResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgCancelProposalResponse): MsgCancelProposalResponseAminoMsg { + return { + type: "cosmos-sdk/v1/MsgCancelProposalResponse", + value: MsgCancelProposalResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCancelProposalResponseProtoMsg): MsgCancelProposalResponse { + return MsgCancelProposalResponse.decode(message.value); + }, + toProto(message: MsgCancelProposalResponse): Uint8Array { + return MsgCancelProposalResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgCancelProposalResponse): MsgCancelProposalResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1.MsgCancelProposalResponse", + value: MsgCancelProposalResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgCancelProposalResponse.typeUrl, MsgCancelProposalResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgCancelProposalResponse.aminoType, MsgCancelProposalResponse.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/gov/v1beta1/gov.ts b/libs/interchain-query/src/cosmos/gov/v1beta1/gov.ts new file mode 100644 index 00000000..f0bc1a0e --- /dev/null +++ b/libs/interchain-query/src/cosmos/gov/v1beta1/gov.ts @@ -0,0 +1,1423 @@ +import { Coin, CoinAmino } from "../../base/v1beta1/coin"; +import { Any, AnyProtoMsg, AnyAmino } from "../../../google/protobuf/any"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Duration, DurationAmino } from "../../../google/protobuf/duration"; +import { CommunityPoolSpendProposal, CommunityPoolSpendProposalProtoMsg, CommunityPoolSpendProposalWithDeposit, CommunityPoolSpendProposalWithDepositProtoMsg } from "../../distribution/v1beta1/distribution"; +import { SoftwareUpgradeProposal, SoftwareUpgradeProposalProtoMsg, CancelSoftwareUpgradeProposal, CancelSoftwareUpgradeProposalProtoMsg } from "../../upgrade/v1beta1/upgrade"; +import { ClientUpdateProposal, ClientUpdateProposalProtoMsg, UpgradeProposal, UpgradeProposalProtoMsg } from "../../../ibc/core/client/v1/client"; +import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; +/** VoteOption enumerates the valid vote options for a given governance proposal. */ +export enum VoteOption { + /** VOTE_OPTION_UNSPECIFIED - VOTE_OPTION_UNSPECIFIED defines a no-op vote option. */ + VOTE_OPTION_UNSPECIFIED = 0, + /** VOTE_OPTION_YES - VOTE_OPTION_YES defines a yes vote option. */ + VOTE_OPTION_YES = 1, + /** VOTE_OPTION_ABSTAIN - VOTE_OPTION_ABSTAIN defines an abstain vote option. */ + VOTE_OPTION_ABSTAIN = 2, + /** VOTE_OPTION_NO - VOTE_OPTION_NO defines a no vote option. */ + VOTE_OPTION_NO = 3, + /** VOTE_OPTION_NO_WITH_VETO - VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. */ + VOTE_OPTION_NO_WITH_VETO = 4, + UNRECOGNIZED = -1, +} +export const VoteOptionAmino = VoteOption; +export function voteOptionFromJSON(object: any): VoteOption { + switch (object) { + case 0: + case "VOTE_OPTION_UNSPECIFIED": + return VoteOption.VOTE_OPTION_UNSPECIFIED; + case 1: + case "VOTE_OPTION_YES": + return VoteOption.VOTE_OPTION_YES; + case 2: + case "VOTE_OPTION_ABSTAIN": + return VoteOption.VOTE_OPTION_ABSTAIN; + case 3: + case "VOTE_OPTION_NO": + return VoteOption.VOTE_OPTION_NO; + case 4: + case "VOTE_OPTION_NO_WITH_VETO": + return VoteOption.VOTE_OPTION_NO_WITH_VETO; + case -1: + case "UNRECOGNIZED": + default: + return VoteOption.UNRECOGNIZED; + } +} +export function voteOptionToJSON(object: VoteOption): string { + switch (object) { + case VoteOption.VOTE_OPTION_UNSPECIFIED: + return "VOTE_OPTION_UNSPECIFIED"; + case VoteOption.VOTE_OPTION_YES: + return "VOTE_OPTION_YES"; + case VoteOption.VOTE_OPTION_ABSTAIN: + return "VOTE_OPTION_ABSTAIN"; + case VoteOption.VOTE_OPTION_NO: + return "VOTE_OPTION_NO"; + case VoteOption.VOTE_OPTION_NO_WITH_VETO: + return "VOTE_OPTION_NO_WITH_VETO"; + case VoteOption.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** ProposalStatus enumerates the valid statuses of a proposal. */ +export enum ProposalStatus { + /** PROPOSAL_STATUS_UNSPECIFIED - PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status. */ + PROPOSAL_STATUS_UNSPECIFIED = 0, + /** + * PROPOSAL_STATUS_DEPOSIT_PERIOD - PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit + * period. + */ + PROPOSAL_STATUS_DEPOSIT_PERIOD = 1, + /** + * PROPOSAL_STATUS_VOTING_PERIOD - PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting + * period. + */ + PROPOSAL_STATUS_VOTING_PERIOD = 2, + /** + * PROPOSAL_STATUS_PASSED - PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has + * passed. + */ + PROPOSAL_STATUS_PASSED = 3, + /** + * PROPOSAL_STATUS_REJECTED - PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has + * been rejected. + */ + PROPOSAL_STATUS_REJECTED = 4, + /** + * PROPOSAL_STATUS_FAILED - PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has + * failed. + */ + PROPOSAL_STATUS_FAILED = 5, + UNRECOGNIZED = -1, +} +export const ProposalStatusAmino = ProposalStatus; +export function proposalStatusFromJSON(object: any): ProposalStatus { + switch (object) { + case 0: + case "PROPOSAL_STATUS_UNSPECIFIED": + return ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED; + case 1: + case "PROPOSAL_STATUS_DEPOSIT_PERIOD": + return ProposalStatus.PROPOSAL_STATUS_DEPOSIT_PERIOD; + case 2: + case "PROPOSAL_STATUS_VOTING_PERIOD": + return ProposalStatus.PROPOSAL_STATUS_VOTING_PERIOD; + case 3: + case "PROPOSAL_STATUS_PASSED": + return ProposalStatus.PROPOSAL_STATUS_PASSED; + case 4: + case "PROPOSAL_STATUS_REJECTED": + return ProposalStatus.PROPOSAL_STATUS_REJECTED; + case 5: + case "PROPOSAL_STATUS_FAILED": + return ProposalStatus.PROPOSAL_STATUS_FAILED; + case -1: + case "UNRECOGNIZED": + default: + return ProposalStatus.UNRECOGNIZED; + } +} +export function proposalStatusToJSON(object: ProposalStatus): string { + switch (object) { + case ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED: + return "PROPOSAL_STATUS_UNSPECIFIED"; + case ProposalStatus.PROPOSAL_STATUS_DEPOSIT_PERIOD: + return "PROPOSAL_STATUS_DEPOSIT_PERIOD"; + case ProposalStatus.PROPOSAL_STATUS_VOTING_PERIOD: + return "PROPOSAL_STATUS_VOTING_PERIOD"; + case ProposalStatus.PROPOSAL_STATUS_PASSED: + return "PROPOSAL_STATUS_PASSED"; + case ProposalStatus.PROPOSAL_STATUS_REJECTED: + return "PROPOSAL_STATUS_REJECTED"; + case ProposalStatus.PROPOSAL_STATUS_FAILED: + return "PROPOSAL_STATUS_FAILED"; + case ProposalStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** + * WeightedVoteOption defines a unit of vote for vote split. + * + * Since: cosmos-sdk 0.43 + */ +export interface WeightedVoteOption { + /** option defines the valid vote options, it must not contain duplicate vote options. */ + option: VoteOption; + /** weight is the vote weight associated with the vote option. */ + weight: string; +} +export interface WeightedVoteOptionProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.WeightedVoteOption"; + value: Uint8Array; +} +/** + * WeightedVoteOption defines a unit of vote for vote split. + * + * Since: cosmos-sdk 0.43 + */ +export interface WeightedVoteOptionAmino { + /** option defines the valid vote options, it must not contain duplicate vote options. */ + option: VoteOption; + /** weight is the vote weight associated with the vote option. */ + weight: string; +} +export interface WeightedVoteOptionAminoMsg { + type: "cosmos-sdk/WeightedVoteOption"; + value: WeightedVoteOptionAmino; +} +/** + * TextProposal defines a standard text proposal whose changes need to be + * manually updated in case of approval. + */ +export interface TextProposal { + /** title of the proposal. */ + title: string; + /** description associated with the proposal. */ + description: string; +} +export interface TextProposalProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.TextProposal"; + value: Uint8Array; +} +/** + * TextProposal defines a standard text proposal whose changes need to be + * manually updated in case of approval. + */ +export interface TextProposalAmino { + /** title of the proposal. */ + title: string; + /** description associated with the proposal. */ + description: string; +} +export interface TextProposalAminoMsg { + type: "cosmos-sdk/TextProposal"; + value: TextProposalAmino; +} +/** + * Deposit defines an amount deposited by an account address to an active + * proposal. + */ +export interface Deposit { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** amount to be deposited by depositor. */ + amount: Coin[]; +} +export interface DepositProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.Deposit"; + value: Uint8Array; +} +/** + * Deposit defines an amount deposited by an account address to an active + * proposal. + */ +export interface DepositAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** amount to be deposited by depositor. */ + amount: CoinAmino[]; +} +export interface DepositAminoMsg { + type: "cosmos-sdk/Deposit"; + value: DepositAmino; +} +/** Proposal defines the core field members of a governance proposal. */ +export interface Proposal { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; + /** content is the proposal's content. */ + content?: TextProposal | CommunityPoolSpendProposal | CommunityPoolSpendProposalWithDeposit | SoftwareUpgradeProposal | CancelSoftwareUpgradeProposal | ClientUpdateProposal | UpgradeProposal | Any | undefined; + /** status defines the proposal status. */ + status: ProposalStatus; + /** + * final_tally_result is the final tally result of the proposal. When + * querying a proposal via gRPC, this field is not populated until the + * proposal's voting period has ended. + */ + finalTallyResult: TallyResult; + /** submit_time is the time of proposal submission. */ + submitTime: Date; + /** deposit_end_time is the end time for deposition. */ + depositEndTime: Date; + /** total_deposit is the total deposit on the proposal. */ + totalDeposit: Coin[]; + /** voting_start_time is the starting time to vote on a proposal. */ + votingStartTime: Date; + /** voting_end_time is the end time of voting on a proposal. */ + votingEndTime: Date; +} +export interface ProposalProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.Proposal"; + value: Uint8Array; +} +export type ProposalEncoded = Omit & { + /** content is the proposal's content. */content?: TextProposalProtoMsg | CommunityPoolSpendProposalProtoMsg | CommunityPoolSpendProposalWithDepositProtoMsg | SoftwareUpgradeProposalProtoMsg | CancelSoftwareUpgradeProposalProtoMsg | ClientUpdateProposalProtoMsg | UpgradeProposalProtoMsg | AnyProtoMsg | undefined; +}; +/** Proposal defines the core field members of a governance proposal. */ +export interface ProposalAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** content is the proposal's content. */ + content?: AnyAmino; + /** status defines the proposal status. */ + status: ProposalStatus; + /** + * final_tally_result is the final tally result of the proposal. When + * querying a proposal via gRPC, this field is not populated until the + * proposal's voting period has ended. + */ + final_tally_result: TallyResultAmino; + /** submit_time is the time of proposal submission. */ + submit_time: string; + /** deposit_end_time is the end time for deposition. */ + deposit_end_time: string; + /** total_deposit is the total deposit on the proposal. */ + total_deposit: CoinAmino[]; + /** voting_start_time is the starting time to vote on a proposal. */ + voting_start_time: string; + /** voting_end_time is the end time of voting on a proposal. */ + voting_end_time: string; +} +export interface ProposalAminoMsg { + type: "cosmos-sdk/Proposal"; + value: ProposalAmino; +} +/** TallyResult defines a standard tally for a governance proposal. */ +export interface TallyResult { + /** yes is the number of yes votes on a proposal. */ + yes: string; + /** abstain is the number of abstain votes on a proposal. */ + abstain: string; + /** no is the number of no votes on a proposal. */ + no: string; + /** no_with_veto is the number of no with veto votes on a proposal. */ + noWithVeto: string; +} +export interface TallyResultProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.TallyResult"; + value: Uint8Array; +} +/** TallyResult defines a standard tally for a governance proposal. */ +export interface TallyResultAmino { + /** yes is the number of yes votes on a proposal. */ + yes: string; + /** abstain is the number of abstain votes on a proposal. */ + abstain: string; + /** no is the number of no votes on a proposal. */ + no: string; + /** no_with_veto is the number of no with veto votes on a proposal. */ + no_with_veto: string; +} +export interface TallyResultAminoMsg { + type: "cosmos-sdk/TallyResult"; + value: TallyResultAmino; +} +/** + * Vote defines a vote on a governance proposal. + * A Vote consists of a proposal ID, the voter, and the vote option. + */ +export interface Vote { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; + /** voter is the voter address of the proposal. */ + voter: string; + /** + * Deprecated: Prefer to use `options` instead. This field is set in queries + * if and only if `len(options) == 1` and that option has weight 1. In all + * other cases, this field will default to VOTE_OPTION_UNSPECIFIED. + */ + /** @deprecated */ + option: VoteOption; + /** + * options is the weighted vote options. + * + * Since: cosmos-sdk 0.43 + */ + options: WeightedVoteOption[]; +} +export interface VoteProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.Vote"; + value: Uint8Array; +} +/** + * Vote defines a vote on a governance proposal. + * A Vote consists of a proposal ID, the voter, and the vote option. + */ +export interface VoteAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** voter is the voter address of the proposal. */ + voter: string; + /** + * Deprecated: Prefer to use `options` instead. This field is set in queries + * if and only if `len(options) == 1` and that option has weight 1. In all + * other cases, this field will default to VOTE_OPTION_UNSPECIFIED. + */ + /** @deprecated */ + option: VoteOption; + /** + * options is the weighted vote options. + * + * Since: cosmos-sdk 0.43 + */ + options: WeightedVoteOptionAmino[]; +} +export interface VoteAminoMsg { + type: "cosmos-sdk/Vote"; + value: VoteAmino; +} +/** DepositParams defines the params for deposits on governance proposals. */ +export interface DepositParams { + /** Minimum deposit for a proposal to enter voting period. */ + minDeposit: Coin[]; + /** + * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + * months. + */ + maxDepositPeriod: Duration; +} +export interface DepositParamsProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.DepositParams"; + value: Uint8Array; +} +/** DepositParams defines the params for deposits on governance proposals. */ +export interface DepositParamsAmino { + /** Minimum deposit for a proposal to enter voting period. */ + min_deposit: CoinAmino[]; + /** + * Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + * months. + */ + max_deposit_period: DurationAmino; +} +export interface DepositParamsAminoMsg { + type: "cosmos-sdk/DepositParams"; + value: DepositParamsAmino; +} +/** VotingParams defines the params for voting on governance proposals. */ +export interface VotingParams { + /** Duration of the voting period. */ + votingPeriod: Duration; +} +export interface VotingParamsProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.VotingParams"; + value: Uint8Array; +} +/** VotingParams defines the params for voting on governance proposals. */ +export interface VotingParamsAmino { + /** Duration of the voting period. */ + voting_period: DurationAmino; +} +export interface VotingParamsAminoMsg { + type: "cosmos-sdk/VotingParams"; + value: VotingParamsAmino; +} +/** TallyParams defines the params for tallying votes on governance proposals. */ +export interface TallyParams { + /** + * Minimum percentage of total stake needed to vote for a result to be + * considered valid. + */ + quorum: Uint8Array; + /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. */ + threshold: Uint8Array; + /** + * Minimum value of Veto votes to Total votes ratio for proposal to be + * vetoed. Default value: 1/3. + */ + vetoThreshold: Uint8Array; +} +export interface TallyParamsProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.TallyParams"; + value: Uint8Array; +} +/** TallyParams defines the params for tallying votes on governance proposals. */ +export interface TallyParamsAmino { + /** + * Minimum percentage of total stake needed to vote for a result to be + * considered valid. + */ + quorum: string; + /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. */ + threshold: string; + /** + * Minimum value of Veto votes to Total votes ratio for proposal to be + * vetoed. Default value: 1/3. + */ + veto_threshold: string; +} +export interface TallyParamsAminoMsg { + type: "cosmos-sdk/TallyParams"; + value: TallyParamsAmino; +} +function createBaseWeightedVoteOption(): WeightedVoteOption { + return { + option: 0, + weight: "" + }; +} +export const WeightedVoteOption = { + typeUrl: "/cosmos.gov.v1beta1.WeightedVoteOption", + aminoType: "cosmos-sdk/WeightedVoteOption", + is(o: any): o is WeightedVoteOption { + return o && (o.$typeUrl === WeightedVoteOption.typeUrl || isSet(o.option) && typeof o.weight === "string"); + }, + isAmino(o: any): o is WeightedVoteOptionAmino { + return o && (o.$typeUrl === WeightedVoteOption.typeUrl || isSet(o.option) && typeof o.weight === "string"); + }, + encode(message: WeightedVoteOption, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.option !== 0) { + writer.uint32(8).int32(message.option); + } + if (message.weight !== "") { + writer.uint32(18).string(message.weight); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): WeightedVoteOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseWeightedVoteOption(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.option = (reader.int32() as any); + break; + case 2: + message.weight = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): WeightedVoteOption { + const message = createBaseWeightedVoteOption(); + message.option = object.option ?? 0; + message.weight = object.weight ?? ""; + return message; + }, + fromAmino(object: WeightedVoteOptionAmino): WeightedVoteOption { + const message = createBaseWeightedVoteOption(); + if (object.option !== undefined && object.option !== null) { + message.option = object.option; + } + if (object.weight !== undefined && object.weight !== null) { + message.weight = object.weight; + } + return message; + }, + toAmino(message: WeightedVoteOption): WeightedVoteOptionAmino { + const obj: any = {}; + obj.option = message.option === 0 ? undefined : message.option; + obj.weight = message.weight ?? ""; + return obj; + }, + fromAminoMsg(object: WeightedVoteOptionAminoMsg): WeightedVoteOption { + return WeightedVoteOption.fromAmino(object.value); + }, + toAminoMsg(message: WeightedVoteOption): WeightedVoteOptionAminoMsg { + return { + type: "cosmos-sdk/WeightedVoteOption", + value: WeightedVoteOption.toAmino(message) + }; + }, + fromProtoMsg(message: WeightedVoteOptionProtoMsg): WeightedVoteOption { + return WeightedVoteOption.decode(message.value); + }, + toProto(message: WeightedVoteOption): Uint8Array { + return WeightedVoteOption.encode(message).finish(); + }, + toProtoMsg(message: WeightedVoteOption): WeightedVoteOptionProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.WeightedVoteOption", + value: WeightedVoteOption.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(WeightedVoteOption.typeUrl, WeightedVoteOption); +GlobalDecoderRegistry.registerAminoProtoMapping(WeightedVoteOption.aminoType, WeightedVoteOption.typeUrl); +function createBaseTextProposal(): TextProposal { + return { + title: "", + description: "" + }; +} +export const TextProposal = { + typeUrl: "/cosmos.gov.v1beta1.TextProposal", + aminoType: "cosmos-sdk/TextProposal", + is(o: any): o is TextProposal { + return o && (o.$typeUrl === TextProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string"); + }, + isAmino(o: any): o is TextProposalAmino { + return o && (o.$typeUrl === TextProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string"); + }, + encode(message: TextProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TextProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTextProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): TextProposal { + const message = createBaseTextProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + return message; + }, + fromAmino(object: TextProposalAmino): TextProposal { + const message = createBaseTextProposal(); + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + return message; + }, + toAmino(message: TextProposal): TextProposalAmino { + const obj: any = {}; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + return obj; + }, + fromAminoMsg(object: TextProposalAminoMsg): TextProposal { + return TextProposal.fromAmino(object.value); + }, + toAminoMsg(message: TextProposal): TextProposalAminoMsg { + return { + type: "cosmos-sdk/TextProposal", + value: TextProposal.toAmino(message) + }; + }, + fromProtoMsg(message: TextProposalProtoMsg): TextProposal { + return TextProposal.decode(message.value); + }, + toProto(message: TextProposal): Uint8Array { + return TextProposal.encode(message).finish(); + }, + toProtoMsg(message: TextProposal): TextProposalProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.TextProposal", + value: TextProposal.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(TextProposal.typeUrl, TextProposal); +GlobalDecoderRegistry.registerAminoProtoMapping(TextProposal.aminoType, TextProposal.typeUrl); +function createBaseDeposit(): Deposit { + return { + proposalId: BigInt(0), + depositor: "", + amount: [] + }; +} +export const Deposit = { + typeUrl: "/cosmos.gov.v1beta1.Deposit", + aminoType: "cosmos-sdk/Deposit", + is(o: any): o is Deposit { + return o && (o.$typeUrl === Deposit.typeUrl || typeof o.proposalId === "bigint" && typeof o.depositor === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0]))); + }, + isAmino(o: any): o is DepositAmino { + return o && (o.$typeUrl === Deposit.typeUrl || typeof o.proposal_id === "bigint" && typeof o.depositor === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0]))); + }, + encode(message: Deposit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Deposit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.depositor = reader.string(); + break; + case 3: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Deposit { + const message = createBaseDeposit(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: DepositAmino): Deposit { + const message = createBaseDeposit(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.depositor !== undefined && object.depositor !== null) { + message.depositor = object.depositor; + } + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: Deposit): DepositAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId?.toString() : undefined; + obj.depositor = message.depositor === "" ? undefined : message.depositor; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = message.amount; + } + return obj; + }, + fromAminoMsg(object: DepositAminoMsg): Deposit { + return Deposit.fromAmino(object.value); + }, + toAminoMsg(message: Deposit): DepositAminoMsg { + return { + type: "cosmos-sdk/Deposit", + value: Deposit.toAmino(message) + }; + }, + fromProtoMsg(message: DepositProtoMsg): Deposit { + return Deposit.decode(message.value); + }, + toProto(message: Deposit): Uint8Array { + return Deposit.encode(message).finish(); + }, + toProtoMsg(message: Deposit): DepositProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.Deposit", + value: Deposit.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Deposit.typeUrl, Deposit); +GlobalDecoderRegistry.registerAminoProtoMapping(Deposit.aminoType, Deposit.typeUrl); +function createBaseProposal(): Proposal { + return { + proposalId: BigInt(0), + content: undefined, + status: 0, + finalTallyResult: TallyResult.fromPartial({}), + submitTime: new Date(), + depositEndTime: new Date(), + totalDeposit: [], + votingStartTime: new Date(), + votingEndTime: new Date() + }; +} +export const Proposal = { + typeUrl: "/cosmos.gov.v1beta1.Proposal", + aminoType: "cosmos-sdk/Proposal", + is(o: any): o is Proposal { + return o && (o.$typeUrl === Proposal.typeUrl || typeof o.proposalId === "bigint" && isSet(o.status) && TallyResult.is(o.finalTallyResult) && Timestamp.is(o.submitTime) && Timestamp.is(o.depositEndTime) && Array.isArray(o.totalDeposit) && (!o.totalDeposit.length || Coin.is(o.totalDeposit[0])) && Timestamp.is(o.votingStartTime) && Timestamp.is(o.votingEndTime)); + }, + isAmino(o: any): o is ProposalAmino { + return o && (o.$typeUrl === Proposal.typeUrl || typeof o.proposal_id === "bigint" && isSet(o.status) && TallyResult.isAmino(o.final_tally_result) && Timestamp.isAmino(o.submit_time) && Timestamp.isAmino(o.deposit_end_time) && Array.isArray(o.total_deposit) && (!o.total_deposit.length || Coin.isAmino(o.total_deposit[0])) && Timestamp.isAmino(o.voting_start_time) && Timestamp.isAmino(o.voting_end_time)); + }, + encode(message: Proposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.content !== undefined) { + Any.encode(GlobalDecoderRegistry.wrapAny(message.content), writer.uint32(18).fork()).ldelim(); + } + if (message.status !== 0) { + writer.uint32(24).int32(message.status); + } + if (message.finalTallyResult !== undefined) { + TallyResult.encode(message.finalTallyResult, writer.uint32(34).fork()).ldelim(); + } + if (message.submitTime !== undefined) { + Timestamp.encode(toTimestamp(message.submitTime), writer.uint32(42).fork()).ldelim(); + } + if (message.depositEndTime !== undefined) { + Timestamp.encode(toTimestamp(message.depositEndTime), writer.uint32(50).fork()).ldelim(); + } + for (const v of message.totalDeposit) { + Coin.encode(v!, writer.uint32(58).fork()).ldelim(); + } + if (message.votingStartTime !== undefined) { + Timestamp.encode(toTimestamp(message.votingStartTime), writer.uint32(66).fork()).ldelim(); + } + if (message.votingEndTime !== undefined) { + Timestamp.encode(toTimestamp(message.votingEndTime), writer.uint32(74).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Proposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.content = GlobalDecoderRegistry.unwrapAny(reader); + break; + case 3: + message.status = (reader.int32() as any); + break; + case 4: + message.finalTallyResult = TallyResult.decode(reader, reader.uint32()); + break; + case 5: + message.submitTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 6: + message.depositEndTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 7: + message.totalDeposit.push(Coin.decode(reader, reader.uint32())); + break; + case 8: + message.votingStartTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 9: + message.votingEndTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Proposal { + const message = createBaseProposal(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.content = object.content !== undefined && object.content !== null ? GlobalDecoderRegistry.fromPartial(object.content) : undefined; + message.status = object.status ?? 0; + message.finalTallyResult = object.finalTallyResult !== undefined && object.finalTallyResult !== null ? TallyResult.fromPartial(object.finalTallyResult) : undefined; + message.submitTime = object.submitTime ?? undefined; + message.depositEndTime = object.depositEndTime ?? undefined; + message.totalDeposit = object.totalDeposit?.map(e => Coin.fromPartial(e)) || []; + message.votingStartTime = object.votingStartTime ?? undefined; + message.votingEndTime = object.votingEndTime ?? undefined; + return message; + }, + fromAmino(object: ProposalAmino): Proposal { + const message = createBaseProposal(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.content !== undefined && object.content !== null) { + message.content = GlobalDecoderRegistry.fromAminoMsg(object.content); + } + if (object.status !== undefined && object.status !== null) { + message.status = object.status; + } + if (object.final_tally_result !== undefined && object.final_tally_result !== null) { + message.finalTallyResult = TallyResult.fromAmino(object.final_tally_result); + } + if (object.submit_time !== undefined && object.submit_time !== null) { + message.submitTime = fromTimestamp(Timestamp.fromAmino(object.submit_time)); + } + if (object.deposit_end_time !== undefined && object.deposit_end_time !== null) { + message.depositEndTime = fromTimestamp(Timestamp.fromAmino(object.deposit_end_time)); + } + message.totalDeposit = object.total_deposit?.map(e => Coin.fromAmino(e)) || []; + if (object.voting_start_time !== undefined && object.voting_start_time !== null) { + message.votingStartTime = fromTimestamp(Timestamp.fromAmino(object.voting_start_time)); + } + if (object.voting_end_time !== undefined && object.voting_end_time !== null) { + message.votingEndTime = fromTimestamp(Timestamp.fromAmino(object.voting_end_time)); + } + return message; + }, + toAmino(message: Proposal): ProposalAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId?.toString() : undefined; + obj.content = message.content ? GlobalDecoderRegistry.toAminoMsg(message.content) : undefined; + obj.status = message.status === 0 ? undefined : message.status; + obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : TallyResult.toAmino(TallyResult.fromPartial({})); + obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : new Date(); + obj.deposit_end_time = message.depositEndTime ? Timestamp.toAmino(toTimestamp(message.depositEndTime)) : new Date(); + if (message.totalDeposit) { + obj.total_deposit = message.totalDeposit.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.total_deposit = message.totalDeposit; + } + obj.voting_start_time = message.votingStartTime ? Timestamp.toAmino(toTimestamp(message.votingStartTime)) : new Date(); + obj.voting_end_time = message.votingEndTime ? Timestamp.toAmino(toTimestamp(message.votingEndTime)) : new Date(); + return obj; + }, + fromAminoMsg(object: ProposalAminoMsg): Proposal { + return Proposal.fromAmino(object.value); + }, + toAminoMsg(message: Proposal): ProposalAminoMsg { + return { + type: "cosmos-sdk/Proposal", + value: Proposal.toAmino(message) + }; + }, + fromProtoMsg(message: ProposalProtoMsg): Proposal { + return Proposal.decode(message.value); + }, + toProto(message: Proposal): Uint8Array { + return Proposal.encode(message).finish(); + }, + toProtoMsg(message: Proposal): ProposalProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.Proposal", + value: Proposal.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Proposal.typeUrl, Proposal); +GlobalDecoderRegistry.registerAminoProtoMapping(Proposal.aminoType, Proposal.typeUrl); +function createBaseTallyResult(): TallyResult { + return { + yes: "", + abstain: "", + no: "", + noWithVeto: "" + }; +} +export const TallyResult = { + typeUrl: "/cosmos.gov.v1beta1.TallyResult", + aminoType: "cosmos-sdk/TallyResult", + is(o: any): o is TallyResult { + return o && (o.$typeUrl === TallyResult.typeUrl || typeof o.yes === "string" && typeof o.abstain === "string" && typeof o.no === "string" && typeof o.noWithVeto === "string"); + }, + isAmino(o: any): o is TallyResultAmino { + return o && (o.$typeUrl === TallyResult.typeUrl || typeof o.yes === "string" && typeof o.abstain === "string" && typeof o.no === "string" && typeof o.no_with_veto === "string"); + }, + encode(message: TallyResult, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.yes !== "") { + writer.uint32(10).string(message.yes); + } + if (message.abstain !== "") { + writer.uint32(18).string(message.abstain); + } + if (message.no !== "") { + writer.uint32(26).string(message.no); + } + if (message.noWithVeto !== "") { + writer.uint32(34).string(message.noWithVeto); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TallyResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTallyResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.yes = reader.string(); + break; + case 2: + message.abstain = reader.string(); + break; + case 3: + message.no = reader.string(); + break; + case 4: + message.noWithVeto = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): TallyResult { + const message = createBaseTallyResult(); + message.yes = object.yes ?? ""; + message.abstain = object.abstain ?? ""; + message.no = object.no ?? ""; + message.noWithVeto = object.noWithVeto ?? ""; + return message; + }, + fromAmino(object: TallyResultAmino): TallyResult { + const message = createBaseTallyResult(); + if (object.yes !== undefined && object.yes !== null) { + message.yes = object.yes; + } + if (object.abstain !== undefined && object.abstain !== null) { + message.abstain = object.abstain; + } + if (object.no !== undefined && object.no !== null) { + message.no = object.no; + } + if (object.no_with_veto !== undefined && object.no_with_veto !== null) { + message.noWithVeto = object.no_with_veto; + } + return message; + }, + toAmino(message: TallyResult): TallyResultAmino { + const obj: any = {}; + obj.yes = message.yes === "" ? undefined : message.yes; + obj.abstain = message.abstain === "" ? undefined : message.abstain; + obj.no = message.no === "" ? undefined : message.no; + obj.no_with_veto = message.noWithVeto === "" ? undefined : message.noWithVeto; + return obj; + }, + fromAminoMsg(object: TallyResultAminoMsg): TallyResult { + return TallyResult.fromAmino(object.value); + }, + toAminoMsg(message: TallyResult): TallyResultAminoMsg { + return { + type: "cosmos-sdk/TallyResult", + value: TallyResult.toAmino(message) + }; + }, + fromProtoMsg(message: TallyResultProtoMsg): TallyResult { + return TallyResult.decode(message.value); + }, + toProto(message: TallyResult): Uint8Array { + return TallyResult.encode(message).finish(); + }, + toProtoMsg(message: TallyResult): TallyResultProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.TallyResult", + value: TallyResult.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(TallyResult.typeUrl, TallyResult); +GlobalDecoderRegistry.registerAminoProtoMapping(TallyResult.aminoType, TallyResult.typeUrl); +function createBaseVote(): Vote { + return { + proposalId: BigInt(0), + voter: "", + option: 0, + options: [] + }; +} +export const Vote = { + typeUrl: "/cosmos.gov.v1beta1.Vote", + aminoType: "cosmos-sdk/Vote", + is(o: any): o is Vote { + return o && (o.$typeUrl === Vote.typeUrl || typeof o.proposalId === "bigint" && typeof o.voter === "string" && isSet(o.option) && Array.isArray(o.options) && (!o.options.length || WeightedVoteOption.is(o.options[0]))); + }, + isAmino(o: any): o is VoteAmino { + return o && (o.$typeUrl === Vote.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string" && isSet(o.option) && Array.isArray(o.options) && (!o.options.length || WeightedVoteOption.isAmino(o.options[0]))); + }, + encode(message: Vote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== 0) { + writer.uint32(24).int32(message.option); + } + for (const v of message.options) { + WeightedVoteOption.encode(v!, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Vote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.voter = reader.string(); + break; + case 3: + message.option = (reader.int32() as any); + break; + case 4: + message.options.push(WeightedVoteOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Vote { + const message = createBaseVote(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.voter = object.voter ?? ""; + message.option = object.option ?? 0; + message.options = object.options?.map(e => WeightedVoteOption.fromPartial(e)) || []; + return message; + }, + fromAmino(object: VoteAmino): Vote { + const message = createBaseVote(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.voter !== undefined && object.voter !== null) { + message.voter = object.voter; + } + if (object.option !== undefined && object.option !== null) { + message.option = object.option; + } + message.options = object.options?.map(e => WeightedVoteOption.fromAmino(e)) || []; + return message; + }, + toAmino(message: Vote): VoteAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId?.toString() : "0"; + obj.voter = message.voter === "" ? undefined : message.voter; + obj.option = message.option === 0 ? undefined : message.option; + if (message.options) { + obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); + } else { + obj.options = message.options; + } + return obj; + }, + fromAminoMsg(object: VoteAminoMsg): Vote { + return Vote.fromAmino(object.value); + }, + toAminoMsg(message: Vote): VoteAminoMsg { + return { + type: "cosmos-sdk/Vote", + value: Vote.toAmino(message) + }; + }, + fromProtoMsg(message: VoteProtoMsg): Vote { + return Vote.decode(message.value); + }, + toProto(message: Vote): Uint8Array { + return Vote.encode(message).finish(); + }, + toProtoMsg(message: Vote): VoteProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.Vote", + value: Vote.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Vote.typeUrl, Vote); +GlobalDecoderRegistry.registerAminoProtoMapping(Vote.aminoType, Vote.typeUrl); +function createBaseDepositParams(): DepositParams { + return { + minDeposit: [], + maxDepositPeriod: Duration.fromPartial({}) + }; +} +export const DepositParams = { + typeUrl: "/cosmos.gov.v1beta1.DepositParams", + aminoType: "cosmos-sdk/DepositParams", + is(o: any): o is DepositParams { + return o && (o.$typeUrl === DepositParams.typeUrl || Array.isArray(o.minDeposit) && (!o.minDeposit.length || Coin.is(o.minDeposit[0])) && Duration.is(o.maxDepositPeriod)); + }, + isAmino(o: any): o is DepositParamsAmino { + return o && (o.$typeUrl === DepositParams.typeUrl || Array.isArray(o.min_deposit) && (!o.min_deposit.length || Coin.isAmino(o.min_deposit[0])) && Duration.isAmino(o.max_deposit_period)); + }, + encode(message: DepositParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.minDeposit) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.maxDepositPeriod !== undefined) { + Duration.encode(message.maxDepositPeriod, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DepositParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDepositParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.minDeposit.push(Coin.decode(reader, reader.uint32())); + break; + case 2: + message.maxDepositPeriod = Duration.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): DepositParams { + const message = createBaseDepositParams(); + message.minDeposit = object.minDeposit?.map(e => Coin.fromPartial(e)) || []; + message.maxDepositPeriod = object.maxDepositPeriod !== undefined && object.maxDepositPeriod !== null ? Duration.fromPartial(object.maxDepositPeriod) : undefined; + return message; + }, + fromAmino(object: DepositParamsAmino): DepositParams { + const message = createBaseDepositParams(); + message.minDeposit = object.min_deposit?.map(e => Coin.fromAmino(e)) || []; + if (object.max_deposit_period !== undefined && object.max_deposit_period !== null) { + message.maxDepositPeriod = Duration.fromAmino(object.max_deposit_period); + } + return message; + }, + toAmino(message: DepositParams): DepositParamsAmino { + const obj: any = {}; + if (message.minDeposit) { + obj.min_deposit = message.minDeposit.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.min_deposit = message.minDeposit; + } + obj.max_deposit_period = message.maxDepositPeriod ? Duration.toAmino(message.maxDepositPeriod) : undefined; + return obj; + }, + fromAminoMsg(object: DepositParamsAminoMsg): DepositParams { + return DepositParams.fromAmino(object.value); + }, + toAminoMsg(message: DepositParams): DepositParamsAminoMsg { + return { + type: "cosmos-sdk/DepositParams", + value: DepositParams.toAmino(message) + }; + }, + fromProtoMsg(message: DepositParamsProtoMsg): DepositParams { + return DepositParams.decode(message.value); + }, + toProto(message: DepositParams): Uint8Array { + return DepositParams.encode(message).finish(); + }, + toProtoMsg(message: DepositParams): DepositParamsProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.DepositParams", + value: DepositParams.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(DepositParams.typeUrl, DepositParams); +GlobalDecoderRegistry.registerAminoProtoMapping(DepositParams.aminoType, DepositParams.typeUrl); +function createBaseVotingParams(): VotingParams { + return { + votingPeriod: Duration.fromPartial({}) + }; +} +export const VotingParams = { + typeUrl: "/cosmos.gov.v1beta1.VotingParams", + aminoType: "cosmos-sdk/VotingParams", + is(o: any): o is VotingParams { + return o && (o.$typeUrl === VotingParams.typeUrl || Duration.is(o.votingPeriod)); + }, + isAmino(o: any): o is VotingParamsAmino { + return o && (o.$typeUrl === VotingParams.typeUrl || Duration.isAmino(o.voting_period)); + }, + encode(message: VotingParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.votingPeriod !== undefined) { + Duration.encode(message.votingPeriod, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): VotingParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVotingParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.votingPeriod = Duration.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): VotingParams { + const message = createBaseVotingParams(); + message.votingPeriod = object.votingPeriod !== undefined && object.votingPeriod !== null ? Duration.fromPartial(object.votingPeriod) : undefined; + return message; + }, + fromAmino(object: VotingParamsAmino): VotingParams { + const message = createBaseVotingParams(); + if (object.voting_period !== undefined && object.voting_period !== null) { + message.votingPeriod = Duration.fromAmino(object.voting_period); + } + return message; + }, + toAmino(message: VotingParams): VotingParamsAmino { + const obj: any = {}; + obj.voting_period = message.votingPeriod ? Duration.toAmino(message.votingPeriod) : undefined; + return obj; + }, + fromAminoMsg(object: VotingParamsAminoMsg): VotingParams { + return VotingParams.fromAmino(object.value); + }, + toAminoMsg(message: VotingParams): VotingParamsAminoMsg { + return { + type: "cosmos-sdk/VotingParams", + value: VotingParams.toAmino(message) + }; + }, + fromProtoMsg(message: VotingParamsProtoMsg): VotingParams { + return VotingParams.decode(message.value); + }, + toProto(message: VotingParams): Uint8Array { + return VotingParams.encode(message).finish(); + }, + toProtoMsg(message: VotingParams): VotingParamsProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.VotingParams", + value: VotingParams.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(VotingParams.typeUrl, VotingParams); +GlobalDecoderRegistry.registerAminoProtoMapping(VotingParams.aminoType, VotingParams.typeUrl); +function createBaseTallyParams(): TallyParams { + return { + quorum: new Uint8Array(), + threshold: new Uint8Array(), + vetoThreshold: new Uint8Array() + }; +} +export const TallyParams = { + typeUrl: "/cosmos.gov.v1beta1.TallyParams", + aminoType: "cosmos-sdk/TallyParams", + is(o: any): o is TallyParams { + return o && (o.$typeUrl === TallyParams.typeUrl || (o.quorum instanceof Uint8Array || typeof o.quorum === "string") && (o.threshold instanceof Uint8Array || typeof o.threshold === "string") && (o.vetoThreshold instanceof Uint8Array || typeof o.vetoThreshold === "string")); + }, + isAmino(o: any): o is TallyParamsAmino { + return o && (o.$typeUrl === TallyParams.typeUrl || (o.quorum instanceof Uint8Array || typeof o.quorum === "string") && (o.threshold instanceof Uint8Array || typeof o.threshold === "string") && (o.veto_threshold instanceof Uint8Array || typeof o.veto_threshold === "string")); + }, + encode(message: TallyParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.quorum.length !== 0) { + writer.uint32(10).bytes(message.quorum); + } + if (message.threshold.length !== 0) { + writer.uint32(18).bytes(message.threshold); + } + if (message.vetoThreshold.length !== 0) { + writer.uint32(26).bytes(message.vetoThreshold); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TallyParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTallyParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.quorum = reader.bytes(); + break; + case 2: + message.threshold = reader.bytes(); + break; + case 3: + message.vetoThreshold = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): TallyParams { + const message = createBaseTallyParams(); + message.quorum = object.quorum ?? new Uint8Array(); + message.threshold = object.threshold ?? new Uint8Array(); + message.vetoThreshold = object.vetoThreshold ?? new Uint8Array(); + return message; + }, + fromAmino(object: TallyParamsAmino): TallyParams { + const message = createBaseTallyParams(); + if (object.quorum !== undefined && object.quorum !== null) { + message.quorum = bytesFromBase64(object.quorum); + } + if (object.threshold !== undefined && object.threshold !== null) { + message.threshold = bytesFromBase64(object.threshold); + } + if (object.veto_threshold !== undefined && object.veto_threshold !== null) { + message.vetoThreshold = bytesFromBase64(object.veto_threshold); + } + return message; + }, + toAmino(message: TallyParams): TallyParamsAmino { + const obj: any = {}; + obj.quorum = message.quorum ? base64FromBytes(message.quorum) : undefined; + obj.threshold = message.threshold ? base64FromBytes(message.threshold) : undefined; + obj.veto_threshold = message.vetoThreshold ? base64FromBytes(message.vetoThreshold) : undefined; + return obj; + }, + fromAminoMsg(object: TallyParamsAminoMsg): TallyParams { + return TallyParams.fromAmino(object.value); + }, + toAminoMsg(message: TallyParams): TallyParamsAminoMsg { + return { + type: "cosmos-sdk/TallyParams", + value: TallyParams.toAmino(message) + }; + }, + fromProtoMsg(message: TallyParamsProtoMsg): TallyParams { + return TallyParams.decode(message.value); + }, + toProto(message: TallyParams): Uint8Array { + return TallyParams.encode(message).finish(); + }, + toProtoMsg(message: TallyParams): TallyParamsProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.TallyParams", + value: TallyParams.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(TallyParams.typeUrl, TallyParams); +GlobalDecoderRegistry.registerAminoProtoMapping(TallyParams.aminoType, TallyParams.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/gov/v1beta1/query.rpc.func.ts b/libs/interchain-query/src/cosmos/gov/v1beta1/query.rpc.func.ts new file mode 100644 index 00000000..5add14c4 --- /dev/null +++ b/libs/interchain-query/src/cosmos/gov/v1beta1/query.rpc.func.ts @@ -0,0 +1,91 @@ +import { RpcResolver, buildQuery } from "../../../helper-func-types"; +import { buildUseQuery } from "../../../react-query"; +import { QueryProposalRequest, QueryProposalResponse, QueryProposalsRequest, QueryProposalsResponse, QueryVoteRequest, QueryVoteResponse, QueryVotesRequest, QueryVotesResponse, QueryParamsRequest, QueryParamsResponse, QueryDepositRequest, QueryDepositResponse, QueryDepositsRequest, QueryDepositsResponse, QueryTallyResultRequest, QueryTallyResultResponse } from "./query"; +export const createGetProposal = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryProposalRequest.encode, + decode: QueryProposalResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Proposal", + clientResolver +}); +export const useGetProposal = buildUseQuery({ + builderQueryFn: createGetProposal, + queryKeyPrefix: "ProposalQuery" +}); +export const createGetProposals = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryProposalsRequest.encode, + decode: QueryProposalsResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Proposals", + clientResolver +}); +export const useGetProposals = buildUseQuery({ + builderQueryFn: createGetProposals, + queryKeyPrefix: "ProposalsQuery" +}); +export const createGetVote = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryVoteRequest.encode, + decode: QueryVoteResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Vote", + clientResolver +}); +export const useGetVote = buildUseQuery({ + builderQueryFn: createGetVote, + queryKeyPrefix: "VoteQuery" +}); +export const createGetVotes = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryVotesRequest.encode, + decode: QueryVotesResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Votes", + clientResolver +}); +export const useGetVotes = buildUseQuery({ + builderQueryFn: createGetVotes, + queryKeyPrefix: "VotesQuery" +}); +export const createGetParams = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Params", + clientResolver +}); +export const useGetParams = buildUseQuery({ + builderQueryFn: createGetParams, + queryKeyPrefix: "ParamsQuery" +}); +export const createGetDeposit = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryDepositRequest.encode, + decode: QueryDepositResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Deposit", + clientResolver +}); +export const useGetDeposit = buildUseQuery({ + builderQueryFn: createGetDeposit, + queryKeyPrefix: "DepositQuery" +}); +export const createGetDeposits = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryDepositsRequest.encode, + decode: QueryDepositsResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "Deposits", + clientResolver +}); +export const useGetDeposits = buildUseQuery({ + builderQueryFn: createGetDeposits, + queryKeyPrefix: "DepositsQuery" +}); +export const createGetTallyResult = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryTallyResultRequest.encode, + decode: QueryTallyResultResponse.decode, + service: "cosmos.gov.v1beta1.Query", + method: "TallyResult", + clientResolver +}); +export const useGetTallyResult = buildUseQuery({ + builderQueryFn: createGetTallyResult, + queryKeyPrefix: "TallyResultQuery" +}); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/gov/v1beta1/query.ts b/libs/interchain-query/src/cosmos/gov/v1beta1/query.ts new file mode 100644 index 00000000..15053043 --- /dev/null +++ b/libs/interchain-query/src/cosmos/gov/v1beta1/query.ts @@ -0,0 +1,1749 @@ +import { ProposalStatus, Proposal, ProposalAmino, Vote, VoteAmino, VotingParams, VotingParamsAmino, DepositParams, DepositParamsAmino, TallyParams, TallyParamsAmino, Deposit, DepositAmino, TallyResult, TallyResultAmino } from "./gov"; +import { PageRequest, PageRequestAmino, PageResponse, PageResponseAmino } from "../../base/query/v1beta1/pagination"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial, isSet } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; +/** QueryProposalRequest is the request type for the Query/Proposal RPC method. */ +export interface QueryProposalRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; +} +export interface QueryProposalRequestProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryProposalRequest"; + value: Uint8Array; +} +/** QueryProposalRequest is the request type for the Query/Proposal RPC method. */ +export interface QueryProposalRequestAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; +} +export interface QueryProposalRequestAminoMsg { + type: "cosmos-sdk/QueryProposalRequest"; + value: QueryProposalRequestAmino; +} +/** QueryProposalResponse is the response type for the Query/Proposal RPC method. */ +export interface QueryProposalResponse { + proposal: Proposal; +} +export interface QueryProposalResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryProposalResponse"; + value: Uint8Array; +} +/** QueryProposalResponse is the response type for the Query/Proposal RPC method. */ +export interface QueryProposalResponseAmino { + proposal: ProposalAmino; +} +export interface QueryProposalResponseAminoMsg { + type: "cosmos-sdk/QueryProposalResponse"; + value: QueryProposalResponseAmino; +} +/** QueryProposalsRequest is the request type for the Query/Proposals RPC method. */ +export interface QueryProposalsRequest { + /** proposal_status defines the status of the proposals. */ + proposalStatus: ProposalStatus; + /** voter defines the voter address for the proposals. */ + voter: string; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryProposalsRequestProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryProposalsRequest"; + value: Uint8Array; +} +/** QueryProposalsRequest is the request type for the Query/Proposals RPC method. */ +export interface QueryProposalsRequestAmino { + /** proposal_status defines the status of the proposals. */ + proposal_status: ProposalStatus; + /** voter defines the voter address for the proposals. */ + voter: string; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryProposalsRequestAminoMsg { + type: "cosmos-sdk/QueryProposalsRequest"; + value: QueryProposalsRequestAmino; +} +/** + * QueryProposalsResponse is the response type for the Query/Proposals RPC + * method. + */ +export interface QueryProposalsResponse { + /** proposals defines all the requested governance proposals. */ + proposals: Proposal[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryProposalsResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryProposalsResponse"; + value: Uint8Array; +} +/** + * QueryProposalsResponse is the response type for the Query/Proposals RPC + * method. + */ +export interface QueryProposalsResponseAmino { + /** proposals defines all the requested governance proposals. */ + proposals: ProposalAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryProposalsResponseAminoMsg { + type: "cosmos-sdk/QueryProposalsResponse"; + value: QueryProposalsResponseAmino; +} +/** QueryVoteRequest is the request type for the Query/Vote RPC method. */ +export interface QueryVoteRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; + /** voter defines the voter address for the proposals. */ + voter: string; +} +export interface QueryVoteRequestProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryVoteRequest"; + value: Uint8Array; +} +/** QueryVoteRequest is the request type for the Query/Vote RPC method. */ +export interface QueryVoteRequestAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** voter defines the voter address for the proposals. */ + voter: string; +} +export interface QueryVoteRequestAminoMsg { + type: "cosmos-sdk/QueryVoteRequest"; + value: QueryVoteRequestAmino; +} +/** QueryVoteResponse is the response type for the Query/Vote RPC method. */ +export interface QueryVoteResponse { + /** vote defines the queried vote. */ + vote: Vote; +} +export interface QueryVoteResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryVoteResponse"; + value: Uint8Array; +} +/** QueryVoteResponse is the response type for the Query/Vote RPC method. */ +export interface QueryVoteResponseAmino { + /** vote defines the queried vote. */ + vote: VoteAmino; +} +export interface QueryVoteResponseAminoMsg { + type: "cosmos-sdk/QueryVoteResponse"; + value: QueryVoteResponseAmino; +} +/** QueryVotesRequest is the request type for the Query/Votes RPC method. */ +export interface QueryVotesRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryVotesRequestProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryVotesRequest"; + value: Uint8Array; +} +/** QueryVotesRequest is the request type for the Query/Votes RPC method. */ +export interface QueryVotesRequestAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryVotesRequestAminoMsg { + type: "cosmos-sdk/QueryVotesRequest"; + value: QueryVotesRequestAmino; +} +/** QueryVotesResponse is the response type for the Query/Votes RPC method. */ +export interface QueryVotesResponse { + /** votes defines the queried votes. */ + votes: Vote[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryVotesResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryVotesResponse"; + value: Uint8Array; +} +/** QueryVotesResponse is the response type for the Query/Votes RPC method. */ +export interface QueryVotesResponseAmino { + /** votes defines the queried votes. */ + votes: VoteAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryVotesResponseAminoMsg { + type: "cosmos-sdk/QueryVotesResponse"; + value: QueryVotesResponseAmino; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequest { + /** + * params_type defines which parameters to query for, can be one of "voting", + * "tallying" or "deposit". + */ + paramsType: string; +} +export interface QueryParamsRequestProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryParamsRequest"; + value: Uint8Array; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequestAmino { + /** + * params_type defines which parameters to query for, can be one of "voting", + * "tallying" or "deposit". + */ + params_type: string; +} +export interface QueryParamsRequestAminoMsg { + type: "cosmos-sdk/QueryParamsRequest"; + value: QueryParamsRequestAmino; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** voting_params defines the parameters related to voting. */ + votingParams: VotingParams; + /** deposit_params defines the parameters related to deposit. */ + depositParams: DepositParams; + /** tally_params defines the parameters related to tally. */ + tallyParams: TallyParams; +} +export interface QueryParamsResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryParamsResponse"; + value: Uint8Array; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponseAmino { + /** voting_params defines the parameters related to voting. */ + voting_params: VotingParamsAmino; + /** deposit_params defines the parameters related to deposit. */ + deposit_params: DepositParamsAmino; + /** tally_params defines the parameters related to tally. */ + tally_params: TallyParamsAmino; +} +export interface QueryParamsResponseAminoMsg { + type: "cosmos-sdk/QueryParamsResponse"; + value: QueryParamsResponseAmino; +} +/** QueryDepositRequest is the request type for the Query/Deposit RPC method. */ +export interface QueryDepositRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; +} +export interface QueryDepositRequestProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryDepositRequest"; + value: Uint8Array; +} +/** QueryDepositRequest is the request type for the Query/Deposit RPC method. */ +export interface QueryDepositRequestAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; +} +export interface QueryDepositRequestAminoMsg { + type: "cosmos-sdk/QueryDepositRequest"; + value: QueryDepositRequestAmino; +} +/** QueryDepositResponse is the response type for the Query/Deposit RPC method. */ +export interface QueryDepositResponse { + /** deposit defines the requested deposit. */ + deposit: Deposit; +} +export interface QueryDepositResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryDepositResponse"; + value: Uint8Array; +} +/** QueryDepositResponse is the response type for the Query/Deposit RPC method. */ +export interface QueryDepositResponseAmino { + /** deposit defines the requested deposit. */ + deposit: DepositAmino; +} +export interface QueryDepositResponseAminoMsg { + type: "cosmos-sdk/QueryDepositResponse"; + value: QueryDepositResponseAmino; +} +/** QueryDepositsRequest is the request type for the Query/Deposits RPC method. */ +export interface QueryDepositsRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryDepositsRequestProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryDepositsRequest"; + value: Uint8Array; +} +/** QueryDepositsRequest is the request type for the Query/Deposits RPC method. */ +export interface QueryDepositsRequestAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryDepositsRequestAminoMsg { + type: "cosmos-sdk/QueryDepositsRequest"; + value: QueryDepositsRequestAmino; +} +/** QueryDepositsResponse is the response type for the Query/Deposits RPC method. */ +export interface QueryDepositsResponse { + /** deposits defines the requested deposits. */ + deposits: Deposit[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryDepositsResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryDepositsResponse"; + value: Uint8Array; +} +/** QueryDepositsResponse is the response type for the Query/Deposits RPC method. */ +export interface QueryDepositsResponseAmino { + /** deposits defines the requested deposits. */ + deposits: DepositAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryDepositsResponseAminoMsg { + type: "cosmos-sdk/QueryDepositsResponse"; + value: QueryDepositsResponseAmino; +} +/** QueryTallyResultRequest is the request type for the Query/Tally RPC method. */ +export interface QueryTallyResultRequest { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; +} +export interface QueryTallyResultRequestProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryTallyResultRequest"; + value: Uint8Array; +} +/** QueryTallyResultRequest is the request type for the Query/Tally RPC method. */ +export interface QueryTallyResultRequestAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; +} +export interface QueryTallyResultRequestAminoMsg { + type: "cosmos-sdk/QueryTallyResultRequest"; + value: QueryTallyResultRequestAmino; +} +/** QueryTallyResultResponse is the response type for the Query/Tally RPC method. */ +export interface QueryTallyResultResponse { + /** tally defines the requested tally. */ + tally: TallyResult; +} +export interface QueryTallyResultResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.QueryTallyResultResponse"; + value: Uint8Array; +} +/** QueryTallyResultResponse is the response type for the Query/Tally RPC method. */ +export interface QueryTallyResultResponseAmino { + /** tally defines the requested tally. */ + tally: TallyResultAmino; +} +export interface QueryTallyResultResponseAminoMsg { + type: "cosmos-sdk/QueryTallyResultResponse"; + value: QueryTallyResultResponseAmino; +} +function createBaseQueryProposalRequest(): QueryProposalRequest { + return { + proposalId: BigInt(0) + }; +} +export const QueryProposalRequest = { + typeUrl: "/cosmos.gov.v1beta1.QueryProposalRequest", + aminoType: "cosmos-sdk/QueryProposalRequest", + is(o: any): o is QueryProposalRequest { + return o && (o.$typeUrl === QueryProposalRequest.typeUrl || typeof o.proposalId === "bigint"); + }, + isAmino(o: any): o is QueryProposalRequestAmino { + return o && (o.$typeUrl === QueryProposalRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, + encode(message: QueryProposalRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryProposalRequest { + const message = createBaseQueryProposalRequest(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + return message; + }, + fromAmino(object: QueryProposalRequestAmino): QueryProposalRequest { + const message = createBaseQueryProposalRequest(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + return message; + }, + toAmino(message: QueryProposalRequest): QueryProposalRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QueryProposalRequestAminoMsg): QueryProposalRequest { + return QueryProposalRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryProposalRequest): QueryProposalRequestAminoMsg { + return { + type: "cosmos-sdk/QueryProposalRequest", + value: QueryProposalRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryProposalRequestProtoMsg): QueryProposalRequest { + return QueryProposalRequest.decode(message.value); + }, + toProto(message: QueryProposalRequest): Uint8Array { + return QueryProposalRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryProposalRequest): QueryProposalRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryProposalRequest", + value: QueryProposalRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryProposalRequest.typeUrl, QueryProposalRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryProposalRequest.aminoType, QueryProposalRequest.typeUrl); +function createBaseQueryProposalResponse(): QueryProposalResponse { + return { + proposal: Proposal.fromPartial({}) + }; +} +export const QueryProposalResponse = { + typeUrl: "/cosmos.gov.v1beta1.QueryProposalResponse", + aminoType: "cosmos-sdk/QueryProposalResponse", + is(o: any): o is QueryProposalResponse { + return o && (o.$typeUrl === QueryProposalResponse.typeUrl || Proposal.is(o.proposal)); + }, + isAmino(o: any): o is QueryProposalResponseAmino { + return o && (o.$typeUrl === QueryProposalResponse.typeUrl || Proposal.isAmino(o.proposal)); + }, + encode(message: QueryProposalResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposal !== undefined) { + Proposal.encode(message.proposal, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposal = Proposal.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryProposalResponse { + const message = createBaseQueryProposalResponse(); + message.proposal = object.proposal !== undefined && object.proposal !== null ? Proposal.fromPartial(object.proposal) : undefined; + return message; + }, + fromAmino(object: QueryProposalResponseAmino): QueryProposalResponse { + const message = createBaseQueryProposalResponse(); + if (object.proposal !== undefined && object.proposal !== null) { + message.proposal = Proposal.fromAmino(object.proposal); + } + return message; + }, + toAmino(message: QueryProposalResponse): QueryProposalResponseAmino { + const obj: any = {}; + obj.proposal = message.proposal ? Proposal.toAmino(message.proposal) : Proposal.toAmino(Proposal.fromPartial({})); + return obj; + }, + fromAminoMsg(object: QueryProposalResponseAminoMsg): QueryProposalResponse { + return QueryProposalResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryProposalResponse): QueryProposalResponseAminoMsg { + return { + type: "cosmos-sdk/QueryProposalResponse", + value: QueryProposalResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryProposalResponseProtoMsg): QueryProposalResponse { + return QueryProposalResponse.decode(message.value); + }, + toProto(message: QueryProposalResponse): Uint8Array { + return QueryProposalResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryProposalResponse): QueryProposalResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryProposalResponse", + value: QueryProposalResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryProposalResponse.typeUrl, QueryProposalResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryProposalResponse.aminoType, QueryProposalResponse.typeUrl); +function createBaseQueryProposalsRequest(): QueryProposalsRequest { + return { + proposalStatus: 0, + voter: "", + depositor: "", + pagination: undefined + }; +} +export const QueryProposalsRequest = { + typeUrl: "/cosmos.gov.v1beta1.QueryProposalsRequest", + aminoType: "cosmos-sdk/QueryProposalsRequest", + is(o: any): o is QueryProposalsRequest { + return o && (o.$typeUrl === QueryProposalsRequest.typeUrl || isSet(o.proposalStatus) && typeof o.voter === "string" && typeof o.depositor === "string"); + }, + isAmino(o: any): o is QueryProposalsRequestAmino { + return o && (o.$typeUrl === QueryProposalsRequest.typeUrl || isSet(o.proposal_status) && typeof o.voter === "string" && typeof o.depositor === "string"); + }, + encode(message: QueryProposalsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalStatus !== 0) { + writer.uint32(8).int32(message.proposalStatus); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.depositor !== "") { + writer.uint32(26).string(message.depositor); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalStatus = (reader.int32() as any); + break; + case 2: + message.voter = reader.string(); + break; + case 3: + message.depositor = reader.string(); + break; + case 4: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryProposalsRequest { + const message = createBaseQueryProposalsRequest(); + message.proposalStatus = object.proposalStatus ?? 0; + message.voter = object.voter ?? ""; + message.depositor = object.depositor ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryProposalsRequestAmino): QueryProposalsRequest { + const message = createBaseQueryProposalsRequest(); + if (object.proposal_status !== undefined && object.proposal_status !== null) { + message.proposalStatus = object.proposal_status; + } + if (object.voter !== undefined && object.voter !== null) { + message.voter = object.voter; + } + if (object.depositor !== undefined && object.depositor !== null) { + message.depositor = object.depositor; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryProposalsRequest): QueryProposalsRequestAmino { + const obj: any = {}; + obj.proposal_status = message.proposalStatus === 0 ? undefined : message.proposalStatus; + obj.voter = message.voter === "" ? undefined : message.voter; + obj.depositor = message.depositor === "" ? undefined : message.depositor; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryProposalsRequestAminoMsg): QueryProposalsRequest { + return QueryProposalsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryProposalsRequest): QueryProposalsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryProposalsRequest", + value: QueryProposalsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryProposalsRequestProtoMsg): QueryProposalsRequest { + return QueryProposalsRequest.decode(message.value); + }, + toProto(message: QueryProposalsRequest): Uint8Array { + return QueryProposalsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryProposalsRequest): QueryProposalsRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryProposalsRequest", + value: QueryProposalsRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryProposalsRequest.typeUrl, QueryProposalsRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryProposalsRequest.aminoType, QueryProposalsRequest.typeUrl); +function createBaseQueryProposalsResponse(): QueryProposalsResponse { + return { + proposals: [], + pagination: undefined + }; +} +export const QueryProposalsResponse = { + typeUrl: "/cosmos.gov.v1beta1.QueryProposalsResponse", + aminoType: "cosmos-sdk/QueryProposalsResponse", + is(o: any): o is QueryProposalsResponse { + return o && (o.$typeUrl === QueryProposalsResponse.typeUrl || Array.isArray(o.proposals) && (!o.proposals.length || Proposal.is(o.proposals[0]))); + }, + isAmino(o: any): o is QueryProposalsResponseAmino { + return o && (o.$typeUrl === QueryProposalsResponse.typeUrl || Array.isArray(o.proposals) && (!o.proposals.length || Proposal.isAmino(o.proposals[0]))); + }, + encode(message: QueryProposalsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.proposals) { + Proposal.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryProposalsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryProposalsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposals.push(Proposal.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryProposalsResponse { + const message = createBaseQueryProposalsResponse(); + message.proposals = object.proposals?.map(e => Proposal.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryProposalsResponseAmino): QueryProposalsResponse { + const message = createBaseQueryProposalsResponse(); + message.proposals = object.proposals?.map(e => Proposal.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryProposalsResponse): QueryProposalsResponseAmino { + const obj: any = {}; + if (message.proposals) { + obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); + } else { + obj.proposals = message.proposals; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryProposalsResponseAminoMsg): QueryProposalsResponse { + return QueryProposalsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryProposalsResponse): QueryProposalsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryProposalsResponse", + value: QueryProposalsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryProposalsResponseProtoMsg): QueryProposalsResponse { + return QueryProposalsResponse.decode(message.value); + }, + toProto(message: QueryProposalsResponse): Uint8Array { + return QueryProposalsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryProposalsResponse): QueryProposalsResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryProposalsResponse", + value: QueryProposalsResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryProposalsResponse.typeUrl, QueryProposalsResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryProposalsResponse.aminoType, QueryProposalsResponse.typeUrl); +function createBaseQueryVoteRequest(): QueryVoteRequest { + return { + proposalId: BigInt(0), + voter: "" + }; +} +export const QueryVoteRequest = { + typeUrl: "/cosmos.gov.v1beta1.QueryVoteRequest", + aminoType: "cosmos-sdk/QueryVoteRequest", + is(o: any): o is QueryVoteRequest { + return o && (o.$typeUrl === QueryVoteRequest.typeUrl || typeof o.proposalId === "bigint" && typeof o.voter === "string"); + }, + isAmino(o: any): o is QueryVoteRequestAmino { + return o && (o.$typeUrl === QueryVoteRequest.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string"); + }, + encode(message: QueryVoteRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVoteRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.voter = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryVoteRequest { + const message = createBaseQueryVoteRequest(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.voter = object.voter ?? ""; + return message; + }, + fromAmino(object: QueryVoteRequestAmino): QueryVoteRequest { + const message = createBaseQueryVoteRequest(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.voter !== undefined && object.voter !== null) { + message.voter = object.voter; + } + return message; + }, + toAmino(message: QueryVoteRequest): QueryVoteRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId?.toString() : undefined; + obj.voter = message.voter === "" ? undefined : message.voter; + return obj; + }, + fromAminoMsg(object: QueryVoteRequestAminoMsg): QueryVoteRequest { + return QueryVoteRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryVoteRequest): QueryVoteRequestAminoMsg { + return { + type: "cosmos-sdk/QueryVoteRequest", + value: QueryVoteRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryVoteRequestProtoMsg): QueryVoteRequest { + return QueryVoteRequest.decode(message.value); + }, + toProto(message: QueryVoteRequest): Uint8Array { + return QueryVoteRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryVoteRequest): QueryVoteRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryVoteRequest", + value: QueryVoteRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryVoteRequest.typeUrl, QueryVoteRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryVoteRequest.aminoType, QueryVoteRequest.typeUrl); +function createBaseQueryVoteResponse(): QueryVoteResponse { + return { + vote: Vote.fromPartial({}) + }; +} +export const QueryVoteResponse = { + typeUrl: "/cosmos.gov.v1beta1.QueryVoteResponse", + aminoType: "cosmos-sdk/QueryVoteResponse", + is(o: any): o is QueryVoteResponse { + return o && (o.$typeUrl === QueryVoteResponse.typeUrl || Vote.is(o.vote)); + }, + isAmino(o: any): o is QueryVoteResponseAmino { + return o && (o.$typeUrl === QueryVoteResponse.typeUrl || Vote.isAmino(o.vote)); + }, + encode(message: QueryVoteResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.vote !== undefined) { + Vote.encode(message.vote, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.vote = Vote.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryVoteResponse { + const message = createBaseQueryVoteResponse(); + message.vote = object.vote !== undefined && object.vote !== null ? Vote.fromPartial(object.vote) : undefined; + return message; + }, + fromAmino(object: QueryVoteResponseAmino): QueryVoteResponse { + const message = createBaseQueryVoteResponse(); + if (object.vote !== undefined && object.vote !== null) { + message.vote = Vote.fromAmino(object.vote); + } + return message; + }, + toAmino(message: QueryVoteResponse): QueryVoteResponseAmino { + const obj: any = {}; + obj.vote = message.vote ? Vote.toAmino(message.vote) : Vote.toAmino(Vote.fromPartial({})); + return obj; + }, + fromAminoMsg(object: QueryVoteResponseAminoMsg): QueryVoteResponse { + return QueryVoteResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryVoteResponse): QueryVoteResponseAminoMsg { + return { + type: "cosmos-sdk/QueryVoteResponse", + value: QueryVoteResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryVoteResponseProtoMsg): QueryVoteResponse { + return QueryVoteResponse.decode(message.value); + }, + toProto(message: QueryVoteResponse): Uint8Array { + return QueryVoteResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryVoteResponse): QueryVoteResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryVoteResponse", + value: QueryVoteResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryVoteResponse.typeUrl, QueryVoteResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryVoteResponse.aminoType, QueryVoteResponse.typeUrl); +function createBaseQueryVotesRequest(): QueryVotesRequest { + return { + proposalId: BigInt(0), + pagination: undefined + }; +} +export const QueryVotesRequest = { + typeUrl: "/cosmos.gov.v1beta1.QueryVotesRequest", + aminoType: "cosmos-sdk/QueryVotesRequest", + is(o: any): o is QueryVotesRequest { + return o && (o.$typeUrl === QueryVotesRequest.typeUrl || typeof o.proposalId === "bigint"); + }, + isAmino(o: any): o is QueryVotesRequestAmino { + return o && (o.$typeUrl === QueryVotesRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, + encode(message: QueryVotesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryVotesRequest { + const message = createBaseQueryVotesRequest(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryVotesRequestAmino): QueryVotesRequest { + const message = createBaseQueryVotesRequest(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryVotesRequest): QueryVotesRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId?.toString() : undefined; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryVotesRequestAminoMsg): QueryVotesRequest { + return QueryVotesRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryVotesRequest): QueryVotesRequestAminoMsg { + return { + type: "cosmos-sdk/QueryVotesRequest", + value: QueryVotesRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryVotesRequestProtoMsg): QueryVotesRequest { + return QueryVotesRequest.decode(message.value); + }, + toProto(message: QueryVotesRequest): Uint8Array { + return QueryVotesRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryVotesRequest): QueryVotesRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryVotesRequest", + value: QueryVotesRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryVotesRequest.typeUrl, QueryVotesRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryVotesRequest.aminoType, QueryVotesRequest.typeUrl); +function createBaseQueryVotesResponse(): QueryVotesResponse { + return { + votes: [], + pagination: undefined + }; +} +export const QueryVotesResponse = { + typeUrl: "/cosmos.gov.v1beta1.QueryVotesResponse", + aminoType: "cosmos-sdk/QueryVotesResponse", + is(o: any): o is QueryVotesResponse { + return o && (o.$typeUrl === QueryVotesResponse.typeUrl || Array.isArray(o.votes) && (!o.votes.length || Vote.is(o.votes[0]))); + }, + isAmino(o: any): o is QueryVotesResponseAmino { + return o && (o.$typeUrl === QueryVotesResponse.typeUrl || Array.isArray(o.votes) && (!o.votes.length || Vote.isAmino(o.votes[0]))); + }, + encode(message: QueryVotesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.votes) { + Vote.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryVotesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryVotesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.votes.push(Vote.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryVotesResponse { + const message = createBaseQueryVotesResponse(); + message.votes = object.votes?.map(e => Vote.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryVotesResponseAmino): QueryVotesResponse { + const message = createBaseQueryVotesResponse(); + message.votes = object.votes?.map(e => Vote.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryVotesResponse): QueryVotesResponseAmino { + const obj: any = {}; + if (message.votes) { + obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); + } else { + obj.votes = message.votes; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryVotesResponseAminoMsg): QueryVotesResponse { + return QueryVotesResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryVotesResponse): QueryVotesResponseAminoMsg { + return { + type: "cosmos-sdk/QueryVotesResponse", + value: QueryVotesResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryVotesResponseProtoMsg): QueryVotesResponse { + return QueryVotesResponse.decode(message.value); + }, + toProto(message: QueryVotesResponse): Uint8Array { + return QueryVotesResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryVotesResponse): QueryVotesResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryVotesResponse", + value: QueryVotesResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryVotesResponse.typeUrl, QueryVotesResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryVotesResponse.aminoType, QueryVotesResponse.typeUrl); +function createBaseQueryParamsRequest(): QueryParamsRequest { + return { + paramsType: "" + }; +} +export const QueryParamsRequest = { + typeUrl: "/cosmos.gov.v1beta1.QueryParamsRequest", + aminoType: "cosmos-sdk/QueryParamsRequest", + is(o: any): o is QueryParamsRequest { + return o && (o.$typeUrl === QueryParamsRequest.typeUrl || typeof o.paramsType === "string"); + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && (o.$typeUrl === QueryParamsRequest.typeUrl || typeof o.params_type === "string"); + }, + encode(message: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.paramsType !== "") { + writer.uint32(10).string(message.paramsType); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.paramsType = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + message.paramsType = object.paramsType ?? ""; + return message; + }, + fromAmino(object: QueryParamsRequestAmino): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + if (object.params_type !== undefined && object.params_type !== null) { + message.paramsType = object.params_type; + } + return message; + }, + toAmino(message: QueryParamsRequest): QueryParamsRequestAmino { + const obj: any = {}; + obj.params_type = message.paramsType === "" ? undefined : message.paramsType; + return obj; + }, + fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { + return QueryParamsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsRequest): QueryParamsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryParamsRequest", + value: QueryParamsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsRequestProtoMsg): QueryParamsRequest { + return QueryParamsRequest.decode(message.value); + }, + toProto(message: QueryParamsRequest): Uint8Array { + return QueryParamsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsRequest): QueryParamsRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryParamsRequest", + value: QueryParamsRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryParamsRequest.typeUrl, QueryParamsRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryParamsRequest.aminoType, QueryParamsRequest.typeUrl); +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { + votingParams: VotingParams.fromPartial({}), + depositParams: DepositParams.fromPartial({}), + tallyParams: TallyParams.fromPartial({}) + }; +} +export const QueryParamsResponse = { + typeUrl: "/cosmos.gov.v1beta1.QueryParamsResponse", + aminoType: "cosmos-sdk/QueryParamsResponse", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || VotingParams.is(o.votingParams) && DepositParams.is(o.depositParams) && TallyParams.is(o.tallyParams)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || VotingParams.isAmino(o.voting_params) && DepositParams.isAmino(o.deposit_params) && TallyParams.isAmino(o.tally_params)); + }, + encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.votingParams !== undefined) { + VotingParams.encode(message.votingParams, writer.uint32(10).fork()).ldelim(); + } + if (message.depositParams !== undefined) { + DepositParams.encode(message.depositParams, writer.uint32(18).fork()).ldelim(); + } + if (message.tallyParams !== undefined) { + TallyParams.encode(message.tallyParams, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.votingParams = VotingParams.decode(reader, reader.uint32()); + break; + case 2: + message.depositParams = DepositParams.decode(reader, reader.uint32()); + break; + case 3: + message.tallyParams = TallyParams.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.votingParams = object.votingParams !== undefined && object.votingParams !== null ? VotingParams.fromPartial(object.votingParams) : undefined; + message.depositParams = object.depositParams !== undefined && object.depositParams !== null ? DepositParams.fromPartial(object.depositParams) : undefined; + message.tallyParams = object.tallyParams !== undefined && object.tallyParams !== null ? TallyParams.fromPartial(object.tallyParams) : undefined; + return message; + }, + fromAmino(object: QueryParamsResponseAmino): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + if (object.voting_params !== undefined && object.voting_params !== null) { + message.votingParams = VotingParams.fromAmino(object.voting_params); + } + if (object.deposit_params !== undefined && object.deposit_params !== null) { + message.depositParams = DepositParams.fromAmino(object.deposit_params); + } + if (object.tally_params !== undefined && object.tally_params !== null) { + message.tallyParams = TallyParams.fromAmino(object.tally_params); + } + return message; + }, + toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { + const obj: any = {}; + obj.voting_params = message.votingParams ? VotingParams.toAmino(message.votingParams) : VotingParams.toAmino(VotingParams.fromPartial({})); + obj.deposit_params = message.depositParams ? DepositParams.toAmino(message.depositParams) : DepositParams.toAmino(DepositParams.fromPartial({})); + obj.tally_params = message.tallyParams ? TallyParams.toAmino(message.tallyParams) : TallyParams.toAmino(TallyParams.fromPartial({})); + return obj; + }, + fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { + return QueryParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsResponse): QueryParamsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryParamsResponse", + value: QueryParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsResponseProtoMsg): QueryParamsResponse { + return QueryParamsResponse.decode(message.value); + }, + toProto(message: QueryParamsResponse): Uint8Array { + return QueryParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsResponse): QueryParamsResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryParamsResponse", + value: QueryParamsResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryParamsResponse.typeUrl, QueryParamsResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryParamsResponse.aminoType, QueryParamsResponse.typeUrl); +function createBaseQueryDepositRequest(): QueryDepositRequest { + return { + proposalId: BigInt(0), + depositor: "" + }; +} +export const QueryDepositRequest = { + typeUrl: "/cosmos.gov.v1beta1.QueryDepositRequest", + aminoType: "cosmos-sdk/QueryDepositRequest", + is(o: any): o is QueryDepositRequest { + return o && (o.$typeUrl === QueryDepositRequest.typeUrl || typeof o.proposalId === "bigint" && typeof o.depositor === "string"); + }, + isAmino(o: any): o is QueryDepositRequestAmino { + return o && (o.$typeUrl === QueryDepositRequest.typeUrl || typeof o.proposal_id === "bigint" && typeof o.depositor === "string"); + }, + encode(message: QueryDepositRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.depositor = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDepositRequest { + const message = createBaseQueryDepositRequest(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.depositor = object.depositor ?? ""; + return message; + }, + fromAmino(object: QueryDepositRequestAmino): QueryDepositRequest { + const message = createBaseQueryDepositRequest(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.depositor !== undefined && object.depositor !== null) { + message.depositor = object.depositor; + } + return message; + }, + toAmino(message: QueryDepositRequest): QueryDepositRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId?.toString() : undefined; + obj.depositor = message.depositor === "" ? undefined : message.depositor; + return obj; + }, + fromAminoMsg(object: QueryDepositRequestAminoMsg): QueryDepositRequest { + return QueryDepositRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDepositRequest): QueryDepositRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDepositRequest", + value: QueryDepositRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDepositRequestProtoMsg): QueryDepositRequest { + return QueryDepositRequest.decode(message.value); + }, + toProto(message: QueryDepositRequest): Uint8Array { + return QueryDepositRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDepositRequest): QueryDepositRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryDepositRequest", + value: QueryDepositRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryDepositRequest.typeUrl, QueryDepositRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryDepositRequest.aminoType, QueryDepositRequest.typeUrl); +function createBaseQueryDepositResponse(): QueryDepositResponse { + return { + deposit: Deposit.fromPartial({}) + }; +} +export const QueryDepositResponse = { + typeUrl: "/cosmos.gov.v1beta1.QueryDepositResponse", + aminoType: "cosmos-sdk/QueryDepositResponse", + is(o: any): o is QueryDepositResponse { + return o && (o.$typeUrl === QueryDepositResponse.typeUrl || Deposit.is(o.deposit)); + }, + isAmino(o: any): o is QueryDepositResponseAmino { + return o && (o.$typeUrl === QueryDepositResponse.typeUrl || Deposit.isAmino(o.deposit)); + }, + encode(message: QueryDepositResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.deposit !== undefined) { + Deposit.encode(message.deposit, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.deposit = Deposit.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDepositResponse { + const message = createBaseQueryDepositResponse(); + message.deposit = object.deposit !== undefined && object.deposit !== null ? Deposit.fromPartial(object.deposit) : undefined; + return message; + }, + fromAmino(object: QueryDepositResponseAmino): QueryDepositResponse { + const message = createBaseQueryDepositResponse(); + if (object.deposit !== undefined && object.deposit !== null) { + message.deposit = Deposit.fromAmino(object.deposit); + } + return message; + }, + toAmino(message: QueryDepositResponse): QueryDepositResponseAmino { + const obj: any = {}; + obj.deposit = message.deposit ? Deposit.toAmino(message.deposit) : Deposit.toAmino(Deposit.fromPartial({})); + return obj; + }, + fromAminoMsg(object: QueryDepositResponseAminoMsg): QueryDepositResponse { + return QueryDepositResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDepositResponse): QueryDepositResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDepositResponse", + value: QueryDepositResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDepositResponseProtoMsg): QueryDepositResponse { + return QueryDepositResponse.decode(message.value); + }, + toProto(message: QueryDepositResponse): Uint8Array { + return QueryDepositResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDepositResponse): QueryDepositResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryDepositResponse", + value: QueryDepositResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryDepositResponse.typeUrl, QueryDepositResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryDepositResponse.aminoType, QueryDepositResponse.typeUrl); +function createBaseQueryDepositsRequest(): QueryDepositsRequest { + return { + proposalId: BigInt(0), + pagination: undefined + }; +} +export const QueryDepositsRequest = { + typeUrl: "/cosmos.gov.v1beta1.QueryDepositsRequest", + aminoType: "cosmos-sdk/QueryDepositsRequest", + is(o: any): o is QueryDepositsRequest { + return o && (o.$typeUrl === QueryDepositsRequest.typeUrl || typeof o.proposalId === "bigint"); + }, + isAmino(o: any): o is QueryDepositsRequestAmino { + return o && (o.$typeUrl === QueryDepositsRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, + encode(message: QueryDepositsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDepositsRequest { + const message = createBaseQueryDepositsRequest(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryDepositsRequestAmino): QueryDepositsRequest { + const message = createBaseQueryDepositsRequest(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDepositsRequest): QueryDepositsRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId?.toString() : undefined; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDepositsRequestAminoMsg): QueryDepositsRequest { + return QueryDepositsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDepositsRequest): QueryDepositsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDepositsRequest", + value: QueryDepositsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDepositsRequestProtoMsg): QueryDepositsRequest { + return QueryDepositsRequest.decode(message.value); + }, + toProto(message: QueryDepositsRequest): Uint8Array { + return QueryDepositsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDepositsRequest): QueryDepositsRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryDepositsRequest", + value: QueryDepositsRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryDepositsRequest.typeUrl, QueryDepositsRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryDepositsRequest.aminoType, QueryDepositsRequest.typeUrl); +function createBaseQueryDepositsResponse(): QueryDepositsResponse { + return { + deposits: [], + pagination: undefined + }; +} +export const QueryDepositsResponse = { + typeUrl: "/cosmos.gov.v1beta1.QueryDepositsResponse", + aminoType: "cosmos-sdk/QueryDepositsResponse", + is(o: any): o is QueryDepositsResponse { + return o && (o.$typeUrl === QueryDepositsResponse.typeUrl || Array.isArray(o.deposits) && (!o.deposits.length || Deposit.is(o.deposits[0]))); + }, + isAmino(o: any): o is QueryDepositsResponseAmino { + return o && (o.$typeUrl === QueryDepositsResponse.typeUrl || Array.isArray(o.deposits) && (!o.deposits.length || Deposit.isAmino(o.deposits[0]))); + }, + encode(message: QueryDepositsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.deposits) { + Deposit.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDepositsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDepositsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.deposits.push(Deposit.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDepositsResponse { + const message = createBaseQueryDepositsResponse(); + message.deposits = object.deposits?.map(e => Deposit.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryDepositsResponseAmino): QueryDepositsResponse { + const message = createBaseQueryDepositsResponse(); + message.deposits = object.deposits?.map(e => Deposit.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDepositsResponse): QueryDepositsResponseAmino { + const obj: any = {}; + if (message.deposits) { + obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); + } else { + obj.deposits = message.deposits; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDepositsResponseAminoMsg): QueryDepositsResponse { + return QueryDepositsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDepositsResponse): QueryDepositsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDepositsResponse", + value: QueryDepositsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDepositsResponseProtoMsg): QueryDepositsResponse { + return QueryDepositsResponse.decode(message.value); + }, + toProto(message: QueryDepositsResponse): Uint8Array { + return QueryDepositsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDepositsResponse): QueryDepositsResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryDepositsResponse", + value: QueryDepositsResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryDepositsResponse.typeUrl, QueryDepositsResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryDepositsResponse.aminoType, QueryDepositsResponse.typeUrl); +function createBaseQueryTallyResultRequest(): QueryTallyResultRequest { + return { + proposalId: BigInt(0) + }; +} +export const QueryTallyResultRequest = { + typeUrl: "/cosmos.gov.v1beta1.QueryTallyResultRequest", + aminoType: "cosmos-sdk/QueryTallyResultRequest", + is(o: any): o is QueryTallyResultRequest { + return o && (o.$typeUrl === QueryTallyResultRequest.typeUrl || typeof o.proposalId === "bigint"); + }, + isAmino(o: any): o is QueryTallyResultRequestAmino { + return o && (o.$typeUrl === QueryTallyResultRequest.typeUrl || typeof o.proposal_id === "bigint"); + }, + encode(message: QueryTallyResultRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryTallyResultRequest { + const message = createBaseQueryTallyResultRequest(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + return message; + }, + fromAmino(object: QueryTallyResultRequestAmino): QueryTallyResultRequest { + const message = createBaseQueryTallyResultRequest(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + return message; + }, + toAmino(message: QueryTallyResultRequest): QueryTallyResultRequestAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QueryTallyResultRequestAminoMsg): QueryTallyResultRequest { + return QueryTallyResultRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryTallyResultRequest): QueryTallyResultRequestAminoMsg { + return { + type: "cosmos-sdk/QueryTallyResultRequest", + value: QueryTallyResultRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryTallyResultRequestProtoMsg): QueryTallyResultRequest { + return QueryTallyResultRequest.decode(message.value); + }, + toProto(message: QueryTallyResultRequest): Uint8Array { + return QueryTallyResultRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryTallyResultRequest): QueryTallyResultRequestProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryTallyResultRequest", + value: QueryTallyResultRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryTallyResultRequest.typeUrl, QueryTallyResultRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryTallyResultRequest.aminoType, QueryTallyResultRequest.typeUrl); +function createBaseQueryTallyResultResponse(): QueryTallyResultResponse { + return { + tally: TallyResult.fromPartial({}) + }; +} +export const QueryTallyResultResponse = { + typeUrl: "/cosmos.gov.v1beta1.QueryTallyResultResponse", + aminoType: "cosmos-sdk/QueryTallyResultResponse", + is(o: any): o is QueryTallyResultResponse { + return o && (o.$typeUrl === QueryTallyResultResponse.typeUrl || TallyResult.is(o.tally)); + }, + isAmino(o: any): o is QueryTallyResultResponseAmino { + return o && (o.$typeUrl === QueryTallyResultResponse.typeUrl || TallyResult.isAmino(o.tally)); + }, + encode(message: QueryTallyResultResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.tally !== undefined) { + TallyResult.encode(message.tally, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryTallyResultResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryTallyResultResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.tally = TallyResult.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryTallyResultResponse { + const message = createBaseQueryTallyResultResponse(); + message.tally = object.tally !== undefined && object.tally !== null ? TallyResult.fromPartial(object.tally) : undefined; + return message; + }, + fromAmino(object: QueryTallyResultResponseAmino): QueryTallyResultResponse { + const message = createBaseQueryTallyResultResponse(); + if (object.tally !== undefined && object.tally !== null) { + message.tally = TallyResult.fromAmino(object.tally); + } + return message; + }, + toAmino(message: QueryTallyResultResponse): QueryTallyResultResponseAmino { + const obj: any = {}; + obj.tally = message.tally ? TallyResult.toAmino(message.tally) : TallyResult.toAmino(TallyResult.fromPartial({})); + return obj; + }, + fromAminoMsg(object: QueryTallyResultResponseAminoMsg): QueryTallyResultResponse { + return QueryTallyResultResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryTallyResultResponse): QueryTallyResultResponseAminoMsg { + return { + type: "cosmos-sdk/QueryTallyResultResponse", + value: QueryTallyResultResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryTallyResultResponseProtoMsg): QueryTallyResultResponse { + return QueryTallyResultResponse.decode(message.value); + }, + toProto(message: QueryTallyResultResponse): Uint8Array { + return QueryTallyResultResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryTallyResultResponse): QueryTallyResultResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.QueryTallyResultResponse", + value: QueryTallyResultResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryTallyResultResponse.typeUrl, QueryTallyResultResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryTallyResultResponse.aminoType, QueryTallyResultResponse.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/gov/v1beta1/tx.rpc.func.ts b/libs/interchain-query/src/cosmos/gov/v1beta1/tx.rpc.func.ts new file mode 100644 index 00000000..ff3449ec --- /dev/null +++ b/libs/interchain-query/src/cosmos/gov/v1beta1/tx.rpc.func.ts @@ -0,0 +1,40 @@ +import { buildTx, SigningClientResolver } from "../../../helper-func-types"; +import { buildUseMutation } from "../../../react-query"; +import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; +import { MsgSubmitProposal, MsgVote, MsgVoteWeighted, MsgDeposit } from "./tx"; +export const createSubmitProposal = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgSubmitProposal.typeUrl, + encoders: toEncoders(MsgSubmitProposal), + converters: toConverters(MsgSubmitProposal) +}); +export const useSubmitProposal = buildUseMutation({ + builderMutationFn: createSubmitProposal +}); +export const createVote = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgVote.typeUrl, + encoders: toEncoders(MsgVote), + converters: toConverters(MsgVote) +}); +export const useVote = buildUseMutation({ + builderMutationFn: createVote +}); +export const createVoteWeighted = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgVoteWeighted.typeUrl, + encoders: toEncoders(MsgVoteWeighted), + converters: toConverters(MsgVoteWeighted) +}); +export const useVoteWeighted = buildUseMutation({ + builderMutationFn: createVoteWeighted +}); +export const createDeposit = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgDeposit.typeUrl, + encoders: toEncoders(MsgDeposit), + converters: toConverters(MsgDeposit) +}); +export const useDeposit = buildUseMutation({ + builderMutationFn: createDeposit +}); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/gov/v1beta1/tx.ts b/libs/interchain-query/src/cosmos/gov/v1beta1/tx.ts new file mode 100644 index 00000000..df28a21e --- /dev/null +++ b/libs/interchain-query/src/cosmos/gov/v1beta1/tx.ts @@ -0,0 +1,879 @@ +import { Any, AnyProtoMsg, AnyAmino } from "../../../google/protobuf/any"; +import { Coin, CoinAmino } from "../../base/v1beta1/coin"; +import { VoteOption, WeightedVoteOption, WeightedVoteOptionAmino, TextProposal, TextProposalProtoMsg } from "./gov"; +import { CommunityPoolSpendProposal, CommunityPoolSpendProposalProtoMsg, CommunityPoolSpendProposalWithDeposit, CommunityPoolSpendProposalWithDepositProtoMsg } from "../../distribution/v1beta1/distribution"; +import { SoftwareUpgradeProposal, SoftwareUpgradeProposalProtoMsg, CancelSoftwareUpgradeProposal, CancelSoftwareUpgradeProposalProtoMsg } from "../../upgrade/v1beta1/upgrade"; +import { ClientUpdateProposal, ClientUpdateProposalProtoMsg, UpgradeProposal, UpgradeProposalProtoMsg } from "../../../ibc/core/client/v1/client"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial, isSet } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; +/** + * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary + * proposal Content. + */ +export interface MsgSubmitProposal { + /** content is the proposal's content. */ + content?: CommunityPoolSpendProposal | CommunityPoolSpendProposalWithDeposit | TextProposal | SoftwareUpgradeProposal | CancelSoftwareUpgradeProposal | ClientUpdateProposal | UpgradeProposal | Any | undefined; + /** initial_deposit is the deposit value that must be paid at proposal submission. */ + initialDeposit: Coin[]; + /** proposer is the account address of the proposer. */ + proposer: string; +} +export interface MsgSubmitProposalProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposal"; + value: Uint8Array; +} +export type MsgSubmitProposalEncoded = Omit & { + /** content is the proposal's content. */content?: CommunityPoolSpendProposalProtoMsg | CommunityPoolSpendProposalWithDepositProtoMsg | TextProposalProtoMsg | SoftwareUpgradeProposalProtoMsg | CancelSoftwareUpgradeProposalProtoMsg | ClientUpdateProposalProtoMsg | UpgradeProposalProtoMsg | AnyProtoMsg | undefined; +}; +/** + * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary + * proposal Content. + */ +export interface MsgSubmitProposalAmino { + /** content is the proposal's content. */ + content?: AnyAmino; + /** initial_deposit is the deposit value that must be paid at proposal submission. */ + initial_deposit: CoinAmino[]; + /** proposer is the account address of the proposer. */ + proposer: string; +} +export interface MsgSubmitProposalAminoMsg { + type: "cosmos-sdk/MsgSubmitProposal"; + value: MsgSubmitProposalAmino; +} +/** MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. */ +export interface MsgSubmitProposalResponse { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; +} +export interface MsgSubmitProposalResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposalResponse"; + value: Uint8Array; +} +/** MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. */ +export interface MsgSubmitProposalResponseAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; +} +export interface MsgSubmitProposalResponseAminoMsg { + type: "cosmos-sdk/MsgSubmitProposalResponse"; + value: MsgSubmitProposalResponseAmino; +} +/** MsgVote defines a message to cast a vote. */ +export interface MsgVote { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; + /** voter is the voter address for the proposal. */ + voter: string; + /** option defines the vote option. */ + option: VoteOption; +} +export interface MsgVoteProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.MsgVote"; + value: Uint8Array; +} +/** MsgVote defines a message to cast a vote. */ +export interface MsgVoteAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** voter is the voter address for the proposal. */ + voter: string; + /** option defines the vote option. */ + option: VoteOption; +} +export interface MsgVoteAminoMsg { + type: "cosmos-sdk/MsgVote"; + value: MsgVoteAmino; +} +/** MsgVoteResponse defines the Msg/Vote response type. */ +export interface MsgVoteResponse {} +export interface MsgVoteResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.MsgVoteResponse"; + value: Uint8Array; +} +/** MsgVoteResponse defines the Msg/Vote response type. */ +export interface MsgVoteResponseAmino {} +export interface MsgVoteResponseAminoMsg { + type: "cosmos-sdk/MsgVoteResponse"; + value: MsgVoteResponseAmino; +} +/** + * MsgVoteWeighted defines a message to cast a vote. + * + * Since: cosmos-sdk 0.43 + */ +export interface MsgVoteWeighted { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; + /** voter is the voter address for the proposal. */ + voter: string; + /** options defines the weighted vote options. */ + options: WeightedVoteOption[]; +} +export interface MsgVoteWeightedProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeighted"; + value: Uint8Array; +} +/** + * MsgVoteWeighted defines a message to cast a vote. + * + * Since: cosmos-sdk 0.43 + */ +export interface MsgVoteWeightedAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** voter is the voter address for the proposal. */ + voter: string; + /** options defines the weighted vote options. */ + options: WeightedVoteOptionAmino[]; +} +export interface MsgVoteWeightedAminoMsg { + type: "cosmos-sdk/MsgVoteWeighted"; + value: MsgVoteWeightedAmino; +} +/** + * MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. + * + * Since: cosmos-sdk 0.43 + */ +export interface MsgVoteWeightedResponse {} +export interface MsgVoteWeightedResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeightedResponse"; + value: Uint8Array; +} +/** + * MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. + * + * Since: cosmos-sdk 0.43 + */ +export interface MsgVoteWeightedResponseAmino {} +export interface MsgVoteWeightedResponseAminoMsg { + type: "cosmos-sdk/MsgVoteWeightedResponse"; + value: MsgVoteWeightedResponseAmino; +} +/** MsgDeposit defines a message to submit a deposit to an existing proposal. */ +export interface MsgDeposit { + /** proposal_id defines the unique id of the proposal. */ + proposalId: bigint; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** amount to be deposited by depositor. */ + amount: Coin[]; +} +export interface MsgDepositProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.MsgDeposit"; + value: Uint8Array; +} +/** MsgDeposit defines a message to submit a deposit to an existing proposal. */ +export interface MsgDepositAmino { + /** proposal_id defines the unique id of the proposal. */ + proposal_id: string; + /** depositor defines the deposit addresses from the proposals. */ + depositor: string; + /** amount to be deposited by depositor. */ + amount: CoinAmino[]; +} +export interface MsgDepositAminoMsg { + type: "cosmos-sdk/MsgDeposit"; + value: MsgDepositAmino; +} +/** MsgDepositResponse defines the Msg/Deposit response type. */ +export interface MsgDepositResponse {} +export interface MsgDepositResponseProtoMsg { + typeUrl: "/cosmos.gov.v1beta1.MsgDepositResponse"; + value: Uint8Array; +} +/** MsgDepositResponse defines the Msg/Deposit response type. */ +export interface MsgDepositResponseAmino {} +export interface MsgDepositResponseAminoMsg { + type: "cosmos-sdk/MsgDepositResponse"; + value: MsgDepositResponseAmino; +} +function createBaseMsgSubmitProposal(): MsgSubmitProposal { + return { + content: undefined, + initialDeposit: [], + proposer: "" + }; +} +export const MsgSubmitProposal = { + typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposal", + aminoType: "cosmos-sdk/MsgSubmitProposal", + is(o: any): o is MsgSubmitProposal { + return o && (o.$typeUrl === MsgSubmitProposal.typeUrl || Array.isArray(o.initialDeposit) && (!o.initialDeposit.length || Coin.is(o.initialDeposit[0])) && typeof o.proposer === "string"); + }, + isAmino(o: any): o is MsgSubmitProposalAmino { + return o && (o.$typeUrl === MsgSubmitProposal.typeUrl || Array.isArray(o.initial_deposit) && (!o.initial_deposit.length || Coin.isAmino(o.initial_deposit[0])) && typeof o.proposer === "string"); + }, + encode(message: MsgSubmitProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.content !== undefined) { + Any.encode(GlobalDecoderRegistry.wrapAny(message.content), writer.uint32(10).fork()).ldelim(); + } + for (const v of message.initialDeposit) { + Coin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.proposer !== "") { + writer.uint32(26).string(message.proposer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.content = GlobalDecoderRegistry.unwrapAny(reader); + break; + case 2: + message.initialDeposit.push(Coin.decode(reader, reader.uint32())); + break; + case 3: + message.proposer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgSubmitProposal { + const message = createBaseMsgSubmitProposal(); + message.content = object.content !== undefined && object.content !== null ? GlobalDecoderRegistry.fromPartial(object.content) : undefined; + message.initialDeposit = object.initialDeposit?.map(e => Coin.fromPartial(e)) || []; + message.proposer = object.proposer ?? ""; + return message; + }, + fromAmino(object: MsgSubmitProposalAmino): MsgSubmitProposal { + const message = createBaseMsgSubmitProposal(); + if (object.content !== undefined && object.content !== null) { + message.content = GlobalDecoderRegistry.fromAminoMsg(object.content); + } + message.initialDeposit = object.initial_deposit?.map(e => Coin.fromAmino(e)) || []; + if (object.proposer !== undefined && object.proposer !== null) { + message.proposer = object.proposer; + } + return message; + }, + toAmino(message: MsgSubmitProposal): MsgSubmitProposalAmino { + const obj: any = {}; + obj.content = message.content ? GlobalDecoderRegistry.toAminoMsg(message.content) : undefined; + if (message.initialDeposit) { + obj.initial_deposit = message.initialDeposit.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.initial_deposit = message.initialDeposit; + } + obj.proposer = message.proposer === "" ? undefined : message.proposer; + return obj; + }, + fromAminoMsg(object: MsgSubmitProposalAminoMsg): MsgSubmitProposal { + return MsgSubmitProposal.fromAmino(object.value); + }, + toAminoMsg(message: MsgSubmitProposal): MsgSubmitProposalAminoMsg { + return { + type: "cosmos-sdk/MsgSubmitProposal", + value: MsgSubmitProposal.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSubmitProposalProtoMsg): MsgSubmitProposal { + return MsgSubmitProposal.decode(message.value); + }, + toProto(message: MsgSubmitProposal): Uint8Array { + return MsgSubmitProposal.encode(message).finish(); + }, + toProtoMsg(message: MsgSubmitProposal): MsgSubmitProposalProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposal", + value: MsgSubmitProposal.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgSubmitProposal.typeUrl, MsgSubmitProposal); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgSubmitProposal.aminoType, MsgSubmitProposal.typeUrl); +function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { + return { + proposalId: BigInt(0) + }; +} +export const MsgSubmitProposalResponse = { + typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposalResponse", + aminoType: "cosmos-sdk/MsgSubmitProposalResponse", + is(o: any): o is MsgSubmitProposalResponse { + return o && (o.$typeUrl === MsgSubmitProposalResponse.typeUrl || typeof o.proposalId === "bigint"); + }, + isAmino(o: any): o is MsgSubmitProposalResponseAmino { + return o && (o.$typeUrl === MsgSubmitProposalResponse.typeUrl || typeof o.proposal_id === "bigint"); + }, + encode(message: MsgSubmitProposalResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgSubmitProposalResponse { + const message = createBaseMsgSubmitProposalResponse(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + return message; + }, + fromAmino(object: MsgSubmitProposalResponseAmino): MsgSubmitProposalResponse { + const message = createBaseMsgSubmitProposalResponse(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + return message; + }, + toAmino(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId?.toString() : "0"; + return obj; + }, + fromAminoMsg(object: MsgSubmitProposalResponseAminoMsg): MsgSubmitProposalResponse { + return MsgSubmitProposalResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAminoMsg { + return { + type: "cosmos-sdk/MsgSubmitProposalResponse", + value: MsgSubmitProposalResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSubmitProposalResponseProtoMsg): MsgSubmitProposalResponse { + return MsgSubmitProposalResponse.decode(message.value); + }, + toProto(message: MsgSubmitProposalResponse): Uint8Array { + return MsgSubmitProposalResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposalResponse", + value: MsgSubmitProposalResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgSubmitProposalResponse.typeUrl, MsgSubmitProposalResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgSubmitProposalResponse.aminoType, MsgSubmitProposalResponse.typeUrl); +function createBaseMsgVote(): MsgVote { + return { + proposalId: BigInt(0), + voter: "", + option: 0 + }; +} +export const MsgVote = { + typeUrl: "/cosmos.gov.v1beta1.MsgVote", + aminoType: "cosmos-sdk/MsgVote", + is(o: any): o is MsgVote { + return o && (o.$typeUrl === MsgVote.typeUrl || typeof o.proposalId === "bigint" && typeof o.voter === "string" && isSet(o.option)); + }, + isAmino(o: any): o is MsgVoteAmino { + return o && (o.$typeUrl === MsgVote.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string" && isSet(o.option)); + }, + encode(message: MsgVote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== 0) { + writer.uint32(24).int32(message.option); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.voter = reader.string(); + break; + case 3: + message.option = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgVote { + const message = createBaseMsgVote(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.voter = object.voter ?? ""; + message.option = object.option ?? 0; + return message; + }, + fromAmino(object: MsgVoteAmino): MsgVote { + const message = createBaseMsgVote(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.voter !== undefined && object.voter !== null) { + message.voter = object.voter; + } + if (object.option !== undefined && object.option !== null) { + message.option = object.option; + } + return message; + }, + toAmino(message: MsgVote): MsgVoteAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId?.toString() : undefined; + obj.voter = message.voter === "" ? undefined : message.voter; + obj.option = message.option === 0 ? undefined : message.option; + return obj; + }, + fromAminoMsg(object: MsgVoteAminoMsg): MsgVote { + return MsgVote.fromAmino(object.value); + }, + toAminoMsg(message: MsgVote): MsgVoteAminoMsg { + return { + type: "cosmos-sdk/MsgVote", + value: MsgVote.toAmino(message) + }; + }, + fromProtoMsg(message: MsgVoteProtoMsg): MsgVote { + return MsgVote.decode(message.value); + }, + toProto(message: MsgVote): Uint8Array { + return MsgVote.encode(message).finish(); + }, + toProtoMsg(message: MsgVote): MsgVoteProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgVote", + value: MsgVote.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgVote.typeUrl, MsgVote); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgVote.aminoType, MsgVote.typeUrl); +function createBaseMsgVoteResponse(): MsgVoteResponse { + return {}; +} +export const MsgVoteResponse = { + typeUrl: "/cosmos.gov.v1beta1.MsgVoteResponse", + aminoType: "cosmos-sdk/MsgVoteResponse", + is(o: any): o is MsgVoteResponse { + return o && o.$typeUrl === MsgVoteResponse.typeUrl; + }, + isAmino(o: any): o is MsgVoteResponseAmino { + return o && o.$typeUrl === MsgVoteResponse.typeUrl; + }, + encode(_: MsgVoteResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgVoteResponse { + const message = createBaseMsgVoteResponse(); + return message; + }, + fromAmino(_: MsgVoteResponseAmino): MsgVoteResponse { + const message = createBaseMsgVoteResponse(); + return message; + }, + toAmino(_: MsgVoteResponse): MsgVoteResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgVoteResponseAminoMsg): MsgVoteResponse { + return MsgVoteResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgVoteResponse): MsgVoteResponseAminoMsg { + return { + type: "cosmos-sdk/MsgVoteResponse", + value: MsgVoteResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgVoteResponseProtoMsg): MsgVoteResponse { + return MsgVoteResponse.decode(message.value); + }, + toProto(message: MsgVoteResponse): Uint8Array { + return MsgVoteResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgVoteResponse): MsgVoteResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgVoteResponse", + value: MsgVoteResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgVoteResponse.typeUrl, MsgVoteResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgVoteResponse.aminoType, MsgVoteResponse.typeUrl); +function createBaseMsgVoteWeighted(): MsgVoteWeighted { + return { + proposalId: BigInt(0), + voter: "", + options: [] + }; +} +export const MsgVoteWeighted = { + typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeighted", + aminoType: "cosmos-sdk/MsgVoteWeighted", + is(o: any): o is MsgVoteWeighted { + return o && (o.$typeUrl === MsgVoteWeighted.typeUrl || typeof o.proposalId === "bigint" && typeof o.voter === "string" && Array.isArray(o.options) && (!o.options.length || WeightedVoteOption.is(o.options[0]))); + }, + isAmino(o: any): o is MsgVoteWeightedAmino { + return o && (o.$typeUrl === MsgVoteWeighted.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string" && Array.isArray(o.options) && (!o.options.length || WeightedVoteOption.isAmino(o.options[0]))); + }, + encode(message: MsgVoteWeighted, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + for (const v of message.options) { + WeightedVoteOption.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteWeighted { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteWeighted(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.voter = reader.string(); + break; + case 3: + message.options.push(WeightedVoteOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgVoteWeighted { + const message = createBaseMsgVoteWeighted(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.voter = object.voter ?? ""; + message.options = object.options?.map(e => WeightedVoteOption.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MsgVoteWeightedAmino): MsgVoteWeighted { + const message = createBaseMsgVoteWeighted(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.voter !== undefined && object.voter !== null) { + message.voter = object.voter; + } + message.options = object.options?.map(e => WeightedVoteOption.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgVoteWeighted): MsgVoteWeightedAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId?.toString() : "0"; + obj.voter = message.voter === "" ? undefined : message.voter; + if (message.options) { + obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); + } else { + obj.options = message.options; + } + return obj; + }, + fromAminoMsg(object: MsgVoteWeightedAminoMsg): MsgVoteWeighted { + return MsgVoteWeighted.fromAmino(object.value); + }, + toAminoMsg(message: MsgVoteWeighted): MsgVoteWeightedAminoMsg { + return { + type: "cosmos-sdk/MsgVoteWeighted", + value: MsgVoteWeighted.toAmino(message) + }; + }, + fromProtoMsg(message: MsgVoteWeightedProtoMsg): MsgVoteWeighted { + return MsgVoteWeighted.decode(message.value); + }, + toProto(message: MsgVoteWeighted): Uint8Array { + return MsgVoteWeighted.encode(message).finish(); + }, + toProtoMsg(message: MsgVoteWeighted): MsgVoteWeightedProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeighted", + value: MsgVoteWeighted.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgVoteWeighted.typeUrl, MsgVoteWeighted); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgVoteWeighted.aminoType, MsgVoteWeighted.typeUrl); +function createBaseMsgVoteWeightedResponse(): MsgVoteWeightedResponse { + return {}; +} +export const MsgVoteWeightedResponse = { + typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeightedResponse", + aminoType: "cosmos-sdk/MsgVoteWeightedResponse", + is(o: any): o is MsgVoteWeightedResponse { + return o && o.$typeUrl === MsgVoteWeightedResponse.typeUrl; + }, + isAmino(o: any): o is MsgVoteWeightedResponseAmino { + return o && o.$typeUrl === MsgVoteWeightedResponse.typeUrl; + }, + encode(_: MsgVoteWeightedResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteWeightedResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteWeightedResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgVoteWeightedResponse { + const message = createBaseMsgVoteWeightedResponse(); + return message; + }, + fromAmino(_: MsgVoteWeightedResponseAmino): MsgVoteWeightedResponse { + const message = createBaseMsgVoteWeightedResponse(); + return message; + }, + toAmino(_: MsgVoteWeightedResponse): MsgVoteWeightedResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgVoteWeightedResponseAminoMsg): MsgVoteWeightedResponse { + return MsgVoteWeightedResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgVoteWeightedResponse): MsgVoteWeightedResponseAminoMsg { + return { + type: "cosmos-sdk/MsgVoteWeightedResponse", + value: MsgVoteWeightedResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgVoteWeightedResponseProtoMsg): MsgVoteWeightedResponse { + return MsgVoteWeightedResponse.decode(message.value); + }, + toProto(message: MsgVoteWeightedResponse): Uint8Array { + return MsgVoteWeightedResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgVoteWeightedResponse): MsgVoteWeightedResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeightedResponse", + value: MsgVoteWeightedResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgVoteWeightedResponse.typeUrl, MsgVoteWeightedResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgVoteWeightedResponse.aminoType, MsgVoteWeightedResponse.typeUrl); +function createBaseMsgDeposit(): MsgDeposit { + return { + proposalId: BigInt(0), + depositor: "", + amount: [] + }; +} +export const MsgDeposit = { + typeUrl: "/cosmos.gov.v1beta1.MsgDeposit", + aminoType: "cosmos-sdk/MsgDeposit", + is(o: any): o is MsgDeposit { + return o && (o.$typeUrl === MsgDeposit.typeUrl || typeof o.proposalId === "bigint" && typeof o.depositor === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0]))); + }, + isAmino(o: any): o is MsgDepositAmino { + return o && (o.$typeUrl === MsgDeposit.typeUrl || typeof o.proposal_id === "bigint" && typeof o.depositor === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0]))); + }, + encode(message: MsgDeposit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.depositor !== "") { + writer.uint32(18).string(message.depositor); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgDeposit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDeposit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.depositor = reader.string(); + break; + case 3: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgDeposit { + const message = createBaseMsgDeposit(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.depositor = object.depositor ?? ""; + message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MsgDepositAmino): MsgDeposit { + const message = createBaseMsgDeposit(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.depositor !== undefined && object.depositor !== null) { + message.depositor = object.depositor; + } + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgDeposit): MsgDepositAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId ? message.proposalId?.toString() : "0"; + obj.depositor = message.depositor === "" ? undefined : message.depositor; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = message.amount; + } + return obj; + }, + fromAminoMsg(object: MsgDepositAminoMsg): MsgDeposit { + return MsgDeposit.fromAmino(object.value); + }, + toAminoMsg(message: MsgDeposit): MsgDepositAminoMsg { + return { + type: "cosmos-sdk/MsgDeposit", + value: MsgDeposit.toAmino(message) + }; + }, + fromProtoMsg(message: MsgDepositProtoMsg): MsgDeposit { + return MsgDeposit.decode(message.value); + }, + toProto(message: MsgDeposit): Uint8Array { + return MsgDeposit.encode(message).finish(); + }, + toProtoMsg(message: MsgDeposit): MsgDepositProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgDeposit", + value: MsgDeposit.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgDeposit.typeUrl, MsgDeposit); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgDeposit.aminoType, MsgDeposit.typeUrl); +function createBaseMsgDepositResponse(): MsgDepositResponse { + return {}; +} +export const MsgDepositResponse = { + typeUrl: "/cosmos.gov.v1beta1.MsgDepositResponse", + aminoType: "cosmos-sdk/MsgDepositResponse", + is(o: any): o is MsgDepositResponse { + return o && o.$typeUrl === MsgDepositResponse.typeUrl; + }, + isAmino(o: any): o is MsgDepositResponseAmino { + return o && o.$typeUrl === MsgDepositResponse.typeUrl; + }, + encode(_: MsgDepositResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgDepositResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDepositResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgDepositResponse { + const message = createBaseMsgDepositResponse(); + return message; + }, + fromAmino(_: MsgDepositResponseAmino): MsgDepositResponse { + const message = createBaseMsgDepositResponse(); + return message; + }, + toAmino(_: MsgDepositResponse): MsgDepositResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgDepositResponseAminoMsg): MsgDepositResponse { + return MsgDepositResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgDepositResponse): MsgDepositResponseAminoMsg { + return { + type: "cosmos-sdk/MsgDepositResponse", + value: MsgDepositResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgDepositResponseProtoMsg): MsgDepositResponse { + return MsgDepositResponse.decode(message.value); + }, + toProto(message: MsgDepositResponse): Uint8Array { + return MsgDepositResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgDepositResponse): MsgDepositResponseProtoMsg { + return { + typeUrl: "/cosmos.gov.v1beta1.MsgDepositResponse", + value: MsgDepositResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgDepositResponse.typeUrl, MsgDepositResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgDepositResponse.aminoType, MsgDepositResponse.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/group/v1/tx.rpc.func.ts b/libs/interchain-query/src/cosmos/group/v1/tx.rpc.func.ts new file mode 100644 index 00000000..95673a00 --- /dev/null +++ b/libs/interchain-query/src/cosmos/group/v1/tx.rpc.func.ts @@ -0,0 +1,130 @@ +import { buildTx, SigningClientResolver } from "../../../helper-func-types"; +import { buildUseMutation } from "../../../react-query"; +import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; +import { MsgCreateGroup, MsgUpdateGroupMembers, MsgUpdateGroupAdmin, MsgUpdateGroupMetadata, MsgCreateGroupPolicy, MsgCreateGroupWithPolicy, MsgUpdateGroupPolicyAdmin, MsgUpdateGroupPolicyDecisionPolicy, MsgUpdateGroupPolicyMetadata, MsgSubmitProposal, MsgWithdrawProposal, MsgVote, MsgExec, MsgLeaveGroup } from "./tx"; +export const createCreateGroup = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgCreateGroup.typeUrl, + encoders: toEncoders(MsgCreateGroup), + converters: toConverters(MsgCreateGroup) +}); +export const useCreateGroup = buildUseMutation({ + builderMutationFn: createCreateGroup +}); +export const createUpdateGroupMembers = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgUpdateGroupMembers.typeUrl, + encoders: toEncoders(MsgUpdateGroupMembers), + converters: toConverters(MsgUpdateGroupMembers) +}); +export const useUpdateGroupMembers = buildUseMutation({ + builderMutationFn: createUpdateGroupMembers +}); +export const createUpdateGroupAdmin = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgUpdateGroupAdmin.typeUrl, + encoders: toEncoders(MsgUpdateGroupAdmin), + converters: toConverters(MsgUpdateGroupAdmin) +}); +export const useUpdateGroupAdmin = buildUseMutation({ + builderMutationFn: createUpdateGroupAdmin +}); +export const createUpdateGroupMetadata = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgUpdateGroupMetadata.typeUrl, + encoders: toEncoders(MsgUpdateGroupMetadata), + converters: toConverters(MsgUpdateGroupMetadata) +}); +export const useUpdateGroupMetadata = buildUseMutation({ + builderMutationFn: createUpdateGroupMetadata +}); +export const createCreateGroupPolicy = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgCreateGroupPolicy.typeUrl, + encoders: toEncoders(MsgCreateGroupPolicy), + converters: toConverters(MsgCreateGroupPolicy) +}); +export const useCreateGroupPolicy = buildUseMutation({ + builderMutationFn: createCreateGroupPolicy +}); +export const createCreateGroupWithPolicy = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgCreateGroupWithPolicy.typeUrl, + encoders: toEncoders(MsgCreateGroupWithPolicy), + converters: toConverters(MsgCreateGroupWithPolicy) +}); +export const useCreateGroupWithPolicy = buildUseMutation({ + builderMutationFn: createCreateGroupWithPolicy +}); +export const createUpdateGroupPolicyAdmin = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgUpdateGroupPolicyAdmin.typeUrl, + encoders: toEncoders(MsgUpdateGroupPolicyAdmin), + converters: toConverters(MsgUpdateGroupPolicyAdmin) +}); +export const useUpdateGroupPolicyAdmin = buildUseMutation({ + builderMutationFn: createUpdateGroupPolicyAdmin +}); +export const createUpdateGroupPolicyDecisionPolicy = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgUpdateGroupPolicyDecisionPolicy.typeUrl, + encoders: toEncoders(MsgUpdateGroupPolicyDecisionPolicy), + converters: toConverters(MsgUpdateGroupPolicyDecisionPolicy) +}); +export const useUpdateGroupPolicyDecisionPolicy = buildUseMutation({ + builderMutationFn: createUpdateGroupPolicyDecisionPolicy +}); +export const createUpdateGroupPolicyMetadata = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgUpdateGroupPolicyMetadata.typeUrl, + encoders: toEncoders(MsgUpdateGroupPolicyMetadata), + converters: toConverters(MsgUpdateGroupPolicyMetadata) +}); +export const useUpdateGroupPolicyMetadata = buildUseMutation({ + builderMutationFn: createUpdateGroupPolicyMetadata +}); +export const createSubmitProposal = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgSubmitProposal.typeUrl, + encoders: toEncoders(MsgSubmitProposal), + converters: toConverters(MsgSubmitProposal) +}); +export const useSubmitProposal = buildUseMutation({ + builderMutationFn: createSubmitProposal +}); +export const createWithdrawProposal = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgWithdrawProposal.typeUrl, + encoders: toEncoders(MsgWithdrawProposal), + converters: toConverters(MsgWithdrawProposal) +}); +export const useWithdrawProposal = buildUseMutation({ + builderMutationFn: createWithdrawProposal +}); +export const createVote = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgVote.typeUrl, + encoders: toEncoders(MsgVote), + converters: toConverters(MsgVote) +}); +export const useVote = buildUseMutation({ + builderMutationFn: createVote +}); +export const createExec = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgExec.typeUrl, + encoders: toEncoders(MsgExec), + converters: toConverters(MsgExec) +}); +export const useExec = buildUseMutation({ + builderMutationFn: createExec +}); +export const createLeaveGroup = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgLeaveGroup.typeUrl, + encoders: toEncoders(MsgLeaveGroup), + converters: toConverters(MsgLeaveGroup) +}); +export const useLeaveGroup = buildUseMutation({ + builderMutationFn: createLeaveGroup +}); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/group/v1/tx.ts b/libs/interchain-query/src/cosmos/group/v1/tx.ts new file mode 100644 index 00000000..492b0084 --- /dev/null +++ b/libs/interchain-query/src/cosmos/group/v1/tx.ts @@ -0,0 +1,3207 @@ +import { MemberRequest, MemberRequestAmino, VoteOption, ProposalExecutorResult, ThresholdDecisionPolicy, ThresholdDecisionPolicyProtoMsg, PercentageDecisionPolicy, PercentageDecisionPolicyProtoMsg } from "./types"; +import { Any, AnyProtoMsg, AnyAmino } from "../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial, isSet } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; +/** Exec defines modes of execution of a proposal on creation or on new vote. */ +export enum Exec { + /** + * EXEC_UNSPECIFIED - An empty value means that there should be a separate + * MsgExec request for the proposal to execute. + */ + EXEC_UNSPECIFIED = 0, + /** + * EXEC_TRY - Try to execute the proposal immediately. + * If the proposal is not allowed per the DecisionPolicy, + * the proposal will still be open and could + * be executed at a later point. + */ + EXEC_TRY = 1, + UNRECOGNIZED = -1, +} +export const ExecAmino = Exec; +export function execFromJSON(object: any): Exec { + switch (object) { + case 0: + case "EXEC_UNSPECIFIED": + return Exec.EXEC_UNSPECIFIED; + case 1: + case "EXEC_TRY": + return Exec.EXEC_TRY; + case -1: + case "UNRECOGNIZED": + default: + return Exec.UNRECOGNIZED; + } +} +export function execToJSON(object: Exec): string { + switch (object) { + case Exec.EXEC_UNSPECIFIED: + return "EXEC_UNSPECIFIED"; + case Exec.EXEC_TRY: + return "EXEC_TRY"; + case Exec.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** MsgCreateGroup is the Msg/CreateGroup request type. */ +export interface MsgCreateGroup { + /** admin is the account address of the group admin. */ + admin: string; + /** members defines the group members. */ + members: MemberRequest[]; + /** metadata is any arbitrary metadata to attached to the group. */ + metadata: string; +} +export interface MsgCreateGroupProtoMsg { + typeUrl: "/cosmos.group.v1.MsgCreateGroup"; + value: Uint8Array; +} +/** MsgCreateGroup is the Msg/CreateGroup request type. */ +export interface MsgCreateGroupAmino { + /** admin is the account address of the group admin. */ + admin: string; + /** members defines the group members. */ + members: MemberRequestAmino[]; + /** metadata is any arbitrary metadata to attached to the group. */ + metadata: string; +} +export interface MsgCreateGroupAminoMsg { + type: "cosmos-sdk/MsgCreateGroup"; + value: MsgCreateGroupAmino; +} +/** MsgCreateGroupResponse is the Msg/CreateGroup response type. */ +export interface MsgCreateGroupResponse { + /** group_id is the unique ID of the newly created group. */ + groupId: bigint; +} +export interface MsgCreateGroupResponseProtoMsg { + typeUrl: "/cosmos.group.v1.MsgCreateGroupResponse"; + value: Uint8Array; +} +/** MsgCreateGroupResponse is the Msg/CreateGroup response type. */ +export interface MsgCreateGroupResponseAmino { + /** group_id is the unique ID of the newly created group. */ + group_id: string; +} +export interface MsgCreateGroupResponseAminoMsg { + type: "cosmos-sdk/MsgCreateGroupResponse"; + value: MsgCreateGroupResponseAmino; +} +/** MsgUpdateGroupMembers is the Msg/UpdateGroupMembers request type. */ +export interface MsgUpdateGroupMembers { + /** admin is the account address of the group admin. */ + admin: string; + /** group_id is the unique ID of the group. */ + groupId: bigint; + /** + * member_updates is the list of members to update, + * set weight to 0 to remove a member. + */ + memberUpdates: MemberRequest[]; +} +export interface MsgUpdateGroupMembersProtoMsg { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupMembers"; + value: Uint8Array; +} +/** MsgUpdateGroupMembers is the Msg/UpdateGroupMembers request type. */ +export interface MsgUpdateGroupMembersAmino { + /** admin is the account address of the group admin. */ + admin: string; + /** group_id is the unique ID of the group. */ + group_id: string; + /** + * member_updates is the list of members to update, + * set weight to 0 to remove a member. + */ + member_updates: MemberRequestAmino[]; +} +export interface MsgUpdateGroupMembersAminoMsg { + type: "cosmos-sdk/MsgUpdateGroupMembers"; + value: MsgUpdateGroupMembersAmino; +} +/** MsgUpdateGroupMembersResponse is the Msg/UpdateGroupMembers response type. */ +export interface MsgUpdateGroupMembersResponse {} +export interface MsgUpdateGroupMembersResponseProtoMsg { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupMembersResponse"; + value: Uint8Array; +} +/** MsgUpdateGroupMembersResponse is the Msg/UpdateGroupMembers response type. */ +export interface MsgUpdateGroupMembersResponseAmino {} +export interface MsgUpdateGroupMembersResponseAminoMsg { + type: "cosmos-sdk/MsgUpdateGroupMembersResponse"; + value: MsgUpdateGroupMembersResponseAmino; +} +/** MsgUpdateGroupAdmin is the Msg/UpdateGroupAdmin request type. */ +export interface MsgUpdateGroupAdmin { + /** admin is the current account address of the group admin. */ + admin: string; + /** group_id is the unique ID of the group. */ + groupId: bigint; + /** new_admin is the group new admin account address. */ + newAdmin: string; +} +export interface MsgUpdateGroupAdminProtoMsg { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupAdmin"; + value: Uint8Array; +} +/** MsgUpdateGroupAdmin is the Msg/UpdateGroupAdmin request type. */ +export interface MsgUpdateGroupAdminAmino { + /** admin is the current account address of the group admin. */ + admin: string; + /** group_id is the unique ID of the group. */ + group_id: string; + /** new_admin is the group new admin account address. */ + new_admin: string; +} +export interface MsgUpdateGroupAdminAminoMsg { + type: "cosmos-sdk/MsgUpdateGroupAdmin"; + value: MsgUpdateGroupAdminAmino; +} +/** MsgUpdateGroupAdminResponse is the Msg/UpdateGroupAdmin response type. */ +export interface MsgUpdateGroupAdminResponse {} +export interface MsgUpdateGroupAdminResponseProtoMsg { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupAdminResponse"; + value: Uint8Array; +} +/** MsgUpdateGroupAdminResponse is the Msg/UpdateGroupAdmin response type. */ +export interface MsgUpdateGroupAdminResponseAmino {} +export interface MsgUpdateGroupAdminResponseAminoMsg { + type: "cosmos-sdk/MsgUpdateGroupAdminResponse"; + value: MsgUpdateGroupAdminResponseAmino; +} +/** MsgUpdateGroupMetadata is the Msg/UpdateGroupMetadata request type. */ +export interface MsgUpdateGroupMetadata { + /** admin is the account address of the group admin. */ + admin: string; + /** group_id is the unique ID of the group. */ + groupId: bigint; + /** metadata is the updated group's metadata. */ + metadata: string; +} +export interface MsgUpdateGroupMetadataProtoMsg { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupMetadata"; + value: Uint8Array; +} +/** MsgUpdateGroupMetadata is the Msg/UpdateGroupMetadata request type. */ +export interface MsgUpdateGroupMetadataAmino { + /** admin is the account address of the group admin. */ + admin: string; + /** group_id is the unique ID of the group. */ + group_id: string; + /** metadata is the updated group's metadata. */ + metadata: string; +} +export interface MsgUpdateGroupMetadataAminoMsg { + type: "cosmos-sdk/MsgUpdateGroupMetadata"; + value: MsgUpdateGroupMetadataAmino; +} +/** MsgUpdateGroupMetadataResponse is the Msg/UpdateGroupMetadata response type. */ +export interface MsgUpdateGroupMetadataResponse {} +export interface MsgUpdateGroupMetadataResponseProtoMsg { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupMetadataResponse"; + value: Uint8Array; +} +/** MsgUpdateGroupMetadataResponse is the Msg/UpdateGroupMetadata response type. */ +export interface MsgUpdateGroupMetadataResponseAmino {} +export interface MsgUpdateGroupMetadataResponseAminoMsg { + type: "cosmos-sdk/MsgUpdateGroupMetadataResponse"; + value: MsgUpdateGroupMetadataResponseAmino; +} +/** MsgCreateGroupPolicy is the Msg/CreateGroupPolicy request type. */ +export interface MsgCreateGroupPolicy { + /** admin is the account address of the group admin. */ + admin: string; + /** group_id is the unique ID of the group. */ + groupId: bigint; + /** metadata is any arbitrary metadata attached to the group policy. */ + metadata: string; + /** decision_policy specifies the group policy's decision policy. */ + decisionPolicy?: ThresholdDecisionPolicy | PercentageDecisionPolicy | Any | undefined; +} +export interface MsgCreateGroupPolicyProtoMsg { + typeUrl: "/cosmos.group.v1.MsgCreateGroupPolicy"; + value: Uint8Array; +} +export type MsgCreateGroupPolicyEncoded = Omit & { + /** decision_policy specifies the group policy's decision policy. */decisionPolicy?: ThresholdDecisionPolicyProtoMsg | PercentageDecisionPolicyProtoMsg | AnyProtoMsg | undefined; +}; +/** MsgCreateGroupPolicy is the Msg/CreateGroupPolicy request type. */ +export interface MsgCreateGroupPolicyAmino { + /** admin is the account address of the group admin. */ + admin: string; + /** group_id is the unique ID of the group. */ + group_id: string; + /** metadata is any arbitrary metadata attached to the group policy. */ + metadata: string; + /** decision_policy specifies the group policy's decision policy. */ + decision_policy?: AnyAmino; +} +export interface MsgCreateGroupPolicyAminoMsg { + type: "cosmos-sdk/MsgCreateGroupPolicy"; + value: MsgCreateGroupPolicyAmino; +} +/** MsgCreateGroupPolicyResponse is the Msg/CreateGroupPolicy response type. */ +export interface MsgCreateGroupPolicyResponse { + /** address is the account address of the newly created group policy. */ + address: string; +} +export interface MsgCreateGroupPolicyResponseProtoMsg { + typeUrl: "/cosmos.group.v1.MsgCreateGroupPolicyResponse"; + value: Uint8Array; +} +/** MsgCreateGroupPolicyResponse is the Msg/CreateGroupPolicy response type. */ +export interface MsgCreateGroupPolicyResponseAmino { + /** address is the account address of the newly created group policy. */ + address: string; +} +export interface MsgCreateGroupPolicyResponseAminoMsg { + type: "cosmos-sdk/MsgCreateGroupPolicyResponse"; + value: MsgCreateGroupPolicyResponseAmino; +} +/** MsgUpdateGroupPolicyAdmin is the Msg/UpdateGroupPolicyAdmin request type. */ +export interface MsgUpdateGroupPolicyAdmin { + /** admin is the account address of the group admin. */ + admin: string; + /** group_policy_address is the account address of the group policy. */ + groupPolicyAddress: string; + /** new_admin is the new group policy admin. */ + newAdmin: string; +} +export interface MsgUpdateGroupPolicyAdminProtoMsg { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyAdmin"; + value: Uint8Array; +} +/** MsgUpdateGroupPolicyAdmin is the Msg/UpdateGroupPolicyAdmin request type. */ +export interface MsgUpdateGroupPolicyAdminAmino { + /** admin is the account address of the group admin. */ + admin: string; + /** group_policy_address is the account address of the group policy. */ + group_policy_address: string; + /** new_admin is the new group policy admin. */ + new_admin: string; +} +export interface MsgUpdateGroupPolicyAdminAminoMsg { + type: "cosmos-sdk/MsgUpdateGroupPolicyAdmin"; + value: MsgUpdateGroupPolicyAdminAmino; +} +/** MsgUpdateGroupPolicyAdminResponse is the Msg/UpdateGroupPolicyAdmin response type. */ +export interface MsgUpdateGroupPolicyAdminResponse {} +export interface MsgUpdateGroupPolicyAdminResponseProtoMsg { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyAdminResponse"; + value: Uint8Array; +} +/** MsgUpdateGroupPolicyAdminResponse is the Msg/UpdateGroupPolicyAdmin response type. */ +export interface MsgUpdateGroupPolicyAdminResponseAmino {} +export interface MsgUpdateGroupPolicyAdminResponseAminoMsg { + type: "cosmos-sdk/MsgUpdateGroupPolicyAdminResponse"; + value: MsgUpdateGroupPolicyAdminResponseAmino; +} +/** MsgCreateGroupWithPolicy is the Msg/CreateGroupWithPolicy request type. */ +export interface MsgCreateGroupWithPolicy { + /** admin is the account address of the group and group policy admin. */ + admin: string; + /** members defines the group members. */ + members: MemberRequest[]; + /** group_metadata is any arbitrary metadata attached to the group. */ + groupMetadata: string; + /** group_policy_metadata is any arbitrary metadata attached to the group policy. */ + groupPolicyMetadata: string; + /** + * group_policy_as_admin is a boolean field, if set to true, the group policy account address will be used as group + * and group policy admin. + */ + groupPolicyAsAdmin: boolean; + /** decision_policy specifies the group policy's decision policy. */ + decisionPolicy?: ThresholdDecisionPolicy | PercentageDecisionPolicy | Any | undefined; +} +export interface MsgCreateGroupWithPolicyProtoMsg { + typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicy"; + value: Uint8Array; +} +export type MsgCreateGroupWithPolicyEncoded = Omit & { + /** decision_policy specifies the group policy's decision policy. */decisionPolicy?: ThresholdDecisionPolicyProtoMsg | PercentageDecisionPolicyProtoMsg | AnyProtoMsg | undefined; +}; +/** MsgCreateGroupWithPolicy is the Msg/CreateGroupWithPolicy request type. */ +export interface MsgCreateGroupWithPolicyAmino { + /** admin is the account address of the group and group policy admin. */ + admin: string; + /** members defines the group members. */ + members: MemberRequestAmino[]; + /** group_metadata is any arbitrary metadata attached to the group. */ + group_metadata: string; + /** group_policy_metadata is any arbitrary metadata attached to the group policy. */ + group_policy_metadata: string; + /** + * group_policy_as_admin is a boolean field, if set to true, the group policy account address will be used as group + * and group policy admin. + */ + group_policy_as_admin: boolean; + /** decision_policy specifies the group policy's decision policy. */ + decision_policy?: AnyAmino; +} +export interface MsgCreateGroupWithPolicyAminoMsg { + type: "cosmos-sdk/MsgCreateGroupWithPolicy"; + value: MsgCreateGroupWithPolicyAmino; +} +/** MsgCreateGroupWithPolicyResponse is the Msg/CreateGroupWithPolicy response type. */ +export interface MsgCreateGroupWithPolicyResponse { + /** group_id is the unique ID of the newly created group with policy. */ + groupId: bigint; + /** group_policy_address is the account address of the newly created group policy. */ + groupPolicyAddress: string; +} +export interface MsgCreateGroupWithPolicyResponseProtoMsg { + typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicyResponse"; + value: Uint8Array; +} +/** MsgCreateGroupWithPolicyResponse is the Msg/CreateGroupWithPolicy response type. */ +export interface MsgCreateGroupWithPolicyResponseAmino { + /** group_id is the unique ID of the newly created group with policy. */ + group_id: string; + /** group_policy_address is the account address of the newly created group policy. */ + group_policy_address: string; +} +export interface MsgCreateGroupWithPolicyResponseAminoMsg { + type: "cosmos-sdk/MsgCreateGroupWithPolicyResponse"; + value: MsgCreateGroupWithPolicyResponseAmino; +} +/** MsgUpdateGroupPolicyDecisionPolicy is the Msg/UpdateGroupPolicyDecisionPolicy request type. */ +export interface MsgUpdateGroupPolicyDecisionPolicy { + /** admin is the account address of the group admin. */ + admin: string; + /** group_policy_address is the account address of group policy. */ + groupPolicyAddress: string; + /** decision_policy is the updated group policy's decision policy. */ + decisionPolicy?: ThresholdDecisionPolicy | PercentageDecisionPolicy | Any | undefined; +} +export interface MsgUpdateGroupPolicyDecisionPolicyProtoMsg { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy"; + value: Uint8Array; +} +export type MsgUpdateGroupPolicyDecisionPolicyEncoded = Omit & { + /** decision_policy is the updated group policy's decision policy. */decisionPolicy?: ThresholdDecisionPolicyProtoMsg | PercentageDecisionPolicyProtoMsg | AnyProtoMsg | undefined; +}; +/** MsgUpdateGroupPolicyDecisionPolicy is the Msg/UpdateGroupPolicyDecisionPolicy request type. */ +export interface MsgUpdateGroupPolicyDecisionPolicyAmino { + /** admin is the account address of the group admin. */ + admin: string; + /** group_policy_address is the account address of group policy. */ + group_policy_address: string; + /** decision_policy is the updated group policy's decision policy. */ + decision_policy?: AnyAmino; +} +export interface MsgUpdateGroupPolicyDecisionPolicyAminoMsg { + type: "cosmos-sdk/MsgUpdateGroupDecisionPolicy"; + value: MsgUpdateGroupPolicyDecisionPolicyAmino; +} +/** MsgUpdateGroupPolicyDecisionPolicyResponse is the Msg/UpdateGroupPolicyDecisionPolicy response type. */ +export interface MsgUpdateGroupPolicyDecisionPolicyResponse {} +export interface MsgUpdateGroupPolicyDecisionPolicyResponseProtoMsg { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicyResponse"; + value: Uint8Array; +} +/** MsgUpdateGroupPolicyDecisionPolicyResponse is the Msg/UpdateGroupPolicyDecisionPolicy response type. */ +export interface MsgUpdateGroupPolicyDecisionPolicyResponseAmino {} +export interface MsgUpdateGroupPolicyDecisionPolicyResponseAminoMsg { + type: "cosmos-sdk/MsgUpdateGroupPolicyDecisionPolicyResponse"; + value: MsgUpdateGroupPolicyDecisionPolicyResponseAmino; +} +/** MsgUpdateGroupPolicyMetadata is the Msg/UpdateGroupPolicyMetadata request type. */ +export interface MsgUpdateGroupPolicyMetadata { + /** admin is the account address of the group admin. */ + admin: string; + /** group_policy_address is the account address of group policy. */ + groupPolicyAddress: string; + /** metadata is the group policy metadata to be updated. */ + metadata: string; +} +export interface MsgUpdateGroupPolicyMetadataProtoMsg { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyMetadata"; + value: Uint8Array; +} +/** MsgUpdateGroupPolicyMetadata is the Msg/UpdateGroupPolicyMetadata request type. */ +export interface MsgUpdateGroupPolicyMetadataAmino { + /** admin is the account address of the group admin. */ + admin: string; + /** group_policy_address is the account address of group policy. */ + group_policy_address: string; + /** metadata is the group policy metadata to be updated. */ + metadata: string; +} +export interface MsgUpdateGroupPolicyMetadataAminoMsg { + type: "cosmos-sdk/MsgUpdateGroupPolicyMetadata"; + value: MsgUpdateGroupPolicyMetadataAmino; +} +/** MsgUpdateGroupPolicyMetadataResponse is the Msg/UpdateGroupPolicyMetadata response type. */ +export interface MsgUpdateGroupPolicyMetadataResponse {} +export interface MsgUpdateGroupPolicyMetadataResponseProtoMsg { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyMetadataResponse"; + value: Uint8Array; +} +/** MsgUpdateGroupPolicyMetadataResponse is the Msg/UpdateGroupPolicyMetadata response type. */ +export interface MsgUpdateGroupPolicyMetadataResponseAmino {} +export interface MsgUpdateGroupPolicyMetadataResponseAminoMsg { + type: "cosmos-sdk/MsgUpdateGroupPolicyMetadataResponse"; + value: MsgUpdateGroupPolicyMetadataResponseAmino; +} +/** MsgSubmitProposal is the Msg/SubmitProposal request type. */ +export interface MsgSubmitProposal { + /** group_policy_address is the account address of group policy. */ + groupPolicyAddress: string; + /** + * proposers are the account addresses of the proposers. + * Proposers signatures will be counted as yes votes. + */ + proposers: string[]; + /** metadata is any arbitrary metadata attached to the proposal. */ + metadata: string; + /** messages is a list of `sdk.Msg`s that will be executed if the proposal passes. */ + messages: Any[]; + /** + * exec defines the mode of execution of the proposal, + * whether it should be executed immediately on creation or not. + * If so, proposers signatures are considered as Yes votes. + */ + exec: Exec; + /** + * title is the title of the proposal. + * + * Since: cosmos-sdk 0.47 + */ + title: string; + /** + * summary is the summary of the proposal. + * + * Since: cosmos-sdk 0.47 + */ + summary: string; +} +export interface MsgSubmitProposalProtoMsg { + typeUrl: "/cosmos.group.v1.MsgSubmitProposal"; + value: Uint8Array; +} +/** MsgSubmitProposal is the Msg/SubmitProposal request type. */ +export interface MsgSubmitProposalAmino { + /** group_policy_address is the account address of group policy. */ + group_policy_address: string; + /** + * proposers are the account addresses of the proposers. + * Proposers signatures will be counted as yes votes. + */ + proposers: string[]; + /** metadata is any arbitrary metadata attached to the proposal. */ + metadata: string; + /** messages is a list of `sdk.Msg`s that will be executed if the proposal passes. */ + messages: AnyAmino[]; + /** + * exec defines the mode of execution of the proposal, + * whether it should be executed immediately on creation or not. + * If so, proposers signatures are considered as Yes votes. + */ + exec: Exec; + /** + * title is the title of the proposal. + * + * Since: cosmos-sdk 0.47 + */ + title: string; + /** + * summary is the summary of the proposal. + * + * Since: cosmos-sdk 0.47 + */ + summary: string; +} +export interface MsgSubmitProposalAminoMsg { + type: "cosmos-sdk/group/MsgSubmitProposal"; + value: MsgSubmitProposalAmino; +} +/** MsgSubmitProposalResponse is the Msg/SubmitProposal response type. */ +export interface MsgSubmitProposalResponse { + /** proposal is the unique ID of the proposal. */ + proposalId: bigint; +} +export interface MsgSubmitProposalResponseProtoMsg { + typeUrl: "/cosmos.group.v1.MsgSubmitProposalResponse"; + value: Uint8Array; +} +/** MsgSubmitProposalResponse is the Msg/SubmitProposal response type. */ +export interface MsgSubmitProposalResponseAmino { + /** proposal is the unique ID of the proposal. */ + proposal_id: string; +} +export interface MsgSubmitProposalResponseAminoMsg { + type: "cosmos-sdk/MsgSubmitProposalResponse"; + value: MsgSubmitProposalResponseAmino; +} +/** MsgWithdrawProposal is the Msg/WithdrawProposal request type. */ +export interface MsgWithdrawProposal { + /** proposal is the unique ID of the proposal. */ + proposalId: bigint; + /** address is the admin of the group policy or one of the proposer of the proposal. */ + address: string; +} +export interface MsgWithdrawProposalProtoMsg { + typeUrl: "/cosmos.group.v1.MsgWithdrawProposal"; + value: Uint8Array; +} +/** MsgWithdrawProposal is the Msg/WithdrawProposal request type. */ +export interface MsgWithdrawProposalAmino { + /** proposal is the unique ID of the proposal. */ + proposal_id: string; + /** address is the admin of the group policy or one of the proposer of the proposal. */ + address: string; +} +export interface MsgWithdrawProposalAminoMsg { + type: "cosmos-sdk/group/MsgWithdrawProposal"; + value: MsgWithdrawProposalAmino; +} +/** MsgWithdrawProposalResponse is the Msg/WithdrawProposal response type. */ +export interface MsgWithdrawProposalResponse {} +export interface MsgWithdrawProposalResponseProtoMsg { + typeUrl: "/cosmos.group.v1.MsgWithdrawProposalResponse"; + value: Uint8Array; +} +/** MsgWithdrawProposalResponse is the Msg/WithdrawProposal response type. */ +export interface MsgWithdrawProposalResponseAmino {} +export interface MsgWithdrawProposalResponseAminoMsg { + type: "cosmos-sdk/MsgWithdrawProposalResponse"; + value: MsgWithdrawProposalResponseAmino; +} +/** MsgVote is the Msg/Vote request type. */ +export interface MsgVote { + /** proposal is the unique ID of the proposal. */ + proposalId: bigint; + /** voter is the voter account address. */ + voter: string; + /** option is the voter's choice on the proposal. */ + option: VoteOption; + /** metadata is any arbitrary metadata attached to the vote. */ + metadata: string; + /** + * exec defines whether the proposal should be executed + * immediately after voting or not. + */ + exec: Exec; +} +export interface MsgVoteProtoMsg { + typeUrl: "/cosmos.group.v1.MsgVote"; + value: Uint8Array; +} +/** MsgVote is the Msg/Vote request type. */ +export interface MsgVoteAmino { + /** proposal is the unique ID of the proposal. */ + proposal_id: string; + /** voter is the voter account address. */ + voter: string; + /** option is the voter's choice on the proposal. */ + option: VoteOption; + /** metadata is any arbitrary metadata attached to the vote. */ + metadata: string; + /** + * exec defines whether the proposal should be executed + * immediately after voting or not. + */ + exec: Exec; +} +export interface MsgVoteAminoMsg { + type: "cosmos-sdk/group/MsgVote"; + value: MsgVoteAmino; +} +/** MsgVoteResponse is the Msg/Vote response type. */ +export interface MsgVoteResponse {} +export interface MsgVoteResponseProtoMsg { + typeUrl: "/cosmos.group.v1.MsgVoteResponse"; + value: Uint8Array; +} +/** MsgVoteResponse is the Msg/Vote response type. */ +export interface MsgVoteResponseAmino {} +export interface MsgVoteResponseAminoMsg { + type: "cosmos-sdk/MsgVoteResponse"; + value: MsgVoteResponseAmino; +} +/** MsgExec is the Msg/Exec request type. */ +export interface MsgExec { + /** proposal is the unique ID of the proposal. */ + proposalId: bigint; + /** executor is the account address used to execute the proposal. */ + executor: string; +} +export interface MsgExecProtoMsg { + typeUrl: "/cosmos.group.v1.MsgExec"; + value: Uint8Array; +} +/** MsgExec is the Msg/Exec request type. */ +export interface MsgExecAmino { + /** proposal is the unique ID of the proposal. */ + proposal_id: string; + /** executor is the account address used to execute the proposal. */ + executor: string; +} +export interface MsgExecAminoMsg { + type: "cosmos-sdk/group/MsgExec"; + value: MsgExecAmino; +} +/** MsgExecResponse is the Msg/Exec request type. */ +export interface MsgExecResponse { + /** result is the final result of the proposal execution. */ + result: ProposalExecutorResult; +} +export interface MsgExecResponseProtoMsg { + typeUrl: "/cosmos.group.v1.MsgExecResponse"; + value: Uint8Array; +} +/** MsgExecResponse is the Msg/Exec request type. */ +export interface MsgExecResponseAmino { + /** result is the final result of the proposal execution. */ + result: ProposalExecutorResult; +} +export interface MsgExecResponseAminoMsg { + type: "cosmos-sdk/MsgExecResponse"; + value: MsgExecResponseAmino; +} +/** MsgLeaveGroup is the Msg/LeaveGroup request type. */ +export interface MsgLeaveGroup { + /** address is the account address of the group member. */ + address: string; + /** group_id is the unique ID of the group. */ + groupId: bigint; +} +export interface MsgLeaveGroupProtoMsg { + typeUrl: "/cosmos.group.v1.MsgLeaveGroup"; + value: Uint8Array; +} +/** MsgLeaveGroup is the Msg/LeaveGroup request type. */ +export interface MsgLeaveGroupAmino { + /** address is the account address of the group member. */ + address: string; + /** group_id is the unique ID of the group. */ + group_id: string; +} +export interface MsgLeaveGroupAminoMsg { + type: "cosmos-sdk/group/MsgLeaveGroup"; + value: MsgLeaveGroupAmino; +} +/** MsgLeaveGroupResponse is the Msg/LeaveGroup response type. */ +export interface MsgLeaveGroupResponse {} +export interface MsgLeaveGroupResponseProtoMsg { + typeUrl: "/cosmos.group.v1.MsgLeaveGroupResponse"; + value: Uint8Array; +} +/** MsgLeaveGroupResponse is the Msg/LeaveGroup response type. */ +export interface MsgLeaveGroupResponseAmino {} +export interface MsgLeaveGroupResponseAminoMsg { + type: "cosmos-sdk/MsgLeaveGroupResponse"; + value: MsgLeaveGroupResponseAmino; +} +function createBaseMsgCreateGroup(): MsgCreateGroup { + return { + admin: "", + members: [], + metadata: "" + }; +} +export const MsgCreateGroup = { + typeUrl: "/cosmos.group.v1.MsgCreateGroup", + aminoType: "cosmos-sdk/MsgCreateGroup", + is(o: any): o is MsgCreateGroup { + return o && (o.$typeUrl === MsgCreateGroup.typeUrl || typeof o.admin === "string" && Array.isArray(o.members) && (!o.members.length || MemberRequest.is(o.members[0])) && typeof o.metadata === "string"); + }, + isAmino(o: any): o is MsgCreateGroupAmino { + return o && (o.$typeUrl === MsgCreateGroup.typeUrl || typeof o.admin === "string" && Array.isArray(o.members) && (!o.members.length || MemberRequest.isAmino(o.members[0])) && typeof o.metadata === "string"); + }, + encode(message: MsgCreateGroup, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + for (const v of message.members) { + MemberRequest.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroup { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateGroup(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.admin = reader.string(); + break; + case 2: + message.members.push(MemberRequest.decode(reader, reader.uint32())); + break; + case 3: + message.metadata = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgCreateGroup { + const message = createBaseMsgCreateGroup(); + message.admin = object.admin ?? ""; + message.members = object.members?.map(e => MemberRequest.fromPartial(e)) || []; + message.metadata = object.metadata ?? ""; + return message; + }, + fromAmino(object: MsgCreateGroupAmino): MsgCreateGroup { + const message = createBaseMsgCreateGroup(); + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + message.members = object.members?.map(e => MemberRequest.fromAmino(e)) || []; + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + return message; + }, + toAmino(message: MsgCreateGroup): MsgCreateGroupAmino { + const obj: any = {}; + obj.admin = message.admin === "" ? undefined : message.admin; + if (message.members) { + obj.members = message.members.map(e => e ? MemberRequest.toAmino(e) : undefined); + } else { + obj.members = message.members; + } + obj.metadata = message.metadata === "" ? undefined : message.metadata; + return obj; + }, + fromAminoMsg(object: MsgCreateGroupAminoMsg): MsgCreateGroup { + return MsgCreateGroup.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreateGroup): MsgCreateGroupAminoMsg { + return { + type: "cosmos-sdk/MsgCreateGroup", + value: MsgCreateGroup.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreateGroupProtoMsg): MsgCreateGroup { + return MsgCreateGroup.decode(message.value); + }, + toProto(message: MsgCreateGroup): Uint8Array { + return MsgCreateGroup.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateGroup): MsgCreateGroupProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgCreateGroup", + value: MsgCreateGroup.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgCreateGroup.typeUrl, MsgCreateGroup); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgCreateGroup.aminoType, MsgCreateGroup.typeUrl); +function createBaseMsgCreateGroupResponse(): MsgCreateGroupResponse { + return { + groupId: BigInt(0) + }; +} +export const MsgCreateGroupResponse = { + typeUrl: "/cosmos.group.v1.MsgCreateGroupResponse", + aminoType: "cosmos-sdk/MsgCreateGroupResponse", + is(o: any): o is MsgCreateGroupResponse { + return o && (o.$typeUrl === MsgCreateGroupResponse.typeUrl || typeof o.groupId === "bigint"); + }, + isAmino(o: any): o is MsgCreateGroupResponseAmino { + return o && (o.$typeUrl === MsgCreateGroupResponse.typeUrl || typeof o.group_id === "bigint"); + }, + encode(message: MsgCreateGroupResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.groupId !== BigInt(0)) { + writer.uint32(8).uint64(message.groupId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroupResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateGroupResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.groupId = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgCreateGroupResponse { + const message = createBaseMsgCreateGroupResponse(); + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); + return message; + }, + fromAmino(object: MsgCreateGroupResponseAmino): MsgCreateGroupResponse { + const message = createBaseMsgCreateGroupResponse(); + if (object.group_id !== undefined && object.group_id !== null) { + message.groupId = BigInt(object.group_id); + } + return message; + }, + toAmino(message: MsgCreateGroupResponse): MsgCreateGroupResponseAmino { + const obj: any = {}; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: MsgCreateGroupResponseAminoMsg): MsgCreateGroupResponse { + return MsgCreateGroupResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreateGroupResponse): MsgCreateGroupResponseAminoMsg { + return { + type: "cosmos-sdk/MsgCreateGroupResponse", + value: MsgCreateGroupResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreateGroupResponseProtoMsg): MsgCreateGroupResponse { + return MsgCreateGroupResponse.decode(message.value); + }, + toProto(message: MsgCreateGroupResponse): Uint8Array { + return MsgCreateGroupResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateGroupResponse): MsgCreateGroupResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgCreateGroupResponse", + value: MsgCreateGroupResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgCreateGroupResponse.typeUrl, MsgCreateGroupResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgCreateGroupResponse.aminoType, MsgCreateGroupResponse.typeUrl); +function createBaseMsgUpdateGroupMembers(): MsgUpdateGroupMembers { + return { + admin: "", + groupId: BigInt(0), + memberUpdates: [] + }; +} +export const MsgUpdateGroupMembers = { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupMembers", + aminoType: "cosmos-sdk/MsgUpdateGroupMembers", + is(o: any): o is MsgUpdateGroupMembers { + return o && (o.$typeUrl === MsgUpdateGroupMembers.typeUrl || typeof o.admin === "string" && typeof o.groupId === "bigint" && Array.isArray(o.memberUpdates) && (!o.memberUpdates.length || MemberRequest.is(o.memberUpdates[0]))); + }, + isAmino(o: any): o is MsgUpdateGroupMembersAmino { + return o && (o.$typeUrl === MsgUpdateGroupMembers.typeUrl || typeof o.admin === "string" && typeof o.group_id === "bigint" && Array.isArray(o.member_updates) && (!o.member_updates.length || MemberRequest.isAmino(o.member_updates[0]))); + }, + encode(message: MsgUpdateGroupMembers, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupId !== BigInt(0)) { + writer.uint32(16).uint64(message.groupId); + } + for (const v of message.memberUpdates) { + MemberRequest.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupMembers { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupMembers(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.admin = reader.string(); + break; + case 2: + message.groupId = reader.uint64(); + break; + case 3: + message.memberUpdates.push(MemberRequest.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUpdateGroupMembers { + const message = createBaseMsgUpdateGroupMembers(); + message.admin = object.admin ?? ""; + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); + message.memberUpdates = object.memberUpdates?.map(e => MemberRequest.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MsgUpdateGroupMembersAmino): MsgUpdateGroupMembers { + const message = createBaseMsgUpdateGroupMembers(); + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + if (object.group_id !== undefined && object.group_id !== null) { + message.groupId = BigInt(object.group_id); + } + message.memberUpdates = object.member_updates?.map(e => MemberRequest.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgUpdateGroupMembers): MsgUpdateGroupMembersAmino { + const obj: any = {}; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId?.toString() : undefined; + if (message.memberUpdates) { + obj.member_updates = message.memberUpdates.map(e => e ? MemberRequest.toAmino(e) : undefined); + } else { + obj.member_updates = message.memberUpdates; + } + return obj; + }, + fromAminoMsg(object: MsgUpdateGroupMembersAminoMsg): MsgUpdateGroupMembers { + return MsgUpdateGroupMembers.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateGroupMembers): MsgUpdateGroupMembersAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateGroupMembers", + value: MsgUpdateGroupMembers.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateGroupMembersProtoMsg): MsgUpdateGroupMembers { + return MsgUpdateGroupMembers.decode(message.value); + }, + toProto(message: MsgUpdateGroupMembers): Uint8Array { + return MsgUpdateGroupMembers.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateGroupMembers): MsgUpdateGroupMembersProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupMembers", + value: MsgUpdateGroupMembers.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgUpdateGroupMembers.typeUrl, MsgUpdateGroupMembers); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgUpdateGroupMembers.aminoType, MsgUpdateGroupMembers.typeUrl); +function createBaseMsgUpdateGroupMembersResponse(): MsgUpdateGroupMembersResponse { + return {}; +} +export const MsgUpdateGroupMembersResponse = { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupMembersResponse", + aminoType: "cosmos-sdk/MsgUpdateGroupMembersResponse", + is(o: any): o is MsgUpdateGroupMembersResponse { + return o && o.$typeUrl === MsgUpdateGroupMembersResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateGroupMembersResponseAmino { + return o && o.$typeUrl === MsgUpdateGroupMembersResponse.typeUrl; + }, + encode(_: MsgUpdateGroupMembersResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupMembersResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupMembersResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgUpdateGroupMembersResponse { + const message = createBaseMsgUpdateGroupMembersResponse(); + return message; + }, + fromAmino(_: MsgUpdateGroupMembersResponseAmino): MsgUpdateGroupMembersResponse { + const message = createBaseMsgUpdateGroupMembersResponse(); + return message; + }, + toAmino(_: MsgUpdateGroupMembersResponse): MsgUpdateGroupMembersResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateGroupMembersResponseAminoMsg): MsgUpdateGroupMembersResponse { + return MsgUpdateGroupMembersResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateGroupMembersResponse): MsgUpdateGroupMembersResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateGroupMembersResponse", + value: MsgUpdateGroupMembersResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateGroupMembersResponseProtoMsg): MsgUpdateGroupMembersResponse { + return MsgUpdateGroupMembersResponse.decode(message.value); + }, + toProto(message: MsgUpdateGroupMembersResponse): Uint8Array { + return MsgUpdateGroupMembersResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateGroupMembersResponse): MsgUpdateGroupMembersResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupMembersResponse", + value: MsgUpdateGroupMembersResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgUpdateGroupMembersResponse.typeUrl, MsgUpdateGroupMembersResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgUpdateGroupMembersResponse.aminoType, MsgUpdateGroupMembersResponse.typeUrl); +function createBaseMsgUpdateGroupAdmin(): MsgUpdateGroupAdmin { + return { + admin: "", + groupId: BigInt(0), + newAdmin: "" + }; +} +export const MsgUpdateGroupAdmin = { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupAdmin", + aminoType: "cosmos-sdk/MsgUpdateGroupAdmin", + is(o: any): o is MsgUpdateGroupAdmin { + return o && (o.$typeUrl === MsgUpdateGroupAdmin.typeUrl || typeof o.admin === "string" && typeof o.groupId === "bigint" && typeof o.newAdmin === "string"); + }, + isAmino(o: any): o is MsgUpdateGroupAdminAmino { + return o && (o.$typeUrl === MsgUpdateGroupAdmin.typeUrl || typeof o.admin === "string" && typeof o.group_id === "bigint" && typeof o.new_admin === "string"); + }, + encode(message: MsgUpdateGroupAdmin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupId !== BigInt(0)) { + writer.uint32(16).uint64(message.groupId); + } + if (message.newAdmin !== "") { + writer.uint32(26).string(message.newAdmin); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupAdmin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupAdmin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.admin = reader.string(); + break; + case 2: + message.groupId = reader.uint64(); + break; + case 3: + message.newAdmin = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUpdateGroupAdmin { + const message = createBaseMsgUpdateGroupAdmin(); + message.admin = object.admin ?? ""; + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); + message.newAdmin = object.newAdmin ?? ""; + return message; + }, + fromAmino(object: MsgUpdateGroupAdminAmino): MsgUpdateGroupAdmin { + const message = createBaseMsgUpdateGroupAdmin(); + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + if (object.group_id !== undefined && object.group_id !== null) { + message.groupId = BigInt(object.group_id); + } + if (object.new_admin !== undefined && object.new_admin !== null) { + message.newAdmin = object.new_admin; + } + return message; + }, + toAmino(message: MsgUpdateGroupAdmin): MsgUpdateGroupAdminAmino { + const obj: any = {}; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId?.toString() : undefined; + obj.new_admin = message.newAdmin === "" ? undefined : message.newAdmin; + return obj; + }, + fromAminoMsg(object: MsgUpdateGroupAdminAminoMsg): MsgUpdateGroupAdmin { + return MsgUpdateGroupAdmin.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateGroupAdmin): MsgUpdateGroupAdminAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateGroupAdmin", + value: MsgUpdateGroupAdmin.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateGroupAdminProtoMsg): MsgUpdateGroupAdmin { + return MsgUpdateGroupAdmin.decode(message.value); + }, + toProto(message: MsgUpdateGroupAdmin): Uint8Array { + return MsgUpdateGroupAdmin.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateGroupAdmin): MsgUpdateGroupAdminProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupAdmin", + value: MsgUpdateGroupAdmin.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgUpdateGroupAdmin.typeUrl, MsgUpdateGroupAdmin); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgUpdateGroupAdmin.aminoType, MsgUpdateGroupAdmin.typeUrl); +function createBaseMsgUpdateGroupAdminResponse(): MsgUpdateGroupAdminResponse { + return {}; +} +export const MsgUpdateGroupAdminResponse = { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupAdminResponse", + aminoType: "cosmos-sdk/MsgUpdateGroupAdminResponse", + is(o: any): o is MsgUpdateGroupAdminResponse { + return o && o.$typeUrl === MsgUpdateGroupAdminResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateGroupAdminResponseAmino { + return o && o.$typeUrl === MsgUpdateGroupAdminResponse.typeUrl; + }, + encode(_: MsgUpdateGroupAdminResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupAdminResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupAdminResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgUpdateGroupAdminResponse { + const message = createBaseMsgUpdateGroupAdminResponse(); + return message; + }, + fromAmino(_: MsgUpdateGroupAdminResponseAmino): MsgUpdateGroupAdminResponse { + const message = createBaseMsgUpdateGroupAdminResponse(); + return message; + }, + toAmino(_: MsgUpdateGroupAdminResponse): MsgUpdateGroupAdminResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateGroupAdminResponseAminoMsg): MsgUpdateGroupAdminResponse { + return MsgUpdateGroupAdminResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateGroupAdminResponse): MsgUpdateGroupAdminResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateGroupAdminResponse", + value: MsgUpdateGroupAdminResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateGroupAdminResponseProtoMsg): MsgUpdateGroupAdminResponse { + return MsgUpdateGroupAdminResponse.decode(message.value); + }, + toProto(message: MsgUpdateGroupAdminResponse): Uint8Array { + return MsgUpdateGroupAdminResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateGroupAdminResponse): MsgUpdateGroupAdminResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupAdminResponse", + value: MsgUpdateGroupAdminResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgUpdateGroupAdminResponse.typeUrl, MsgUpdateGroupAdminResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgUpdateGroupAdminResponse.aminoType, MsgUpdateGroupAdminResponse.typeUrl); +function createBaseMsgUpdateGroupMetadata(): MsgUpdateGroupMetadata { + return { + admin: "", + groupId: BigInt(0), + metadata: "" + }; +} +export const MsgUpdateGroupMetadata = { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupMetadata", + aminoType: "cosmos-sdk/MsgUpdateGroupMetadata", + is(o: any): o is MsgUpdateGroupMetadata { + return o && (o.$typeUrl === MsgUpdateGroupMetadata.typeUrl || typeof o.admin === "string" && typeof o.groupId === "bigint" && typeof o.metadata === "string"); + }, + isAmino(o: any): o is MsgUpdateGroupMetadataAmino { + return o && (o.$typeUrl === MsgUpdateGroupMetadata.typeUrl || typeof o.admin === "string" && typeof o.group_id === "bigint" && typeof o.metadata === "string"); + }, + encode(message: MsgUpdateGroupMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupId !== BigInt(0)) { + writer.uint32(16).uint64(message.groupId); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupMetadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.admin = reader.string(); + break; + case 2: + message.groupId = reader.uint64(); + break; + case 3: + message.metadata = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUpdateGroupMetadata { + const message = createBaseMsgUpdateGroupMetadata(); + message.admin = object.admin ?? ""; + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); + message.metadata = object.metadata ?? ""; + return message; + }, + fromAmino(object: MsgUpdateGroupMetadataAmino): MsgUpdateGroupMetadata { + const message = createBaseMsgUpdateGroupMetadata(); + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + if (object.group_id !== undefined && object.group_id !== null) { + message.groupId = BigInt(object.group_id); + } + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + return message; + }, + toAmino(message: MsgUpdateGroupMetadata): MsgUpdateGroupMetadataAmino { + const obj: any = {}; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId?.toString() : undefined; + obj.metadata = message.metadata === "" ? undefined : message.metadata; + return obj; + }, + fromAminoMsg(object: MsgUpdateGroupMetadataAminoMsg): MsgUpdateGroupMetadata { + return MsgUpdateGroupMetadata.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateGroupMetadata): MsgUpdateGroupMetadataAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateGroupMetadata", + value: MsgUpdateGroupMetadata.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateGroupMetadataProtoMsg): MsgUpdateGroupMetadata { + return MsgUpdateGroupMetadata.decode(message.value); + }, + toProto(message: MsgUpdateGroupMetadata): Uint8Array { + return MsgUpdateGroupMetadata.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateGroupMetadata): MsgUpdateGroupMetadataProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupMetadata", + value: MsgUpdateGroupMetadata.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgUpdateGroupMetadata.typeUrl, MsgUpdateGroupMetadata); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgUpdateGroupMetadata.aminoType, MsgUpdateGroupMetadata.typeUrl); +function createBaseMsgUpdateGroupMetadataResponse(): MsgUpdateGroupMetadataResponse { + return {}; +} +export const MsgUpdateGroupMetadataResponse = { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupMetadataResponse", + aminoType: "cosmos-sdk/MsgUpdateGroupMetadataResponse", + is(o: any): o is MsgUpdateGroupMetadataResponse { + return o && o.$typeUrl === MsgUpdateGroupMetadataResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateGroupMetadataResponseAmino { + return o && o.$typeUrl === MsgUpdateGroupMetadataResponse.typeUrl; + }, + encode(_: MsgUpdateGroupMetadataResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupMetadataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupMetadataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgUpdateGroupMetadataResponse { + const message = createBaseMsgUpdateGroupMetadataResponse(); + return message; + }, + fromAmino(_: MsgUpdateGroupMetadataResponseAmino): MsgUpdateGroupMetadataResponse { + const message = createBaseMsgUpdateGroupMetadataResponse(); + return message; + }, + toAmino(_: MsgUpdateGroupMetadataResponse): MsgUpdateGroupMetadataResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateGroupMetadataResponseAminoMsg): MsgUpdateGroupMetadataResponse { + return MsgUpdateGroupMetadataResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateGroupMetadataResponse): MsgUpdateGroupMetadataResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateGroupMetadataResponse", + value: MsgUpdateGroupMetadataResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateGroupMetadataResponseProtoMsg): MsgUpdateGroupMetadataResponse { + return MsgUpdateGroupMetadataResponse.decode(message.value); + }, + toProto(message: MsgUpdateGroupMetadataResponse): Uint8Array { + return MsgUpdateGroupMetadataResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateGroupMetadataResponse): MsgUpdateGroupMetadataResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupMetadataResponse", + value: MsgUpdateGroupMetadataResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgUpdateGroupMetadataResponse.typeUrl, MsgUpdateGroupMetadataResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgUpdateGroupMetadataResponse.aminoType, MsgUpdateGroupMetadataResponse.typeUrl); +function createBaseMsgCreateGroupPolicy(): MsgCreateGroupPolicy { + return { + admin: "", + groupId: BigInt(0), + metadata: "", + decisionPolicy: undefined + }; +} +export const MsgCreateGroupPolicy = { + typeUrl: "/cosmos.group.v1.MsgCreateGroupPolicy", + aminoType: "cosmos-sdk/MsgCreateGroupPolicy", + is(o: any): o is MsgCreateGroupPolicy { + return o && (o.$typeUrl === MsgCreateGroupPolicy.typeUrl || typeof o.admin === "string" && typeof o.groupId === "bigint" && typeof o.metadata === "string"); + }, + isAmino(o: any): o is MsgCreateGroupPolicyAmino { + return o && (o.$typeUrl === MsgCreateGroupPolicy.typeUrl || typeof o.admin === "string" && typeof o.group_id === "bigint" && typeof o.metadata === "string"); + }, + encode(message: MsgCreateGroupPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupId !== BigInt(0)) { + writer.uint32(16).uint64(message.groupId); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + if (message.decisionPolicy !== undefined) { + Any.encode(GlobalDecoderRegistry.wrapAny(message.decisionPolicy), writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroupPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateGroupPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.admin = reader.string(); + break; + case 2: + message.groupId = reader.uint64(); + break; + case 3: + message.metadata = reader.string(); + break; + case 4: + message.decisionPolicy = GlobalDecoderRegistry.unwrapAny(reader); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgCreateGroupPolicy { + const message = createBaseMsgCreateGroupPolicy(); + message.admin = object.admin ?? ""; + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); + message.metadata = object.metadata ?? ""; + message.decisionPolicy = object.decisionPolicy !== undefined && object.decisionPolicy !== null ? GlobalDecoderRegistry.fromPartial(object.decisionPolicy) : undefined; + return message; + }, + fromAmino(object: MsgCreateGroupPolicyAmino): MsgCreateGroupPolicy { + const message = createBaseMsgCreateGroupPolicy(); + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + if (object.group_id !== undefined && object.group_id !== null) { + message.groupId = BigInt(object.group_id); + } + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + if (object.decision_policy !== undefined && object.decision_policy !== null) { + message.decisionPolicy = GlobalDecoderRegistry.fromAminoMsg(object.decision_policy); + } + return message; + }, + toAmino(message: MsgCreateGroupPolicy): MsgCreateGroupPolicyAmino { + const obj: any = {}; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId?.toString() : undefined; + obj.metadata = message.metadata === "" ? undefined : message.metadata; + obj.decision_policy = message.decisionPolicy ? GlobalDecoderRegistry.toAminoMsg(message.decisionPolicy) : undefined; + return obj; + }, + fromAminoMsg(object: MsgCreateGroupPolicyAminoMsg): MsgCreateGroupPolicy { + return MsgCreateGroupPolicy.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreateGroupPolicy): MsgCreateGroupPolicyAminoMsg { + return { + type: "cosmos-sdk/MsgCreateGroupPolicy", + value: MsgCreateGroupPolicy.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreateGroupPolicyProtoMsg): MsgCreateGroupPolicy { + return MsgCreateGroupPolicy.decode(message.value); + }, + toProto(message: MsgCreateGroupPolicy): Uint8Array { + return MsgCreateGroupPolicy.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateGroupPolicy): MsgCreateGroupPolicyProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgCreateGroupPolicy", + value: MsgCreateGroupPolicy.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgCreateGroupPolicy.typeUrl, MsgCreateGroupPolicy); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgCreateGroupPolicy.aminoType, MsgCreateGroupPolicy.typeUrl); +function createBaseMsgCreateGroupPolicyResponse(): MsgCreateGroupPolicyResponse { + return { + address: "" + }; +} +export const MsgCreateGroupPolicyResponse = { + typeUrl: "/cosmos.group.v1.MsgCreateGroupPolicyResponse", + aminoType: "cosmos-sdk/MsgCreateGroupPolicyResponse", + is(o: any): o is MsgCreateGroupPolicyResponse { + return o && (o.$typeUrl === MsgCreateGroupPolicyResponse.typeUrl || typeof o.address === "string"); + }, + isAmino(o: any): o is MsgCreateGroupPolicyResponseAmino { + return o && (o.$typeUrl === MsgCreateGroupPolicyResponse.typeUrl || typeof o.address === "string"); + }, + encode(message: MsgCreateGroupPolicyResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroupPolicyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateGroupPolicyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgCreateGroupPolicyResponse { + const message = createBaseMsgCreateGroupPolicyResponse(); + message.address = object.address ?? ""; + return message; + }, + fromAmino(object: MsgCreateGroupPolicyResponseAmino): MsgCreateGroupPolicyResponse { + const message = createBaseMsgCreateGroupPolicyResponse(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + return message; + }, + toAmino(message: MsgCreateGroupPolicyResponse): MsgCreateGroupPolicyResponseAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + return obj; + }, + fromAminoMsg(object: MsgCreateGroupPolicyResponseAminoMsg): MsgCreateGroupPolicyResponse { + return MsgCreateGroupPolicyResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreateGroupPolicyResponse): MsgCreateGroupPolicyResponseAminoMsg { + return { + type: "cosmos-sdk/MsgCreateGroupPolicyResponse", + value: MsgCreateGroupPolicyResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreateGroupPolicyResponseProtoMsg): MsgCreateGroupPolicyResponse { + return MsgCreateGroupPolicyResponse.decode(message.value); + }, + toProto(message: MsgCreateGroupPolicyResponse): Uint8Array { + return MsgCreateGroupPolicyResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateGroupPolicyResponse): MsgCreateGroupPolicyResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgCreateGroupPolicyResponse", + value: MsgCreateGroupPolicyResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgCreateGroupPolicyResponse.typeUrl, MsgCreateGroupPolicyResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgCreateGroupPolicyResponse.aminoType, MsgCreateGroupPolicyResponse.typeUrl); +function createBaseMsgUpdateGroupPolicyAdmin(): MsgUpdateGroupPolicyAdmin { + return { + admin: "", + groupPolicyAddress: "", + newAdmin: "" + }; +} +export const MsgUpdateGroupPolicyAdmin = { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyAdmin", + aminoType: "cosmos-sdk/MsgUpdateGroupPolicyAdmin", + is(o: any): o is MsgUpdateGroupPolicyAdmin { + return o && (o.$typeUrl === MsgUpdateGroupPolicyAdmin.typeUrl || typeof o.admin === "string" && typeof o.groupPolicyAddress === "string" && typeof o.newAdmin === "string"); + }, + isAmino(o: any): o is MsgUpdateGroupPolicyAdminAmino { + return o && (o.$typeUrl === MsgUpdateGroupPolicyAdmin.typeUrl || typeof o.admin === "string" && typeof o.group_policy_address === "string" && typeof o.new_admin === "string"); + }, + encode(message: MsgUpdateGroupPolicyAdmin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupPolicyAddress !== "") { + writer.uint32(18).string(message.groupPolicyAddress); + } + if (message.newAdmin !== "") { + writer.uint32(26).string(message.newAdmin); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyAdmin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupPolicyAdmin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.admin = reader.string(); + break; + case 2: + message.groupPolicyAddress = reader.string(); + break; + case 3: + message.newAdmin = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUpdateGroupPolicyAdmin { + const message = createBaseMsgUpdateGroupPolicyAdmin(); + message.admin = object.admin ?? ""; + message.groupPolicyAddress = object.groupPolicyAddress ?? ""; + message.newAdmin = object.newAdmin ?? ""; + return message; + }, + fromAmino(object: MsgUpdateGroupPolicyAdminAmino): MsgUpdateGroupPolicyAdmin { + const message = createBaseMsgUpdateGroupPolicyAdmin(); + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + if (object.group_policy_address !== undefined && object.group_policy_address !== null) { + message.groupPolicyAddress = object.group_policy_address; + } + if (object.new_admin !== undefined && object.new_admin !== null) { + message.newAdmin = object.new_admin; + } + return message; + }, + toAmino(message: MsgUpdateGroupPolicyAdmin): MsgUpdateGroupPolicyAdminAmino { + const obj: any = {}; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.group_policy_address = message.groupPolicyAddress === "" ? undefined : message.groupPolicyAddress; + obj.new_admin = message.newAdmin === "" ? undefined : message.newAdmin; + return obj; + }, + fromAminoMsg(object: MsgUpdateGroupPolicyAdminAminoMsg): MsgUpdateGroupPolicyAdmin { + return MsgUpdateGroupPolicyAdmin.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateGroupPolicyAdmin): MsgUpdateGroupPolicyAdminAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateGroupPolicyAdmin", + value: MsgUpdateGroupPolicyAdmin.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateGroupPolicyAdminProtoMsg): MsgUpdateGroupPolicyAdmin { + return MsgUpdateGroupPolicyAdmin.decode(message.value); + }, + toProto(message: MsgUpdateGroupPolicyAdmin): Uint8Array { + return MsgUpdateGroupPolicyAdmin.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateGroupPolicyAdmin): MsgUpdateGroupPolicyAdminProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyAdmin", + value: MsgUpdateGroupPolicyAdmin.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgUpdateGroupPolicyAdmin.typeUrl, MsgUpdateGroupPolicyAdmin); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgUpdateGroupPolicyAdmin.aminoType, MsgUpdateGroupPolicyAdmin.typeUrl); +function createBaseMsgUpdateGroupPolicyAdminResponse(): MsgUpdateGroupPolicyAdminResponse { + return {}; +} +export const MsgUpdateGroupPolicyAdminResponse = { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyAdminResponse", + aminoType: "cosmos-sdk/MsgUpdateGroupPolicyAdminResponse", + is(o: any): o is MsgUpdateGroupPolicyAdminResponse { + return o && o.$typeUrl === MsgUpdateGroupPolicyAdminResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateGroupPolicyAdminResponseAmino { + return o && o.$typeUrl === MsgUpdateGroupPolicyAdminResponse.typeUrl; + }, + encode(_: MsgUpdateGroupPolicyAdminResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyAdminResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupPolicyAdminResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgUpdateGroupPolicyAdminResponse { + const message = createBaseMsgUpdateGroupPolicyAdminResponse(); + return message; + }, + fromAmino(_: MsgUpdateGroupPolicyAdminResponseAmino): MsgUpdateGroupPolicyAdminResponse { + const message = createBaseMsgUpdateGroupPolicyAdminResponse(); + return message; + }, + toAmino(_: MsgUpdateGroupPolicyAdminResponse): MsgUpdateGroupPolicyAdminResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateGroupPolicyAdminResponseAminoMsg): MsgUpdateGroupPolicyAdminResponse { + return MsgUpdateGroupPolicyAdminResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateGroupPolicyAdminResponse): MsgUpdateGroupPolicyAdminResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateGroupPolicyAdminResponse", + value: MsgUpdateGroupPolicyAdminResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateGroupPolicyAdminResponseProtoMsg): MsgUpdateGroupPolicyAdminResponse { + return MsgUpdateGroupPolicyAdminResponse.decode(message.value); + }, + toProto(message: MsgUpdateGroupPolicyAdminResponse): Uint8Array { + return MsgUpdateGroupPolicyAdminResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateGroupPolicyAdminResponse): MsgUpdateGroupPolicyAdminResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyAdminResponse", + value: MsgUpdateGroupPolicyAdminResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgUpdateGroupPolicyAdminResponse.typeUrl, MsgUpdateGroupPolicyAdminResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgUpdateGroupPolicyAdminResponse.aminoType, MsgUpdateGroupPolicyAdminResponse.typeUrl); +function createBaseMsgCreateGroupWithPolicy(): MsgCreateGroupWithPolicy { + return { + admin: "", + members: [], + groupMetadata: "", + groupPolicyMetadata: "", + groupPolicyAsAdmin: false, + decisionPolicy: undefined + }; +} +export const MsgCreateGroupWithPolicy = { + typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicy", + aminoType: "cosmos-sdk/MsgCreateGroupWithPolicy", + is(o: any): o is MsgCreateGroupWithPolicy { + return o && (o.$typeUrl === MsgCreateGroupWithPolicy.typeUrl || typeof o.admin === "string" && Array.isArray(o.members) && (!o.members.length || MemberRequest.is(o.members[0])) && typeof o.groupMetadata === "string" && typeof o.groupPolicyMetadata === "string" && typeof o.groupPolicyAsAdmin === "boolean"); + }, + isAmino(o: any): o is MsgCreateGroupWithPolicyAmino { + return o && (o.$typeUrl === MsgCreateGroupWithPolicy.typeUrl || typeof o.admin === "string" && Array.isArray(o.members) && (!o.members.length || MemberRequest.isAmino(o.members[0])) && typeof o.group_metadata === "string" && typeof o.group_policy_metadata === "string" && typeof o.group_policy_as_admin === "boolean"); + }, + encode(message: MsgCreateGroupWithPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + for (const v of message.members) { + MemberRequest.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.groupMetadata !== "") { + writer.uint32(26).string(message.groupMetadata); + } + if (message.groupPolicyMetadata !== "") { + writer.uint32(34).string(message.groupPolicyMetadata); + } + if (message.groupPolicyAsAdmin === true) { + writer.uint32(40).bool(message.groupPolicyAsAdmin); + } + if (message.decisionPolicy !== undefined) { + Any.encode(GlobalDecoderRegistry.wrapAny(message.decisionPolicy), writer.uint32(50).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroupWithPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateGroupWithPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.admin = reader.string(); + break; + case 2: + message.members.push(MemberRequest.decode(reader, reader.uint32())); + break; + case 3: + message.groupMetadata = reader.string(); + break; + case 4: + message.groupPolicyMetadata = reader.string(); + break; + case 5: + message.groupPolicyAsAdmin = reader.bool(); + break; + case 6: + message.decisionPolicy = GlobalDecoderRegistry.unwrapAny(reader); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgCreateGroupWithPolicy { + const message = createBaseMsgCreateGroupWithPolicy(); + message.admin = object.admin ?? ""; + message.members = object.members?.map(e => MemberRequest.fromPartial(e)) || []; + message.groupMetadata = object.groupMetadata ?? ""; + message.groupPolicyMetadata = object.groupPolicyMetadata ?? ""; + message.groupPolicyAsAdmin = object.groupPolicyAsAdmin ?? false; + message.decisionPolicy = object.decisionPolicy !== undefined && object.decisionPolicy !== null ? GlobalDecoderRegistry.fromPartial(object.decisionPolicy) : undefined; + return message; + }, + fromAmino(object: MsgCreateGroupWithPolicyAmino): MsgCreateGroupWithPolicy { + const message = createBaseMsgCreateGroupWithPolicy(); + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + message.members = object.members?.map(e => MemberRequest.fromAmino(e)) || []; + if (object.group_metadata !== undefined && object.group_metadata !== null) { + message.groupMetadata = object.group_metadata; + } + if (object.group_policy_metadata !== undefined && object.group_policy_metadata !== null) { + message.groupPolicyMetadata = object.group_policy_metadata; + } + if (object.group_policy_as_admin !== undefined && object.group_policy_as_admin !== null) { + message.groupPolicyAsAdmin = object.group_policy_as_admin; + } + if (object.decision_policy !== undefined && object.decision_policy !== null) { + message.decisionPolicy = GlobalDecoderRegistry.fromAminoMsg(object.decision_policy); + } + return message; + }, + toAmino(message: MsgCreateGroupWithPolicy): MsgCreateGroupWithPolicyAmino { + const obj: any = {}; + obj.admin = message.admin === "" ? undefined : message.admin; + if (message.members) { + obj.members = message.members.map(e => e ? MemberRequest.toAmino(e) : undefined); + } else { + obj.members = message.members; + } + obj.group_metadata = message.groupMetadata === "" ? undefined : message.groupMetadata; + obj.group_policy_metadata = message.groupPolicyMetadata === "" ? undefined : message.groupPolicyMetadata; + obj.group_policy_as_admin = message.groupPolicyAsAdmin === false ? undefined : message.groupPolicyAsAdmin; + obj.decision_policy = message.decisionPolicy ? GlobalDecoderRegistry.toAminoMsg(message.decisionPolicy) : undefined; + return obj; + }, + fromAminoMsg(object: MsgCreateGroupWithPolicyAminoMsg): MsgCreateGroupWithPolicy { + return MsgCreateGroupWithPolicy.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreateGroupWithPolicy): MsgCreateGroupWithPolicyAminoMsg { + return { + type: "cosmos-sdk/MsgCreateGroupWithPolicy", + value: MsgCreateGroupWithPolicy.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreateGroupWithPolicyProtoMsg): MsgCreateGroupWithPolicy { + return MsgCreateGroupWithPolicy.decode(message.value); + }, + toProto(message: MsgCreateGroupWithPolicy): Uint8Array { + return MsgCreateGroupWithPolicy.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateGroupWithPolicy): MsgCreateGroupWithPolicyProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicy", + value: MsgCreateGroupWithPolicy.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgCreateGroupWithPolicy.typeUrl, MsgCreateGroupWithPolicy); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgCreateGroupWithPolicy.aminoType, MsgCreateGroupWithPolicy.typeUrl); +function createBaseMsgCreateGroupWithPolicyResponse(): MsgCreateGroupWithPolicyResponse { + return { + groupId: BigInt(0), + groupPolicyAddress: "" + }; +} +export const MsgCreateGroupWithPolicyResponse = { + typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicyResponse", + aminoType: "cosmos-sdk/MsgCreateGroupWithPolicyResponse", + is(o: any): o is MsgCreateGroupWithPolicyResponse { + return o && (o.$typeUrl === MsgCreateGroupWithPolicyResponse.typeUrl || typeof o.groupId === "bigint" && typeof o.groupPolicyAddress === "string"); + }, + isAmino(o: any): o is MsgCreateGroupWithPolicyResponseAmino { + return o && (o.$typeUrl === MsgCreateGroupWithPolicyResponse.typeUrl || typeof o.group_id === "bigint" && typeof o.group_policy_address === "string"); + }, + encode(message: MsgCreateGroupWithPolicyResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.groupId !== BigInt(0)) { + writer.uint32(8).uint64(message.groupId); + } + if (message.groupPolicyAddress !== "") { + writer.uint32(18).string(message.groupPolicyAddress); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateGroupWithPolicyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateGroupWithPolicyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.groupId = reader.uint64(); + break; + case 2: + message.groupPolicyAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgCreateGroupWithPolicyResponse { + const message = createBaseMsgCreateGroupWithPolicyResponse(); + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); + message.groupPolicyAddress = object.groupPolicyAddress ?? ""; + return message; + }, + fromAmino(object: MsgCreateGroupWithPolicyResponseAmino): MsgCreateGroupWithPolicyResponse { + const message = createBaseMsgCreateGroupWithPolicyResponse(); + if (object.group_id !== undefined && object.group_id !== null) { + message.groupId = BigInt(object.group_id); + } + if (object.group_policy_address !== undefined && object.group_policy_address !== null) { + message.groupPolicyAddress = object.group_policy_address; + } + return message; + }, + toAmino(message: MsgCreateGroupWithPolicyResponse): MsgCreateGroupWithPolicyResponseAmino { + const obj: any = {}; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId?.toString() : undefined; + obj.group_policy_address = message.groupPolicyAddress === "" ? undefined : message.groupPolicyAddress; + return obj; + }, + fromAminoMsg(object: MsgCreateGroupWithPolicyResponseAminoMsg): MsgCreateGroupWithPolicyResponse { + return MsgCreateGroupWithPolicyResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreateGroupWithPolicyResponse): MsgCreateGroupWithPolicyResponseAminoMsg { + return { + type: "cosmos-sdk/MsgCreateGroupWithPolicyResponse", + value: MsgCreateGroupWithPolicyResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreateGroupWithPolicyResponseProtoMsg): MsgCreateGroupWithPolicyResponse { + return MsgCreateGroupWithPolicyResponse.decode(message.value); + }, + toProto(message: MsgCreateGroupWithPolicyResponse): Uint8Array { + return MsgCreateGroupWithPolicyResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateGroupWithPolicyResponse): MsgCreateGroupWithPolicyResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgCreateGroupWithPolicyResponse", + value: MsgCreateGroupWithPolicyResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgCreateGroupWithPolicyResponse.typeUrl, MsgCreateGroupWithPolicyResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgCreateGroupWithPolicyResponse.aminoType, MsgCreateGroupWithPolicyResponse.typeUrl); +function createBaseMsgUpdateGroupPolicyDecisionPolicy(): MsgUpdateGroupPolicyDecisionPolicy { + return { + admin: "", + groupPolicyAddress: "", + decisionPolicy: undefined + }; +} +export const MsgUpdateGroupPolicyDecisionPolicy = { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy", + aminoType: "cosmos-sdk/MsgUpdateGroupDecisionPolicy", + is(o: any): o is MsgUpdateGroupPolicyDecisionPolicy { + return o && (o.$typeUrl === MsgUpdateGroupPolicyDecisionPolicy.typeUrl || typeof o.admin === "string" && typeof o.groupPolicyAddress === "string"); + }, + isAmino(o: any): o is MsgUpdateGroupPolicyDecisionPolicyAmino { + return o && (o.$typeUrl === MsgUpdateGroupPolicyDecisionPolicy.typeUrl || typeof o.admin === "string" && typeof o.group_policy_address === "string"); + }, + encode(message: MsgUpdateGroupPolicyDecisionPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupPolicyAddress !== "") { + writer.uint32(18).string(message.groupPolicyAddress); + } + if (message.decisionPolicy !== undefined) { + Any.encode(GlobalDecoderRegistry.wrapAny(message.decisionPolicy), writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyDecisionPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupPolicyDecisionPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.admin = reader.string(); + break; + case 2: + message.groupPolicyAddress = reader.string(); + break; + case 3: + message.decisionPolicy = GlobalDecoderRegistry.unwrapAny(reader); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUpdateGroupPolicyDecisionPolicy { + const message = createBaseMsgUpdateGroupPolicyDecisionPolicy(); + message.admin = object.admin ?? ""; + message.groupPolicyAddress = object.groupPolicyAddress ?? ""; + message.decisionPolicy = object.decisionPolicy !== undefined && object.decisionPolicy !== null ? GlobalDecoderRegistry.fromPartial(object.decisionPolicy) : undefined; + return message; + }, + fromAmino(object: MsgUpdateGroupPolicyDecisionPolicyAmino): MsgUpdateGroupPolicyDecisionPolicy { + const message = createBaseMsgUpdateGroupPolicyDecisionPolicy(); + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + if (object.group_policy_address !== undefined && object.group_policy_address !== null) { + message.groupPolicyAddress = object.group_policy_address; + } + if (object.decision_policy !== undefined && object.decision_policy !== null) { + message.decisionPolicy = GlobalDecoderRegistry.fromAminoMsg(object.decision_policy); + } + return message; + }, + toAmino(message: MsgUpdateGroupPolicyDecisionPolicy): MsgUpdateGroupPolicyDecisionPolicyAmino { + const obj: any = {}; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.group_policy_address = message.groupPolicyAddress === "" ? undefined : message.groupPolicyAddress; + obj.decision_policy = message.decisionPolicy ? GlobalDecoderRegistry.toAminoMsg(message.decisionPolicy) : undefined; + return obj; + }, + fromAminoMsg(object: MsgUpdateGroupPolicyDecisionPolicyAminoMsg): MsgUpdateGroupPolicyDecisionPolicy { + return MsgUpdateGroupPolicyDecisionPolicy.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateGroupPolicyDecisionPolicy): MsgUpdateGroupPolicyDecisionPolicyAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateGroupDecisionPolicy", + value: MsgUpdateGroupPolicyDecisionPolicy.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateGroupPolicyDecisionPolicyProtoMsg): MsgUpdateGroupPolicyDecisionPolicy { + return MsgUpdateGroupPolicyDecisionPolicy.decode(message.value); + }, + toProto(message: MsgUpdateGroupPolicyDecisionPolicy): Uint8Array { + return MsgUpdateGroupPolicyDecisionPolicy.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateGroupPolicyDecisionPolicy): MsgUpdateGroupPolicyDecisionPolicyProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy", + value: MsgUpdateGroupPolicyDecisionPolicy.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgUpdateGroupPolicyDecisionPolicy.typeUrl, MsgUpdateGroupPolicyDecisionPolicy); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgUpdateGroupPolicyDecisionPolicy.aminoType, MsgUpdateGroupPolicyDecisionPolicy.typeUrl); +function createBaseMsgUpdateGroupPolicyDecisionPolicyResponse(): MsgUpdateGroupPolicyDecisionPolicyResponse { + return {}; +} +export const MsgUpdateGroupPolicyDecisionPolicyResponse = { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicyResponse", + aminoType: "cosmos-sdk/MsgUpdateGroupPolicyDecisionPolicyResponse", + is(o: any): o is MsgUpdateGroupPolicyDecisionPolicyResponse { + return o && o.$typeUrl === MsgUpdateGroupPolicyDecisionPolicyResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateGroupPolicyDecisionPolicyResponseAmino { + return o && o.$typeUrl === MsgUpdateGroupPolicyDecisionPolicyResponse.typeUrl; + }, + encode(_: MsgUpdateGroupPolicyDecisionPolicyResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyDecisionPolicyResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupPolicyDecisionPolicyResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgUpdateGroupPolicyDecisionPolicyResponse { + const message = createBaseMsgUpdateGroupPolicyDecisionPolicyResponse(); + return message; + }, + fromAmino(_: MsgUpdateGroupPolicyDecisionPolicyResponseAmino): MsgUpdateGroupPolicyDecisionPolicyResponse { + const message = createBaseMsgUpdateGroupPolicyDecisionPolicyResponse(); + return message; + }, + toAmino(_: MsgUpdateGroupPolicyDecisionPolicyResponse): MsgUpdateGroupPolicyDecisionPolicyResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateGroupPolicyDecisionPolicyResponseAminoMsg): MsgUpdateGroupPolicyDecisionPolicyResponse { + return MsgUpdateGroupPolicyDecisionPolicyResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateGroupPolicyDecisionPolicyResponse): MsgUpdateGroupPolicyDecisionPolicyResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateGroupPolicyDecisionPolicyResponse", + value: MsgUpdateGroupPolicyDecisionPolicyResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateGroupPolicyDecisionPolicyResponseProtoMsg): MsgUpdateGroupPolicyDecisionPolicyResponse { + return MsgUpdateGroupPolicyDecisionPolicyResponse.decode(message.value); + }, + toProto(message: MsgUpdateGroupPolicyDecisionPolicyResponse): Uint8Array { + return MsgUpdateGroupPolicyDecisionPolicyResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateGroupPolicyDecisionPolicyResponse): MsgUpdateGroupPolicyDecisionPolicyResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicyResponse", + value: MsgUpdateGroupPolicyDecisionPolicyResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgUpdateGroupPolicyDecisionPolicyResponse.typeUrl, MsgUpdateGroupPolicyDecisionPolicyResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgUpdateGroupPolicyDecisionPolicyResponse.aminoType, MsgUpdateGroupPolicyDecisionPolicyResponse.typeUrl); +function createBaseMsgUpdateGroupPolicyMetadata(): MsgUpdateGroupPolicyMetadata { + return { + admin: "", + groupPolicyAddress: "", + metadata: "" + }; +} +export const MsgUpdateGroupPolicyMetadata = { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyMetadata", + aminoType: "cosmos-sdk/MsgUpdateGroupPolicyMetadata", + is(o: any): o is MsgUpdateGroupPolicyMetadata { + return o && (o.$typeUrl === MsgUpdateGroupPolicyMetadata.typeUrl || typeof o.admin === "string" && typeof o.groupPolicyAddress === "string" && typeof o.metadata === "string"); + }, + isAmino(o: any): o is MsgUpdateGroupPolicyMetadataAmino { + return o && (o.$typeUrl === MsgUpdateGroupPolicyMetadata.typeUrl || typeof o.admin === "string" && typeof o.group_policy_address === "string" && typeof o.metadata === "string"); + }, + encode(message: MsgUpdateGroupPolicyMetadata, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.admin !== "") { + writer.uint32(10).string(message.admin); + } + if (message.groupPolicyAddress !== "") { + writer.uint32(18).string(message.groupPolicyAddress); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyMetadata { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupPolicyMetadata(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.admin = reader.string(); + break; + case 2: + message.groupPolicyAddress = reader.string(); + break; + case 3: + message.metadata = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUpdateGroupPolicyMetadata { + const message = createBaseMsgUpdateGroupPolicyMetadata(); + message.admin = object.admin ?? ""; + message.groupPolicyAddress = object.groupPolicyAddress ?? ""; + message.metadata = object.metadata ?? ""; + return message; + }, + fromAmino(object: MsgUpdateGroupPolicyMetadataAmino): MsgUpdateGroupPolicyMetadata { + const message = createBaseMsgUpdateGroupPolicyMetadata(); + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + if (object.group_policy_address !== undefined && object.group_policy_address !== null) { + message.groupPolicyAddress = object.group_policy_address; + } + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + return message; + }, + toAmino(message: MsgUpdateGroupPolicyMetadata): MsgUpdateGroupPolicyMetadataAmino { + const obj: any = {}; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.group_policy_address = message.groupPolicyAddress === "" ? undefined : message.groupPolicyAddress; + obj.metadata = message.metadata === "" ? undefined : message.metadata; + return obj; + }, + fromAminoMsg(object: MsgUpdateGroupPolicyMetadataAminoMsg): MsgUpdateGroupPolicyMetadata { + return MsgUpdateGroupPolicyMetadata.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateGroupPolicyMetadata): MsgUpdateGroupPolicyMetadataAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateGroupPolicyMetadata", + value: MsgUpdateGroupPolicyMetadata.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateGroupPolicyMetadataProtoMsg): MsgUpdateGroupPolicyMetadata { + return MsgUpdateGroupPolicyMetadata.decode(message.value); + }, + toProto(message: MsgUpdateGroupPolicyMetadata): Uint8Array { + return MsgUpdateGroupPolicyMetadata.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateGroupPolicyMetadata): MsgUpdateGroupPolicyMetadataProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyMetadata", + value: MsgUpdateGroupPolicyMetadata.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgUpdateGroupPolicyMetadata.typeUrl, MsgUpdateGroupPolicyMetadata); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgUpdateGroupPolicyMetadata.aminoType, MsgUpdateGroupPolicyMetadata.typeUrl); +function createBaseMsgUpdateGroupPolicyMetadataResponse(): MsgUpdateGroupPolicyMetadataResponse { + return {}; +} +export const MsgUpdateGroupPolicyMetadataResponse = { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyMetadataResponse", + aminoType: "cosmos-sdk/MsgUpdateGroupPolicyMetadataResponse", + is(o: any): o is MsgUpdateGroupPolicyMetadataResponse { + return o && o.$typeUrl === MsgUpdateGroupPolicyMetadataResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateGroupPolicyMetadataResponseAmino { + return o && o.$typeUrl === MsgUpdateGroupPolicyMetadataResponse.typeUrl; + }, + encode(_: MsgUpdateGroupPolicyMetadataResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateGroupPolicyMetadataResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateGroupPolicyMetadataResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgUpdateGroupPolicyMetadataResponse { + const message = createBaseMsgUpdateGroupPolicyMetadataResponse(); + return message; + }, + fromAmino(_: MsgUpdateGroupPolicyMetadataResponseAmino): MsgUpdateGroupPolicyMetadataResponse { + const message = createBaseMsgUpdateGroupPolicyMetadataResponse(); + return message; + }, + toAmino(_: MsgUpdateGroupPolicyMetadataResponse): MsgUpdateGroupPolicyMetadataResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateGroupPolicyMetadataResponseAminoMsg): MsgUpdateGroupPolicyMetadataResponse { + return MsgUpdateGroupPolicyMetadataResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateGroupPolicyMetadataResponse): MsgUpdateGroupPolicyMetadataResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateGroupPolicyMetadataResponse", + value: MsgUpdateGroupPolicyMetadataResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateGroupPolicyMetadataResponseProtoMsg): MsgUpdateGroupPolicyMetadataResponse { + return MsgUpdateGroupPolicyMetadataResponse.decode(message.value); + }, + toProto(message: MsgUpdateGroupPolicyMetadataResponse): Uint8Array { + return MsgUpdateGroupPolicyMetadataResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateGroupPolicyMetadataResponse): MsgUpdateGroupPolicyMetadataResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgUpdateGroupPolicyMetadataResponse", + value: MsgUpdateGroupPolicyMetadataResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgUpdateGroupPolicyMetadataResponse.typeUrl, MsgUpdateGroupPolicyMetadataResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgUpdateGroupPolicyMetadataResponse.aminoType, MsgUpdateGroupPolicyMetadataResponse.typeUrl); +function createBaseMsgSubmitProposal(): MsgSubmitProposal { + return { + groupPolicyAddress: "", + proposers: [], + metadata: "", + messages: [], + exec: 0, + title: "", + summary: "" + }; +} +export const MsgSubmitProposal = { + typeUrl: "/cosmos.group.v1.MsgSubmitProposal", + aminoType: "cosmos-sdk/group/MsgSubmitProposal", + is(o: any): o is MsgSubmitProposal { + return o && (o.$typeUrl === MsgSubmitProposal.typeUrl || typeof o.groupPolicyAddress === "string" && Array.isArray(o.proposers) && (!o.proposers.length || typeof o.proposers[0] === "string") && typeof o.metadata === "string" && Array.isArray(o.messages) && (!o.messages.length || Any.is(o.messages[0])) && isSet(o.exec) && typeof o.title === "string" && typeof o.summary === "string"); + }, + isAmino(o: any): o is MsgSubmitProposalAmino { + return o && (o.$typeUrl === MsgSubmitProposal.typeUrl || typeof o.group_policy_address === "string" && Array.isArray(o.proposers) && (!o.proposers.length || typeof o.proposers[0] === "string") && typeof o.metadata === "string" && Array.isArray(o.messages) && (!o.messages.length || Any.isAmino(o.messages[0])) && isSet(o.exec) && typeof o.title === "string" && typeof o.summary === "string"); + }, + encode(message: MsgSubmitProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.groupPolicyAddress !== "") { + writer.uint32(10).string(message.groupPolicyAddress); + } + for (const v of message.proposers) { + writer.uint32(18).string(v!); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + for (const v of message.messages) { + Any.encode(v!, writer.uint32(34).fork()).ldelim(); + } + if (message.exec !== 0) { + writer.uint32(40).int32(message.exec); + } + if (message.title !== "") { + writer.uint32(50).string(message.title); + } + if (message.summary !== "") { + writer.uint32(58).string(message.summary); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.groupPolicyAddress = reader.string(); + break; + case 2: + message.proposers.push(reader.string()); + break; + case 3: + message.metadata = reader.string(); + break; + case 4: + message.messages.push(Any.decode(reader, reader.uint32())); + break; + case 5: + message.exec = (reader.int32() as any); + break; + case 6: + message.title = reader.string(); + break; + case 7: + message.summary = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgSubmitProposal { + const message = createBaseMsgSubmitProposal(); + message.groupPolicyAddress = object.groupPolicyAddress ?? ""; + message.proposers = object.proposers?.map(e => e) || []; + message.metadata = object.metadata ?? ""; + message.messages = object.messages?.map(e => Any.fromPartial(e)) || []; + message.exec = object.exec ?? 0; + message.title = object.title ?? ""; + message.summary = object.summary ?? ""; + return message; + }, + fromAmino(object: MsgSubmitProposalAmino): MsgSubmitProposal { + const message = createBaseMsgSubmitProposal(); + if (object.group_policy_address !== undefined && object.group_policy_address !== null) { + message.groupPolicyAddress = object.group_policy_address; + } + message.proposers = object.proposers?.map(e => e) || []; + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + message.messages = object.messages?.map(e => Any.fromAmino(e)) || []; + if (object.exec !== undefined && object.exec !== null) { + message.exec = object.exec; + } + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.summary !== undefined && object.summary !== null) { + message.summary = object.summary; + } + return message; + }, + toAmino(message: MsgSubmitProposal): MsgSubmitProposalAmino { + const obj: any = {}; + obj.group_policy_address = message.groupPolicyAddress === "" ? undefined : message.groupPolicyAddress; + if (message.proposers) { + obj.proposers = message.proposers.map(e => e); + } else { + obj.proposers = message.proposers; + } + obj.metadata = message.metadata === "" ? undefined : message.metadata; + if (message.messages) { + obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.messages = message.messages; + } + obj.exec = message.exec === 0 ? undefined : message.exec; + obj.title = message.title === "" ? undefined : message.title; + obj.summary = message.summary === "" ? undefined : message.summary; + return obj; + }, + fromAminoMsg(object: MsgSubmitProposalAminoMsg): MsgSubmitProposal { + return MsgSubmitProposal.fromAmino(object.value); + }, + toAminoMsg(message: MsgSubmitProposal): MsgSubmitProposalAminoMsg { + return { + type: "cosmos-sdk/group/MsgSubmitProposal", + value: MsgSubmitProposal.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSubmitProposalProtoMsg): MsgSubmitProposal { + return MsgSubmitProposal.decode(message.value); + }, + toProto(message: MsgSubmitProposal): Uint8Array { + return MsgSubmitProposal.encode(message).finish(); + }, + toProtoMsg(message: MsgSubmitProposal): MsgSubmitProposalProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgSubmitProposal", + value: MsgSubmitProposal.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgSubmitProposal.typeUrl, MsgSubmitProposal); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgSubmitProposal.aminoType, MsgSubmitProposal.typeUrl); +function createBaseMsgSubmitProposalResponse(): MsgSubmitProposalResponse { + return { + proposalId: BigInt(0) + }; +} +export const MsgSubmitProposalResponse = { + typeUrl: "/cosmos.group.v1.MsgSubmitProposalResponse", + aminoType: "cosmos-sdk/MsgSubmitProposalResponse", + is(o: any): o is MsgSubmitProposalResponse { + return o && (o.$typeUrl === MsgSubmitProposalResponse.typeUrl || typeof o.proposalId === "bigint"); + }, + isAmino(o: any): o is MsgSubmitProposalResponseAmino { + return o && (o.$typeUrl === MsgSubmitProposalResponse.typeUrl || typeof o.proposal_id === "bigint"); + }, + encode(message: MsgSubmitProposalResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgSubmitProposalResponse { + const message = createBaseMsgSubmitProposalResponse(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + return message; + }, + fromAmino(object: MsgSubmitProposalResponseAmino): MsgSubmitProposalResponse { + const message = createBaseMsgSubmitProposalResponse(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + return message; + }, + toAmino(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: MsgSubmitProposalResponseAminoMsg): MsgSubmitProposalResponse { + return MsgSubmitProposalResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAminoMsg { + return { + type: "cosmos-sdk/MsgSubmitProposalResponse", + value: MsgSubmitProposalResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSubmitProposalResponseProtoMsg): MsgSubmitProposalResponse { + return MsgSubmitProposalResponse.decode(message.value); + }, + toProto(message: MsgSubmitProposalResponse): Uint8Array { + return MsgSubmitProposalResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgSubmitProposalResponse", + value: MsgSubmitProposalResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgSubmitProposalResponse.typeUrl, MsgSubmitProposalResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgSubmitProposalResponse.aminoType, MsgSubmitProposalResponse.typeUrl); +function createBaseMsgWithdrawProposal(): MsgWithdrawProposal { + return { + proposalId: BigInt(0), + address: "" + }; +} +export const MsgWithdrawProposal = { + typeUrl: "/cosmos.group.v1.MsgWithdrawProposal", + aminoType: "cosmos-sdk/group/MsgWithdrawProposal", + is(o: any): o is MsgWithdrawProposal { + return o && (o.$typeUrl === MsgWithdrawProposal.typeUrl || typeof o.proposalId === "bigint" && typeof o.address === "string"); + }, + isAmino(o: any): o is MsgWithdrawProposalAmino { + return o && (o.$typeUrl === MsgWithdrawProposal.typeUrl || typeof o.proposal_id === "bigint" && typeof o.address === "string"); + }, + encode(message: MsgWithdrawProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.address !== "") { + writer.uint32(18).string(message.address); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgWithdrawProposal { + const message = createBaseMsgWithdrawProposal(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.address = object.address ?? ""; + return message; + }, + fromAmino(object: MsgWithdrawProposalAmino): MsgWithdrawProposal { + const message = createBaseMsgWithdrawProposal(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + return message; + }, + toAmino(message: MsgWithdrawProposal): MsgWithdrawProposalAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId?.toString() : undefined; + obj.address = message.address === "" ? undefined : message.address; + return obj; + }, + fromAminoMsg(object: MsgWithdrawProposalAminoMsg): MsgWithdrawProposal { + return MsgWithdrawProposal.fromAmino(object.value); + }, + toAminoMsg(message: MsgWithdrawProposal): MsgWithdrawProposalAminoMsg { + return { + type: "cosmos-sdk/group/MsgWithdrawProposal", + value: MsgWithdrawProposal.toAmino(message) + }; + }, + fromProtoMsg(message: MsgWithdrawProposalProtoMsg): MsgWithdrawProposal { + return MsgWithdrawProposal.decode(message.value); + }, + toProto(message: MsgWithdrawProposal): Uint8Array { + return MsgWithdrawProposal.encode(message).finish(); + }, + toProtoMsg(message: MsgWithdrawProposal): MsgWithdrawProposalProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgWithdrawProposal", + value: MsgWithdrawProposal.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgWithdrawProposal.typeUrl, MsgWithdrawProposal); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgWithdrawProposal.aminoType, MsgWithdrawProposal.typeUrl); +function createBaseMsgWithdrawProposalResponse(): MsgWithdrawProposalResponse { + return {}; +} +export const MsgWithdrawProposalResponse = { + typeUrl: "/cosmos.group.v1.MsgWithdrawProposalResponse", + aminoType: "cosmos-sdk/MsgWithdrawProposalResponse", + is(o: any): o is MsgWithdrawProposalResponse { + return o && o.$typeUrl === MsgWithdrawProposalResponse.typeUrl; + }, + isAmino(o: any): o is MsgWithdrawProposalResponseAmino { + return o && o.$typeUrl === MsgWithdrawProposalResponse.typeUrl; + }, + encode(_: MsgWithdrawProposalResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgWithdrawProposalResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgWithdrawProposalResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgWithdrawProposalResponse { + const message = createBaseMsgWithdrawProposalResponse(); + return message; + }, + fromAmino(_: MsgWithdrawProposalResponseAmino): MsgWithdrawProposalResponse { + const message = createBaseMsgWithdrawProposalResponse(); + return message; + }, + toAmino(_: MsgWithdrawProposalResponse): MsgWithdrawProposalResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgWithdrawProposalResponseAminoMsg): MsgWithdrawProposalResponse { + return MsgWithdrawProposalResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgWithdrawProposalResponse): MsgWithdrawProposalResponseAminoMsg { + return { + type: "cosmos-sdk/MsgWithdrawProposalResponse", + value: MsgWithdrawProposalResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgWithdrawProposalResponseProtoMsg): MsgWithdrawProposalResponse { + return MsgWithdrawProposalResponse.decode(message.value); + }, + toProto(message: MsgWithdrawProposalResponse): Uint8Array { + return MsgWithdrawProposalResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgWithdrawProposalResponse): MsgWithdrawProposalResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgWithdrawProposalResponse", + value: MsgWithdrawProposalResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgWithdrawProposalResponse.typeUrl, MsgWithdrawProposalResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgWithdrawProposalResponse.aminoType, MsgWithdrawProposalResponse.typeUrl); +function createBaseMsgVote(): MsgVote { + return { + proposalId: BigInt(0), + voter: "", + option: 0, + metadata: "", + exec: 0 + }; +} +export const MsgVote = { + typeUrl: "/cosmos.group.v1.MsgVote", + aminoType: "cosmos-sdk/group/MsgVote", + is(o: any): o is MsgVote { + return o && (o.$typeUrl === MsgVote.typeUrl || typeof o.proposalId === "bigint" && typeof o.voter === "string" && isSet(o.option) && typeof o.metadata === "string" && isSet(o.exec)); + }, + isAmino(o: any): o is MsgVoteAmino { + return o && (o.$typeUrl === MsgVote.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string" && isSet(o.option) && typeof o.metadata === "string" && isSet(o.exec)); + }, + encode(message: MsgVote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== 0) { + writer.uint32(24).int32(message.option); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + if (message.exec !== 0) { + writer.uint32(40).int32(message.exec); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.voter = reader.string(); + break; + case 3: + message.option = (reader.int32() as any); + break; + case 4: + message.metadata = reader.string(); + break; + case 5: + message.exec = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgVote { + const message = createBaseMsgVote(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.voter = object.voter ?? ""; + message.option = object.option ?? 0; + message.metadata = object.metadata ?? ""; + message.exec = object.exec ?? 0; + return message; + }, + fromAmino(object: MsgVoteAmino): MsgVote { + const message = createBaseMsgVote(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.voter !== undefined && object.voter !== null) { + message.voter = object.voter; + } + if (object.option !== undefined && object.option !== null) { + message.option = object.option; + } + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + if (object.exec !== undefined && object.exec !== null) { + message.exec = object.exec; + } + return message; + }, + toAmino(message: MsgVote): MsgVoteAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId?.toString() : undefined; + obj.voter = message.voter === "" ? undefined : message.voter; + obj.option = message.option === 0 ? undefined : message.option; + obj.metadata = message.metadata === "" ? undefined : message.metadata; + obj.exec = message.exec === 0 ? undefined : message.exec; + return obj; + }, + fromAminoMsg(object: MsgVoteAminoMsg): MsgVote { + return MsgVote.fromAmino(object.value); + }, + toAminoMsg(message: MsgVote): MsgVoteAminoMsg { + return { + type: "cosmos-sdk/group/MsgVote", + value: MsgVote.toAmino(message) + }; + }, + fromProtoMsg(message: MsgVoteProtoMsg): MsgVote { + return MsgVote.decode(message.value); + }, + toProto(message: MsgVote): Uint8Array { + return MsgVote.encode(message).finish(); + }, + toProtoMsg(message: MsgVote): MsgVoteProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgVote", + value: MsgVote.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgVote.typeUrl, MsgVote); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgVote.aminoType, MsgVote.typeUrl); +function createBaseMsgVoteResponse(): MsgVoteResponse { + return {}; +} +export const MsgVoteResponse = { + typeUrl: "/cosmos.group.v1.MsgVoteResponse", + aminoType: "cosmos-sdk/MsgVoteResponse", + is(o: any): o is MsgVoteResponse { + return o && o.$typeUrl === MsgVoteResponse.typeUrl; + }, + isAmino(o: any): o is MsgVoteResponseAmino { + return o && o.$typeUrl === MsgVoteResponse.typeUrl; + }, + encode(_: MsgVoteResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgVoteResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgVoteResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgVoteResponse { + const message = createBaseMsgVoteResponse(); + return message; + }, + fromAmino(_: MsgVoteResponseAmino): MsgVoteResponse { + const message = createBaseMsgVoteResponse(); + return message; + }, + toAmino(_: MsgVoteResponse): MsgVoteResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgVoteResponseAminoMsg): MsgVoteResponse { + return MsgVoteResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgVoteResponse): MsgVoteResponseAminoMsg { + return { + type: "cosmos-sdk/MsgVoteResponse", + value: MsgVoteResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgVoteResponseProtoMsg): MsgVoteResponse { + return MsgVoteResponse.decode(message.value); + }, + toProto(message: MsgVoteResponse): Uint8Array { + return MsgVoteResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgVoteResponse): MsgVoteResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgVoteResponse", + value: MsgVoteResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgVoteResponse.typeUrl, MsgVoteResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgVoteResponse.aminoType, MsgVoteResponse.typeUrl); +function createBaseMsgExec(): MsgExec { + return { + proposalId: BigInt(0), + executor: "" + }; +} +export const MsgExec = { + typeUrl: "/cosmos.group.v1.MsgExec", + aminoType: "cosmos-sdk/group/MsgExec", + is(o: any): o is MsgExec { + return o && (o.$typeUrl === MsgExec.typeUrl || typeof o.proposalId === "bigint" && typeof o.executor === "string"); + }, + isAmino(o: any): o is MsgExecAmino { + return o && (o.$typeUrl === MsgExec.typeUrl || typeof o.proposal_id === "bigint" && typeof o.executor === "string"); + }, + encode(message: MsgExec, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.executor !== "") { + writer.uint32(18).string(message.executor); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgExec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.executor = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgExec { + const message = createBaseMsgExec(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.executor = object.executor ?? ""; + return message; + }, + fromAmino(object: MsgExecAmino): MsgExec { + const message = createBaseMsgExec(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.executor !== undefined && object.executor !== null) { + message.executor = object.executor; + } + return message; + }, + toAmino(message: MsgExec): MsgExecAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId?.toString() : undefined; + obj.executor = message.executor === "" ? undefined : message.executor; + return obj; + }, + fromAminoMsg(object: MsgExecAminoMsg): MsgExec { + return MsgExec.fromAmino(object.value); + }, + toAminoMsg(message: MsgExec): MsgExecAminoMsg { + return { + type: "cosmos-sdk/group/MsgExec", + value: MsgExec.toAmino(message) + }; + }, + fromProtoMsg(message: MsgExecProtoMsg): MsgExec { + return MsgExec.decode(message.value); + }, + toProto(message: MsgExec): Uint8Array { + return MsgExec.encode(message).finish(); + }, + toProtoMsg(message: MsgExec): MsgExecProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgExec", + value: MsgExec.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgExec.typeUrl, MsgExec); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgExec.aminoType, MsgExec.typeUrl); +function createBaseMsgExecResponse(): MsgExecResponse { + return { + result: 0 + }; +} +export const MsgExecResponse = { + typeUrl: "/cosmos.group.v1.MsgExecResponse", + aminoType: "cosmos-sdk/MsgExecResponse", + is(o: any): o is MsgExecResponse { + return o && (o.$typeUrl === MsgExecResponse.typeUrl || isSet(o.result)); + }, + isAmino(o: any): o is MsgExecResponseAmino { + return o && (o.$typeUrl === MsgExecResponse.typeUrl || isSet(o.result)); + }, + encode(message: MsgExecResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.result !== 0) { + writer.uint32(16).int32(message.result); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgExecResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExecResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.result = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgExecResponse { + const message = createBaseMsgExecResponse(); + message.result = object.result ?? 0; + return message; + }, + fromAmino(object: MsgExecResponseAmino): MsgExecResponse { + const message = createBaseMsgExecResponse(); + if (object.result !== undefined && object.result !== null) { + message.result = object.result; + } + return message; + }, + toAmino(message: MsgExecResponse): MsgExecResponseAmino { + const obj: any = {}; + obj.result = message.result === 0 ? undefined : message.result; + return obj; + }, + fromAminoMsg(object: MsgExecResponseAminoMsg): MsgExecResponse { + return MsgExecResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgExecResponse): MsgExecResponseAminoMsg { + return { + type: "cosmos-sdk/MsgExecResponse", + value: MsgExecResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgExecResponseProtoMsg): MsgExecResponse { + return MsgExecResponse.decode(message.value); + }, + toProto(message: MsgExecResponse): Uint8Array { + return MsgExecResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgExecResponse): MsgExecResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgExecResponse", + value: MsgExecResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgExecResponse.typeUrl, MsgExecResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgExecResponse.aminoType, MsgExecResponse.typeUrl); +function createBaseMsgLeaveGroup(): MsgLeaveGroup { + return { + address: "", + groupId: BigInt(0) + }; +} +export const MsgLeaveGroup = { + typeUrl: "/cosmos.group.v1.MsgLeaveGroup", + aminoType: "cosmos-sdk/group/MsgLeaveGroup", + is(o: any): o is MsgLeaveGroup { + return o && (o.$typeUrl === MsgLeaveGroup.typeUrl || typeof o.address === "string" && typeof o.groupId === "bigint"); + }, + isAmino(o: any): o is MsgLeaveGroupAmino { + return o && (o.$typeUrl === MsgLeaveGroup.typeUrl || typeof o.address === "string" && typeof o.group_id === "bigint"); + }, + encode(message: MsgLeaveGroup, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.groupId !== BigInt(0)) { + writer.uint32(16).uint64(message.groupId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgLeaveGroup { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgLeaveGroup(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.groupId = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgLeaveGroup { + const message = createBaseMsgLeaveGroup(); + message.address = object.address ?? ""; + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); + return message; + }, + fromAmino(object: MsgLeaveGroupAmino): MsgLeaveGroup { + const message = createBaseMsgLeaveGroup(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.group_id !== undefined && object.group_id !== null) { + message.groupId = BigInt(object.group_id); + } + return message; + }, + toAmino(message: MsgLeaveGroup): MsgLeaveGroupAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: MsgLeaveGroupAminoMsg): MsgLeaveGroup { + return MsgLeaveGroup.fromAmino(object.value); + }, + toAminoMsg(message: MsgLeaveGroup): MsgLeaveGroupAminoMsg { + return { + type: "cosmos-sdk/group/MsgLeaveGroup", + value: MsgLeaveGroup.toAmino(message) + }; + }, + fromProtoMsg(message: MsgLeaveGroupProtoMsg): MsgLeaveGroup { + return MsgLeaveGroup.decode(message.value); + }, + toProto(message: MsgLeaveGroup): Uint8Array { + return MsgLeaveGroup.encode(message).finish(); + }, + toProtoMsg(message: MsgLeaveGroup): MsgLeaveGroupProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgLeaveGroup", + value: MsgLeaveGroup.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgLeaveGroup.typeUrl, MsgLeaveGroup); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgLeaveGroup.aminoType, MsgLeaveGroup.typeUrl); +function createBaseMsgLeaveGroupResponse(): MsgLeaveGroupResponse { + return {}; +} +export const MsgLeaveGroupResponse = { + typeUrl: "/cosmos.group.v1.MsgLeaveGroupResponse", + aminoType: "cosmos-sdk/MsgLeaveGroupResponse", + is(o: any): o is MsgLeaveGroupResponse { + return o && o.$typeUrl === MsgLeaveGroupResponse.typeUrl; + }, + isAmino(o: any): o is MsgLeaveGroupResponseAmino { + return o && o.$typeUrl === MsgLeaveGroupResponse.typeUrl; + }, + encode(_: MsgLeaveGroupResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgLeaveGroupResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgLeaveGroupResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgLeaveGroupResponse { + const message = createBaseMsgLeaveGroupResponse(); + return message; + }, + fromAmino(_: MsgLeaveGroupResponseAmino): MsgLeaveGroupResponse { + const message = createBaseMsgLeaveGroupResponse(); + return message; + }, + toAmino(_: MsgLeaveGroupResponse): MsgLeaveGroupResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgLeaveGroupResponseAminoMsg): MsgLeaveGroupResponse { + return MsgLeaveGroupResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgLeaveGroupResponse): MsgLeaveGroupResponseAminoMsg { + return { + type: "cosmos-sdk/MsgLeaveGroupResponse", + value: MsgLeaveGroupResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgLeaveGroupResponseProtoMsg): MsgLeaveGroupResponse { + return MsgLeaveGroupResponse.decode(message.value); + }, + toProto(message: MsgLeaveGroupResponse): Uint8Array { + return MsgLeaveGroupResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgLeaveGroupResponse): MsgLeaveGroupResponseProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MsgLeaveGroupResponse", + value: MsgLeaveGroupResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgLeaveGroupResponse.typeUrl, MsgLeaveGroupResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgLeaveGroupResponse.aminoType, MsgLeaveGroupResponse.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/group/v1/types.ts b/libs/interchain-query/src/cosmos/group/v1/types.ts new file mode 100644 index 00000000..f8e9c860 --- /dev/null +++ b/libs/interchain-query/src/cosmos/group/v1/types.ts @@ -0,0 +1,2081 @@ +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Duration, DurationAmino } from "../../../google/protobuf/duration"; +import { Any, AnyProtoMsg, AnyAmino } from "../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { toTimestamp, fromTimestamp, DeepPartial, isSet } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; +/** VoteOption enumerates the valid vote options for a given proposal. */ +export enum VoteOption { + /** + * VOTE_OPTION_UNSPECIFIED - VOTE_OPTION_UNSPECIFIED defines an unspecified vote option which will + * return an error. + */ + VOTE_OPTION_UNSPECIFIED = 0, + /** VOTE_OPTION_YES - VOTE_OPTION_YES defines a yes vote option. */ + VOTE_OPTION_YES = 1, + /** VOTE_OPTION_ABSTAIN - VOTE_OPTION_ABSTAIN defines an abstain vote option. */ + VOTE_OPTION_ABSTAIN = 2, + /** VOTE_OPTION_NO - VOTE_OPTION_NO defines a no vote option. */ + VOTE_OPTION_NO = 3, + /** VOTE_OPTION_NO_WITH_VETO - VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. */ + VOTE_OPTION_NO_WITH_VETO = 4, + UNRECOGNIZED = -1, +} +export const VoteOptionAmino = VoteOption; +export function voteOptionFromJSON(object: any): VoteOption { + switch (object) { + case 0: + case "VOTE_OPTION_UNSPECIFIED": + return VoteOption.VOTE_OPTION_UNSPECIFIED; + case 1: + case "VOTE_OPTION_YES": + return VoteOption.VOTE_OPTION_YES; + case 2: + case "VOTE_OPTION_ABSTAIN": + return VoteOption.VOTE_OPTION_ABSTAIN; + case 3: + case "VOTE_OPTION_NO": + return VoteOption.VOTE_OPTION_NO; + case 4: + case "VOTE_OPTION_NO_WITH_VETO": + return VoteOption.VOTE_OPTION_NO_WITH_VETO; + case -1: + case "UNRECOGNIZED": + default: + return VoteOption.UNRECOGNIZED; + } +} +export function voteOptionToJSON(object: VoteOption): string { + switch (object) { + case VoteOption.VOTE_OPTION_UNSPECIFIED: + return "VOTE_OPTION_UNSPECIFIED"; + case VoteOption.VOTE_OPTION_YES: + return "VOTE_OPTION_YES"; + case VoteOption.VOTE_OPTION_ABSTAIN: + return "VOTE_OPTION_ABSTAIN"; + case VoteOption.VOTE_OPTION_NO: + return "VOTE_OPTION_NO"; + case VoteOption.VOTE_OPTION_NO_WITH_VETO: + return "VOTE_OPTION_NO_WITH_VETO"; + case VoteOption.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** ProposalStatus defines proposal statuses. */ +export enum ProposalStatus { + /** PROPOSAL_STATUS_UNSPECIFIED - An empty value is invalid and not allowed. */ + PROPOSAL_STATUS_UNSPECIFIED = 0, + /** PROPOSAL_STATUS_SUBMITTED - Initial status of a proposal when submitted. */ + PROPOSAL_STATUS_SUBMITTED = 1, + /** + * PROPOSAL_STATUS_ACCEPTED - Final status of a proposal when the final tally is done and the outcome + * passes the group policy's decision policy. + */ + PROPOSAL_STATUS_ACCEPTED = 2, + /** + * PROPOSAL_STATUS_REJECTED - Final status of a proposal when the final tally is done and the outcome + * is rejected by the group policy's decision policy. + */ + PROPOSAL_STATUS_REJECTED = 3, + /** + * PROPOSAL_STATUS_ABORTED - Final status of a proposal when the group policy is modified before the + * final tally. + */ + PROPOSAL_STATUS_ABORTED = 4, + /** + * PROPOSAL_STATUS_WITHDRAWN - A proposal can be withdrawn before the voting start time by the owner. + * When this happens the final status is Withdrawn. + */ + PROPOSAL_STATUS_WITHDRAWN = 5, + UNRECOGNIZED = -1, +} +export const ProposalStatusAmino = ProposalStatus; +export function proposalStatusFromJSON(object: any): ProposalStatus { + switch (object) { + case 0: + case "PROPOSAL_STATUS_UNSPECIFIED": + return ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED; + case 1: + case "PROPOSAL_STATUS_SUBMITTED": + return ProposalStatus.PROPOSAL_STATUS_SUBMITTED; + case 2: + case "PROPOSAL_STATUS_ACCEPTED": + return ProposalStatus.PROPOSAL_STATUS_ACCEPTED; + case 3: + case "PROPOSAL_STATUS_REJECTED": + return ProposalStatus.PROPOSAL_STATUS_REJECTED; + case 4: + case "PROPOSAL_STATUS_ABORTED": + return ProposalStatus.PROPOSAL_STATUS_ABORTED; + case 5: + case "PROPOSAL_STATUS_WITHDRAWN": + return ProposalStatus.PROPOSAL_STATUS_WITHDRAWN; + case -1: + case "UNRECOGNIZED": + default: + return ProposalStatus.UNRECOGNIZED; + } +} +export function proposalStatusToJSON(object: ProposalStatus): string { + switch (object) { + case ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED: + return "PROPOSAL_STATUS_UNSPECIFIED"; + case ProposalStatus.PROPOSAL_STATUS_SUBMITTED: + return "PROPOSAL_STATUS_SUBMITTED"; + case ProposalStatus.PROPOSAL_STATUS_ACCEPTED: + return "PROPOSAL_STATUS_ACCEPTED"; + case ProposalStatus.PROPOSAL_STATUS_REJECTED: + return "PROPOSAL_STATUS_REJECTED"; + case ProposalStatus.PROPOSAL_STATUS_ABORTED: + return "PROPOSAL_STATUS_ABORTED"; + case ProposalStatus.PROPOSAL_STATUS_WITHDRAWN: + return "PROPOSAL_STATUS_WITHDRAWN"; + case ProposalStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** ProposalExecutorResult defines types of proposal executor results. */ +export enum ProposalExecutorResult { + /** PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED - An empty value is not allowed. */ + PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED = 0, + /** PROPOSAL_EXECUTOR_RESULT_NOT_RUN - We have not yet run the executor. */ + PROPOSAL_EXECUTOR_RESULT_NOT_RUN = 1, + /** PROPOSAL_EXECUTOR_RESULT_SUCCESS - The executor was successful and proposed action updated state. */ + PROPOSAL_EXECUTOR_RESULT_SUCCESS = 2, + /** PROPOSAL_EXECUTOR_RESULT_FAILURE - The executor returned an error and proposed action didn't update state. */ + PROPOSAL_EXECUTOR_RESULT_FAILURE = 3, + UNRECOGNIZED = -1, +} +export const ProposalExecutorResultAmino = ProposalExecutorResult; +export function proposalExecutorResultFromJSON(object: any): ProposalExecutorResult { + switch (object) { + case 0: + case "PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED": + return ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED; + case 1: + case "PROPOSAL_EXECUTOR_RESULT_NOT_RUN": + return ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_NOT_RUN; + case 2: + case "PROPOSAL_EXECUTOR_RESULT_SUCCESS": + return ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_SUCCESS; + case 3: + case "PROPOSAL_EXECUTOR_RESULT_FAILURE": + return ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_FAILURE; + case -1: + case "UNRECOGNIZED": + default: + return ProposalExecutorResult.UNRECOGNIZED; + } +} +export function proposalExecutorResultToJSON(object: ProposalExecutorResult): string { + switch (object) { + case ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED: + return "PROPOSAL_EXECUTOR_RESULT_UNSPECIFIED"; + case ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_NOT_RUN: + return "PROPOSAL_EXECUTOR_RESULT_NOT_RUN"; + case ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_SUCCESS: + return "PROPOSAL_EXECUTOR_RESULT_SUCCESS"; + case ProposalExecutorResult.PROPOSAL_EXECUTOR_RESULT_FAILURE: + return "PROPOSAL_EXECUTOR_RESULT_FAILURE"; + case ProposalExecutorResult.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** + * Member represents a group member with an account address, + * non-zero weight, metadata and added_at timestamp. + */ +export interface Member { + /** address is the member's account address. */ + address: string; + /** weight is the member's voting weight that should be greater than 0. */ + weight: string; + /** metadata is any arbitrary metadata attached to the member. */ + metadata: string; + /** added_at is a timestamp specifying when a member was added. */ + addedAt: Date; +} +export interface MemberProtoMsg { + typeUrl: "/cosmos.group.v1.Member"; + value: Uint8Array; +} +/** + * Member represents a group member with an account address, + * non-zero weight, metadata and added_at timestamp. + */ +export interface MemberAmino { + /** address is the member's account address. */ + address: string; + /** weight is the member's voting weight that should be greater than 0. */ + weight: string; + /** metadata is any arbitrary metadata attached to the member. */ + metadata: string; + /** added_at is a timestamp specifying when a member was added. */ + added_at: string; +} +export interface MemberAminoMsg { + type: "cosmos-sdk/Member"; + value: MemberAmino; +} +/** + * MemberRequest represents a group member to be used in Msg server requests. + * Contrary to `Member`, it doesn't have any `added_at` field + * since this field cannot be set as part of requests. + */ +export interface MemberRequest { + /** address is the member's account address. */ + address: string; + /** weight is the member's voting weight that should be greater than 0. */ + weight: string; + /** metadata is any arbitrary metadata attached to the member. */ + metadata: string; +} +export interface MemberRequestProtoMsg { + typeUrl: "/cosmos.group.v1.MemberRequest"; + value: Uint8Array; +} +/** + * MemberRequest represents a group member to be used in Msg server requests. + * Contrary to `Member`, it doesn't have any `added_at` field + * since this field cannot be set as part of requests. + */ +export interface MemberRequestAmino { + /** address is the member's account address. */ + address: string; + /** weight is the member's voting weight that should be greater than 0. */ + weight: string; + /** metadata is any arbitrary metadata attached to the member. */ + metadata: string; +} +export interface MemberRequestAminoMsg { + type: "cosmos-sdk/MemberRequest"; + value: MemberRequestAmino; +} +/** + * ThresholdDecisionPolicy is a decision policy where a proposal passes when it + * satisfies the two following conditions: + * 1. The sum of all `YES` voter's weights is greater or equal than the defined + * `threshold`. + * 2. The voting and execution periods of the proposal respect the parameters + * given by `windows`. + */ +export interface ThresholdDecisionPolicy { + /** + * threshold is the minimum weighted sum of `YES` votes that must be met or + * exceeded for a proposal to succeed. + */ + threshold: string; + /** windows defines the different windows for voting and execution. */ + windows?: DecisionPolicyWindows; +} +export interface ThresholdDecisionPolicyProtoMsg { + typeUrl: "/cosmos.group.v1.ThresholdDecisionPolicy"; + value: Uint8Array; +} +/** + * ThresholdDecisionPolicy is a decision policy where a proposal passes when it + * satisfies the two following conditions: + * 1. The sum of all `YES` voter's weights is greater or equal than the defined + * `threshold`. + * 2. The voting and execution periods of the proposal respect the parameters + * given by `windows`. + */ +export interface ThresholdDecisionPolicyAmino { + /** + * threshold is the minimum weighted sum of `YES` votes that must be met or + * exceeded for a proposal to succeed. + */ + threshold: string; + /** windows defines the different windows for voting and execution. */ + windows?: DecisionPolicyWindowsAmino; +} +export interface ThresholdDecisionPolicyAminoMsg { + type: "cosmos-sdk/ThresholdDecisionPolicy"; + value: ThresholdDecisionPolicyAmino; +} +/** + * PercentageDecisionPolicy is a decision policy where a proposal passes when + * it satisfies the two following conditions: + * 1. The percentage of all `YES` voters' weights out of the total group weight + * is greater or equal than the given `percentage`. + * 2. The voting and execution periods of the proposal respect the parameters + * given by `windows`. + */ +export interface PercentageDecisionPolicy { + /** + * percentage is the minimum percentage of the weighted sum of `YES` votes must + * meet for a proposal to succeed. + */ + percentage: string; + /** windows defines the different windows for voting and execution. */ + windows?: DecisionPolicyWindows; +} +export interface PercentageDecisionPolicyProtoMsg { + typeUrl: "/cosmos.group.v1.PercentageDecisionPolicy"; + value: Uint8Array; +} +/** + * PercentageDecisionPolicy is a decision policy where a proposal passes when + * it satisfies the two following conditions: + * 1. The percentage of all `YES` voters' weights out of the total group weight + * is greater or equal than the given `percentage`. + * 2. The voting and execution periods of the proposal respect the parameters + * given by `windows`. + */ +export interface PercentageDecisionPolicyAmino { + /** + * percentage is the minimum percentage of the weighted sum of `YES` votes must + * meet for a proposal to succeed. + */ + percentage: string; + /** windows defines the different windows for voting and execution. */ + windows?: DecisionPolicyWindowsAmino; +} +export interface PercentageDecisionPolicyAminoMsg { + type: "cosmos-sdk/PercentageDecisionPolicy"; + value: PercentageDecisionPolicyAmino; +} +/** DecisionPolicyWindows defines the different windows for voting and execution. */ +export interface DecisionPolicyWindows { + /** + * voting_period is the duration from submission of a proposal to the end of voting period + * Within this times votes can be submitted with MsgVote. + */ + votingPeriod: Duration; + /** + * min_execution_period is the minimum duration after the proposal submission + * where members can start sending MsgExec. This means that the window for + * sending a MsgExec transaction is: + * `[ submission + min_execution_period ; submission + voting_period + max_execution_period]` + * where max_execution_period is a app-specific config, defined in the keeper. + * If not set, min_execution_period will default to 0. + * + * Please make sure to set a `min_execution_period` that is smaller than + * `voting_period + max_execution_period`, or else the above execution window + * is empty, meaning that all proposals created with this decision policy + * won't be able to be executed. + */ + minExecutionPeriod: Duration; +} +export interface DecisionPolicyWindowsProtoMsg { + typeUrl: "/cosmos.group.v1.DecisionPolicyWindows"; + value: Uint8Array; +} +/** DecisionPolicyWindows defines the different windows for voting and execution. */ +export interface DecisionPolicyWindowsAmino { + /** + * voting_period is the duration from submission of a proposal to the end of voting period + * Within this times votes can be submitted with MsgVote. + */ + voting_period: DurationAmino; + /** + * min_execution_period is the minimum duration after the proposal submission + * where members can start sending MsgExec. This means that the window for + * sending a MsgExec transaction is: + * `[ submission + min_execution_period ; submission + voting_period + max_execution_period]` + * where max_execution_period is a app-specific config, defined in the keeper. + * If not set, min_execution_period will default to 0. + * + * Please make sure to set a `min_execution_period` that is smaller than + * `voting_period + max_execution_period`, or else the above execution window + * is empty, meaning that all proposals created with this decision policy + * won't be able to be executed. + */ + min_execution_period: DurationAmino; +} +export interface DecisionPolicyWindowsAminoMsg { + type: "cosmos-sdk/DecisionPolicyWindows"; + value: DecisionPolicyWindowsAmino; +} +/** GroupInfo represents the high-level on-chain information for a group. */ +export interface GroupInfo { + /** id is the unique ID of the group. */ + id: bigint; + /** admin is the account address of the group's admin. */ + admin: string; + /** + * metadata is any arbitrary metadata to attached to the group. + * the recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/group#group-1 + */ + metadata: string; + /** + * version is used to track changes to a group's membership structure that + * would break existing proposals. Whenever any members weight is changed, + * or any member is added or removed this version is incremented and will + * cause proposals based on older versions of this group to fail + */ + version: bigint; + /** total_weight is the sum of the group members' weights. */ + totalWeight: string; + /** created_at is a timestamp specifying when a group was created. */ + createdAt: Date; +} +export interface GroupInfoProtoMsg { + typeUrl: "/cosmos.group.v1.GroupInfo"; + value: Uint8Array; +} +/** GroupInfo represents the high-level on-chain information for a group. */ +export interface GroupInfoAmino { + /** id is the unique ID of the group. */ + id: string; + /** admin is the account address of the group's admin. */ + admin: string; + /** + * metadata is any arbitrary metadata to attached to the group. + * the recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/group#group-1 + */ + metadata: string; + /** + * version is used to track changes to a group's membership structure that + * would break existing proposals. Whenever any members weight is changed, + * or any member is added or removed this version is incremented and will + * cause proposals based on older versions of this group to fail + */ + version: string; + /** total_weight is the sum of the group members' weights. */ + total_weight: string; + /** created_at is a timestamp specifying when a group was created. */ + created_at: string; +} +export interface GroupInfoAminoMsg { + type: "cosmos-sdk/GroupInfo"; + value: GroupInfoAmino; +} +/** GroupMember represents the relationship between a group and a member. */ +export interface GroupMember { + /** group_id is the unique ID of the group. */ + groupId: bigint; + /** member is the member data. */ + member?: Member; +} +export interface GroupMemberProtoMsg { + typeUrl: "/cosmos.group.v1.GroupMember"; + value: Uint8Array; +} +/** GroupMember represents the relationship between a group and a member. */ +export interface GroupMemberAmino { + /** group_id is the unique ID of the group. */ + group_id: string; + /** member is the member data. */ + member?: MemberAmino; +} +export interface GroupMemberAminoMsg { + type: "cosmos-sdk/GroupMember"; + value: GroupMemberAmino; +} +/** GroupPolicyInfo represents the high-level on-chain information for a group policy. */ +export interface GroupPolicyInfo { + /** address is the account address of group policy. */ + address: string; + /** group_id is the unique ID of the group. */ + groupId: bigint; + /** admin is the account address of the group admin. */ + admin: string; + /** + * metadata is any arbitrary metadata attached to the group policy. + * the recommended format of the metadata is to be found here: + * https://docs.cosmos.network/v0.47/modules/group#decision-policy-1 + */ + metadata: string; + /** + * version is used to track changes to a group's GroupPolicyInfo structure that + * would create a different result on a running proposal. + */ + version: bigint; + /** decision_policy specifies the group policy's decision policy. */ + decisionPolicy?: ThresholdDecisionPolicy | PercentageDecisionPolicy | Any | undefined; + /** created_at is a timestamp specifying when a group policy was created. */ + createdAt: Date; +} +export interface GroupPolicyInfoProtoMsg { + typeUrl: "/cosmos.group.v1.GroupPolicyInfo"; + value: Uint8Array; +} +export type GroupPolicyInfoEncoded = Omit & { + /** decision_policy specifies the group policy's decision policy. */decisionPolicy?: ThresholdDecisionPolicyProtoMsg | PercentageDecisionPolicyProtoMsg | AnyProtoMsg | undefined; +}; +/** GroupPolicyInfo represents the high-level on-chain information for a group policy. */ +export interface GroupPolicyInfoAmino { + /** address is the account address of group policy. */ + address: string; + /** group_id is the unique ID of the group. */ + group_id: string; + /** admin is the account address of the group admin. */ + admin: string; + /** + * metadata is any arbitrary metadata attached to the group policy. + * the recommended format of the metadata is to be found here: + * https://docs.cosmos.network/v0.47/modules/group#decision-policy-1 + */ + metadata: string; + /** + * version is used to track changes to a group's GroupPolicyInfo structure that + * would create a different result on a running proposal. + */ + version: string; + /** decision_policy specifies the group policy's decision policy. */ + decision_policy?: AnyAmino; + /** created_at is a timestamp specifying when a group policy was created. */ + created_at: string; +} +export interface GroupPolicyInfoAminoMsg { + type: "cosmos-sdk/GroupPolicyInfo"; + value: GroupPolicyInfoAmino; +} +/** + * Proposal defines a group proposal. Any member of a group can submit a proposal + * for a group policy to decide upon. + * A proposal consists of a set of `sdk.Msg`s that will be executed if the proposal + * passes as well as some optional metadata associated with the proposal. + */ +export interface Proposal { + /** id is the unique id of the proposal. */ + id: bigint; + /** group_policy_address is the account address of group policy. */ + groupPolicyAddress: string; + /** + * metadata is any arbitrary metadata attached to the proposal. + * the recommended format of the metadata is to be found here: + * https://docs.cosmos.network/v0.47/modules/group#proposal-4 + */ + metadata: string; + /** proposers are the account addresses of the proposers. */ + proposers: string[]; + /** submit_time is a timestamp specifying when a proposal was submitted. */ + submitTime: Date; + /** + * group_version tracks the version of the group at proposal submission. + * This field is here for informational purposes only. + */ + groupVersion: bigint; + /** + * group_policy_version tracks the version of the group policy at proposal submission. + * When a decision policy is changed, existing proposals from previous policy + * versions will become invalid with the `ABORTED` status. + * This field is here for informational purposes only. + */ + groupPolicyVersion: bigint; + /** status represents the high level position in the life cycle of the proposal. Initial value is Submitted. */ + status: ProposalStatus; + /** + * final_tally_result contains the sums of all weighted votes for this + * proposal for each vote option. It is empty at submission, and only + * populated after tallying, at voting period end or at proposal execution, + * whichever happens first. + */ + finalTallyResult: TallyResult; + /** + * voting_period_end is the timestamp before which voting must be done. + * Unless a successful MsgExec is called before (to execute a proposal whose + * tally is successful before the voting period ends), tallying will be done + * at this point, and the `final_tally_result`and `status` fields will be + * accordingly updated. + */ + votingPeriodEnd: Date; + /** executor_result is the final result of the proposal execution. Initial value is NotRun. */ + executorResult: ProposalExecutorResult; + /** messages is a list of `sdk.Msg`s that will be executed if the proposal passes. */ + messages: Any[]; + /** + * title is the title of the proposal + * + * Since: cosmos-sdk 0.47 + */ + title: string; + /** + * summary is a short summary of the proposal + * + * Since: cosmos-sdk 0.47 + */ + summary: string; +} +export interface ProposalProtoMsg { + typeUrl: "/cosmos.group.v1.Proposal"; + value: Uint8Array; +} +/** + * Proposal defines a group proposal. Any member of a group can submit a proposal + * for a group policy to decide upon. + * A proposal consists of a set of `sdk.Msg`s that will be executed if the proposal + * passes as well as some optional metadata associated with the proposal. + */ +export interface ProposalAmino { + /** id is the unique id of the proposal. */ + id: string; + /** group_policy_address is the account address of group policy. */ + group_policy_address: string; + /** + * metadata is any arbitrary metadata attached to the proposal. + * the recommended format of the metadata is to be found here: + * https://docs.cosmos.network/v0.47/modules/group#proposal-4 + */ + metadata: string; + /** proposers are the account addresses of the proposers. */ + proposers: string[]; + /** submit_time is a timestamp specifying when a proposal was submitted. */ + submit_time: string; + /** + * group_version tracks the version of the group at proposal submission. + * This field is here for informational purposes only. + */ + group_version: string; + /** + * group_policy_version tracks the version of the group policy at proposal submission. + * When a decision policy is changed, existing proposals from previous policy + * versions will become invalid with the `ABORTED` status. + * This field is here for informational purposes only. + */ + group_policy_version: string; + /** status represents the high level position in the life cycle of the proposal. Initial value is Submitted. */ + status: ProposalStatus; + /** + * final_tally_result contains the sums of all weighted votes for this + * proposal for each vote option. It is empty at submission, and only + * populated after tallying, at voting period end or at proposal execution, + * whichever happens first. + */ + final_tally_result: TallyResultAmino; + /** + * voting_period_end is the timestamp before which voting must be done. + * Unless a successful MsgExec is called before (to execute a proposal whose + * tally is successful before the voting period ends), tallying will be done + * at this point, and the `final_tally_result`and `status` fields will be + * accordingly updated. + */ + voting_period_end: string; + /** executor_result is the final result of the proposal execution. Initial value is NotRun. */ + executor_result: ProposalExecutorResult; + /** messages is a list of `sdk.Msg`s that will be executed if the proposal passes. */ + messages: AnyAmino[]; + /** + * title is the title of the proposal + * + * Since: cosmos-sdk 0.47 + */ + title: string; + /** + * summary is a short summary of the proposal + * + * Since: cosmos-sdk 0.47 + */ + summary: string; +} +export interface ProposalAminoMsg { + type: "cosmos-sdk/Proposal"; + value: ProposalAmino; +} +/** TallyResult represents the sum of weighted votes for each vote option. */ +export interface TallyResult { + /** yes_count is the weighted sum of yes votes. */ + yesCount: string; + /** abstain_count is the weighted sum of abstainers. */ + abstainCount: string; + /** no_count is the weighted sum of no votes. */ + noCount: string; + /** no_with_veto_count is the weighted sum of veto. */ + noWithVetoCount: string; +} +export interface TallyResultProtoMsg { + typeUrl: "/cosmos.group.v1.TallyResult"; + value: Uint8Array; +} +/** TallyResult represents the sum of weighted votes for each vote option. */ +export interface TallyResultAmino { + /** yes_count is the weighted sum of yes votes. */ + yes_count: string; + /** abstain_count is the weighted sum of abstainers. */ + abstain_count: string; + /** no_count is the weighted sum of no votes. */ + no_count: string; + /** no_with_veto_count is the weighted sum of veto. */ + no_with_veto_count: string; +} +export interface TallyResultAminoMsg { + type: "cosmos-sdk/TallyResult"; + value: TallyResultAmino; +} +/** Vote represents a vote for a proposal.string metadata */ +export interface Vote { + /** proposal is the unique ID of the proposal. */ + proposalId: bigint; + /** voter is the account address of the voter. */ + voter: string; + /** option is the voter's choice on the proposal. */ + option: VoteOption; + /** + * metadata is any arbitrary metadata attached to the vote. + * the recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/group#vote-2 + */ + metadata: string; + /** submit_time is the timestamp when the vote was submitted. */ + submitTime: Date; +} +export interface VoteProtoMsg { + typeUrl: "/cosmos.group.v1.Vote"; + value: Uint8Array; +} +/** Vote represents a vote for a proposal.string metadata */ +export interface VoteAmino { + /** proposal is the unique ID of the proposal. */ + proposal_id: string; + /** voter is the account address of the voter. */ + voter: string; + /** option is the voter's choice on the proposal. */ + option: VoteOption; + /** + * metadata is any arbitrary metadata attached to the vote. + * the recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/group#vote-2 + */ + metadata: string; + /** submit_time is the timestamp when the vote was submitted. */ + submit_time: string; +} +export interface VoteAminoMsg { + type: "cosmos-sdk/Vote"; + value: VoteAmino; +} +function createBaseMember(): Member { + return { + address: "", + weight: "", + metadata: "", + addedAt: new Date() + }; +} +export const Member = { + typeUrl: "/cosmos.group.v1.Member", + aminoType: "cosmos-sdk/Member", + is(o: any): o is Member { + return o && (o.$typeUrl === Member.typeUrl || typeof o.address === "string" && typeof o.weight === "string" && typeof o.metadata === "string" && Timestamp.is(o.addedAt)); + }, + isAmino(o: any): o is MemberAmino { + return o && (o.$typeUrl === Member.typeUrl || typeof o.address === "string" && typeof o.weight === "string" && typeof o.metadata === "string" && Timestamp.isAmino(o.added_at)); + }, + encode(message: Member, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.weight !== "") { + writer.uint32(18).string(message.weight); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + if (message.addedAt !== undefined) { + Timestamp.encode(toTimestamp(message.addedAt), writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Member { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMember(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.weight = reader.string(); + break; + case 3: + message.metadata = reader.string(); + break; + case 4: + message.addedAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Member { + const message = createBaseMember(); + message.address = object.address ?? ""; + message.weight = object.weight ?? ""; + message.metadata = object.metadata ?? ""; + message.addedAt = object.addedAt ?? undefined; + return message; + }, + fromAmino(object: MemberAmino): Member { + const message = createBaseMember(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.weight !== undefined && object.weight !== null) { + message.weight = object.weight; + } + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + if (object.added_at !== undefined && object.added_at !== null) { + message.addedAt = fromTimestamp(Timestamp.fromAmino(object.added_at)); + } + return message; + }, + toAmino(message: Member): MemberAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + obj.weight = message.weight === "" ? undefined : message.weight; + obj.metadata = message.metadata === "" ? undefined : message.metadata; + obj.added_at = message.addedAt ? Timestamp.toAmino(toTimestamp(message.addedAt)) : new Date(); + return obj; + }, + fromAminoMsg(object: MemberAminoMsg): Member { + return Member.fromAmino(object.value); + }, + toAminoMsg(message: Member): MemberAminoMsg { + return { + type: "cosmos-sdk/Member", + value: Member.toAmino(message) + }; + }, + fromProtoMsg(message: MemberProtoMsg): Member { + return Member.decode(message.value); + }, + toProto(message: Member): Uint8Array { + return Member.encode(message).finish(); + }, + toProtoMsg(message: Member): MemberProtoMsg { + return { + typeUrl: "/cosmos.group.v1.Member", + value: Member.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Member.typeUrl, Member); +GlobalDecoderRegistry.registerAminoProtoMapping(Member.aminoType, Member.typeUrl); +function createBaseMemberRequest(): MemberRequest { + return { + address: "", + weight: "", + metadata: "" + }; +} +export const MemberRequest = { + typeUrl: "/cosmos.group.v1.MemberRequest", + aminoType: "cosmos-sdk/MemberRequest", + is(o: any): o is MemberRequest { + return o && (o.$typeUrl === MemberRequest.typeUrl || typeof o.address === "string" && typeof o.weight === "string" && typeof o.metadata === "string"); + }, + isAmino(o: any): o is MemberRequestAmino { + return o && (o.$typeUrl === MemberRequest.typeUrl || typeof o.address === "string" && typeof o.weight === "string" && typeof o.metadata === "string"); + }, + encode(message: MemberRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.weight !== "") { + writer.uint32(18).string(message.weight); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MemberRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMemberRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.weight = reader.string(); + break; + case 3: + message.metadata = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MemberRequest { + const message = createBaseMemberRequest(); + message.address = object.address ?? ""; + message.weight = object.weight ?? ""; + message.metadata = object.metadata ?? ""; + return message; + }, + fromAmino(object: MemberRequestAmino): MemberRequest { + const message = createBaseMemberRequest(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.weight !== undefined && object.weight !== null) { + message.weight = object.weight; + } + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + return message; + }, + toAmino(message: MemberRequest): MemberRequestAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + obj.weight = message.weight === "" ? undefined : message.weight; + obj.metadata = message.metadata === "" ? undefined : message.metadata; + return obj; + }, + fromAminoMsg(object: MemberRequestAminoMsg): MemberRequest { + return MemberRequest.fromAmino(object.value); + }, + toAminoMsg(message: MemberRequest): MemberRequestAminoMsg { + return { + type: "cosmos-sdk/MemberRequest", + value: MemberRequest.toAmino(message) + }; + }, + fromProtoMsg(message: MemberRequestProtoMsg): MemberRequest { + return MemberRequest.decode(message.value); + }, + toProto(message: MemberRequest): Uint8Array { + return MemberRequest.encode(message).finish(); + }, + toProtoMsg(message: MemberRequest): MemberRequestProtoMsg { + return { + typeUrl: "/cosmos.group.v1.MemberRequest", + value: MemberRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MemberRequest.typeUrl, MemberRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(MemberRequest.aminoType, MemberRequest.typeUrl); +function createBaseThresholdDecisionPolicy(): ThresholdDecisionPolicy { + return { + threshold: "", + windows: undefined + }; +} +export const ThresholdDecisionPolicy = { + typeUrl: "/cosmos.group.v1.ThresholdDecisionPolicy", + aminoType: "cosmos-sdk/ThresholdDecisionPolicy", + is(o: any): o is ThresholdDecisionPolicy { + return o && (o.$typeUrl === ThresholdDecisionPolicy.typeUrl || typeof o.threshold === "string"); + }, + isAmino(o: any): o is ThresholdDecisionPolicyAmino { + return o && (o.$typeUrl === ThresholdDecisionPolicy.typeUrl || typeof o.threshold === "string"); + }, + encode(message: ThresholdDecisionPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.threshold !== "") { + writer.uint32(10).string(message.threshold); + } + if (message.windows !== undefined) { + DecisionPolicyWindows.encode(message.windows, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ThresholdDecisionPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseThresholdDecisionPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.threshold = reader.string(); + break; + case 2: + message.windows = DecisionPolicyWindows.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ThresholdDecisionPolicy { + const message = createBaseThresholdDecisionPolicy(); + message.threshold = object.threshold ?? ""; + message.windows = object.windows !== undefined && object.windows !== null ? DecisionPolicyWindows.fromPartial(object.windows) : undefined; + return message; + }, + fromAmino(object: ThresholdDecisionPolicyAmino): ThresholdDecisionPolicy { + const message = createBaseThresholdDecisionPolicy(); + if (object.threshold !== undefined && object.threshold !== null) { + message.threshold = object.threshold; + } + if (object.windows !== undefined && object.windows !== null) { + message.windows = DecisionPolicyWindows.fromAmino(object.windows); + } + return message; + }, + toAmino(message: ThresholdDecisionPolicy): ThresholdDecisionPolicyAmino { + const obj: any = {}; + obj.threshold = message.threshold === "" ? undefined : message.threshold; + obj.windows = message.windows ? DecisionPolicyWindows.toAmino(message.windows) : undefined; + return obj; + }, + fromAminoMsg(object: ThresholdDecisionPolicyAminoMsg): ThresholdDecisionPolicy { + return ThresholdDecisionPolicy.fromAmino(object.value); + }, + toAminoMsg(message: ThresholdDecisionPolicy): ThresholdDecisionPolicyAminoMsg { + return { + type: "cosmos-sdk/ThresholdDecisionPolicy", + value: ThresholdDecisionPolicy.toAmino(message) + }; + }, + fromProtoMsg(message: ThresholdDecisionPolicyProtoMsg): ThresholdDecisionPolicy { + return ThresholdDecisionPolicy.decode(message.value); + }, + toProto(message: ThresholdDecisionPolicy): Uint8Array { + return ThresholdDecisionPolicy.encode(message).finish(); + }, + toProtoMsg(message: ThresholdDecisionPolicy): ThresholdDecisionPolicyProtoMsg { + return { + typeUrl: "/cosmos.group.v1.ThresholdDecisionPolicy", + value: ThresholdDecisionPolicy.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ThresholdDecisionPolicy.typeUrl, ThresholdDecisionPolicy); +GlobalDecoderRegistry.registerAminoProtoMapping(ThresholdDecisionPolicy.aminoType, ThresholdDecisionPolicy.typeUrl); +function createBasePercentageDecisionPolicy(): PercentageDecisionPolicy { + return { + percentage: "", + windows: undefined + }; +} +export const PercentageDecisionPolicy = { + typeUrl: "/cosmos.group.v1.PercentageDecisionPolicy", + aminoType: "cosmos-sdk/PercentageDecisionPolicy", + is(o: any): o is PercentageDecisionPolicy { + return o && (o.$typeUrl === PercentageDecisionPolicy.typeUrl || typeof o.percentage === "string"); + }, + isAmino(o: any): o is PercentageDecisionPolicyAmino { + return o && (o.$typeUrl === PercentageDecisionPolicy.typeUrl || typeof o.percentage === "string"); + }, + encode(message: PercentageDecisionPolicy, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.percentage !== "") { + writer.uint32(10).string(message.percentage); + } + if (message.windows !== undefined) { + DecisionPolicyWindows.encode(message.windows, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PercentageDecisionPolicy { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePercentageDecisionPolicy(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.percentage = reader.string(); + break; + case 2: + message.windows = DecisionPolicyWindows.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): PercentageDecisionPolicy { + const message = createBasePercentageDecisionPolicy(); + message.percentage = object.percentage ?? ""; + message.windows = object.windows !== undefined && object.windows !== null ? DecisionPolicyWindows.fromPartial(object.windows) : undefined; + return message; + }, + fromAmino(object: PercentageDecisionPolicyAmino): PercentageDecisionPolicy { + const message = createBasePercentageDecisionPolicy(); + if (object.percentage !== undefined && object.percentage !== null) { + message.percentage = object.percentage; + } + if (object.windows !== undefined && object.windows !== null) { + message.windows = DecisionPolicyWindows.fromAmino(object.windows); + } + return message; + }, + toAmino(message: PercentageDecisionPolicy): PercentageDecisionPolicyAmino { + const obj: any = {}; + obj.percentage = message.percentage === "" ? undefined : message.percentage; + obj.windows = message.windows ? DecisionPolicyWindows.toAmino(message.windows) : undefined; + return obj; + }, + fromAminoMsg(object: PercentageDecisionPolicyAminoMsg): PercentageDecisionPolicy { + return PercentageDecisionPolicy.fromAmino(object.value); + }, + toAminoMsg(message: PercentageDecisionPolicy): PercentageDecisionPolicyAminoMsg { + return { + type: "cosmos-sdk/PercentageDecisionPolicy", + value: PercentageDecisionPolicy.toAmino(message) + }; + }, + fromProtoMsg(message: PercentageDecisionPolicyProtoMsg): PercentageDecisionPolicy { + return PercentageDecisionPolicy.decode(message.value); + }, + toProto(message: PercentageDecisionPolicy): Uint8Array { + return PercentageDecisionPolicy.encode(message).finish(); + }, + toProtoMsg(message: PercentageDecisionPolicy): PercentageDecisionPolicyProtoMsg { + return { + typeUrl: "/cosmos.group.v1.PercentageDecisionPolicy", + value: PercentageDecisionPolicy.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(PercentageDecisionPolicy.typeUrl, PercentageDecisionPolicy); +GlobalDecoderRegistry.registerAminoProtoMapping(PercentageDecisionPolicy.aminoType, PercentageDecisionPolicy.typeUrl); +function createBaseDecisionPolicyWindows(): DecisionPolicyWindows { + return { + votingPeriod: Duration.fromPartial({}), + minExecutionPeriod: Duration.fromPartial({}) + }; +} +export const DecisionPolicyWindows = { + typeUrl: "/cosmos.group.v1.DecisionPolicyWindows", + aminoType: "cosmos-sdk/DecisionPolicyWindows", + is(o: any): o is DecisionPolicyWindows { + return o && (o.$typeUrl === DecisionPolicyWindows.typeUrl || Duration.is(o.votingPeriod) && Duration.is(o.minExecutionPeriod)); + }, + isAmino(o: any): o is DecisionPolicyWindowsAmino { + return o && (o.$typeUrl === DecisionPolicyWindows.typeUrl || Duration.isAmino(o.voting_period) && Duration.isAmino(o.min_execution_period)); + }, + encode(message: DecisionPolicyWindows, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.votingPeriod !== undefined) { + Duration.encode(message.votingPeriod, writer.uint32(10).fork()).ldelim(); + } + if (message.minExecutionPeriod !== undefined) { + Duration.encode(message.minExecutionPeriod, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DecisionPolicyWindows { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDecisionPolicyWindows(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.votingPeriod = Duration.decode(reader, reader.uint32()); + break; + case 2: + message.minExecutionPeriod = Duration.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): DecisionPolicyWindows { + const message = createBaseDecisionPolicyWindows(); + message.votingPeriod = object.votingPeriod !== undefined && object.votingPeriod !== null ? Duration.fromPartial(object.votingPeriod) : undefined; + message.minExecutionPeriod = object.minExecutionPeriod !== undefined && object.minExecutionPeriod !== null ? Duration.fromPartial(object.minExecutionPeriod) : undefined; + return message; + }, + fromAmino(object: DecisionPolicyWindowsAmino): DecisionPolicyWindows { + const message = createBaseDecisionPolicyWindows(); + if (object.voting_period !== undefined && object.voting_period !== null) { + message.votingPeriod = Duration.fromAmino(object.voting_period); + } + if (object.min_execution_period !== undefined && object.min_execution_period !== null) { + message.minExecutionPeriod = Duration.fromAmino(object.min_execution_period); + } + return message; + }, + toAmino(message: DecisionPolicyWindows): DecisionPolicyWindowsAmino { + const obj: any = {}; + obj.voting_period = message.votingPeriod ? Duration.toAmino(message.votingPeriod) : Duration.toAmino(Duration.fromPartial({})); + obj.min_execution_period = message.minExecutionPeriod ? Duration.toAmino(message.minExecutionPeriod) : Duration.toAmino(Duration.fromPartial({})); + return obj; + }, + fromAminoMsg(object: DecisionPolicyWindowsAminoMsg): DecisionPolicyWindows { + return DecisionPolicyWindows.fromAmino(object.value); + }, + toAminoMsg(message: DecisionPolicyWindows): DecisionPolicyWindowsAminoMsg { + return { + type: "cosmos-sdk/DecisionPolicyWindows", + value: DecisionPolicyWindows.toAmino(message) + }; + }, + fromProtoMsg(message: DecisionPolicyWindowsProtoMsg): DecisionPolicyWindows { + return DecisionPolicyWindows.decode(message.value); + }, + toProto(message: DecisionPolicyWindows): Uint8Array { + return DecisionPolicyWindows.encode(message).finish(); + }, + toProtoMsg(message: DecisionPolicyWindows): DecisionPolicyWindowsProtoMsg { + return { + typeUrl: "/cosmos.group.v1.DecisionPolicyWindows", + value: DecisionPolicyWindows.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(DecisionPolicyWindows.typeUrl, DecisionPolicyWindows); +GlobalDecoderRegistry.registerAminoProtoMapping(DecisionPolicyWindows.aminoType, DecisionPolicyWindows.typeUrl); +function createBaseGroupInfo(): GroupInfo { + return { + id: BigInt(0), + admin: "", + metadata: "", + version: BigInt(0), + totalWeight: "", + createdAt: new Date() + }; +} +export const GroupInfo = { + typeUrl: "/cosmos.group.v1.GroupInfo", + aminoType: "cosmos-sdk/GroupInfo", + is(o: any): o is GroupInfo { + return o && (o.$typeUrl === GroupInfo.typeUrl || typeof o.id === "bigint" && typeof o.admin === "string" && typeof o.metadata === "string" && typeof o.version === "bigint" && typeof o.totalWeight === "string" && Timestamp.is(o.createdAt)); + }, + isAmino(o: any): o is GroupInfoAmino { + return o && (o.$typeUrl === GroupInfo.typeUrl || typeof o.id === "bigint" && typeof o.admin === "string" && typeof o.metadata === "string" && typeof o.version === "bigint" && typeof o.total_weight === "string" && Timestamp.isAmino(o.created_at)); + }, + encode(message: GroupInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.id !== BigInt(0)) { + writer.uint32(8).uint64(message.id); + } + if (message.admin !== "") { + writer.uint32(18).string(message.admin); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + if (message.version !== BigInt(0)) { + writer.uint32(32).uint64(message.version); + } + if (message.totalWeight !== "") { + writer.uint32(42).string(message.totalWeight); + } + if (message.createdAt !== undefined) { + Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(50).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GroupInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGroupInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.uint64(); + break; + case 2: + message.admin = reader.string(); + break; + case 3: + message.metadata = reader.string(); + break; + case 4: + message.version = reader.uint64(); + break; + case 5: + message.totalWeight = reader.string(); + break; + case 6: + message.createdAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): GroupInfo { + const message = createBaseGroupInfo(); + message.id = object.id !== undefined && object.id !== null ? BigInt(object.id.toString()) : BigInt(0); + message.admin = object.admin ?? ""; + message.metadata = object.metadata ?? ""; + message.version = object.version !== undefined && object.version !== null ? BigInt(object.version.toString()) : BigInt(0); + message.totalWeight = object.totalWeight ?? ""; + message.createdAt = object.createdAt ?? undefined; + return message; + }, + fromAmino(object: GroupInfoAmino): GroupInfo { + const message = createBaseGroupInfo(); + if (object.id !== undefined && object.id !== null) { + message.id = BigInt(object.id); + } + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + if (object.version !== undefined && object.version !== null) { + message.version = BigInt(object.version); + } + if (object.total_weight !== undefined && object.total_weight !== null) { + message.totalWeight = object.total_weight; + } + if (object.created_at !== undefined && object.created_at !== null) { + message.createdAt = fromTimestamp(Timestamp.fromAmino(object.created_at)); + } + return message; + }, + toAmino(message: GroupInfo): GroupInfoAmino { + const obj: any = {}; + obj.id = message.id !== BigInt(0) ? message.id?.toString() : undefined; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.metadata = message.metadata === "" ? undefined : message.metadata; + obj.version = message.version !== BigInt(0) ? message.version?.toString() : undefined; + obj.total_weight = message.totalWeight === "" ? undefined : message.totalWeight; + obj.created_at = message.createdAt ? Timestamp.toAmino(toTimestamp(message.createdAt)) : new Date(); + return obj; + }, + fromAminoMsg(object: GroupInfoAminoMsg): GroupInfo { + return GroupInfo.fromAmino(object.value); + }, + toAminoMsg(message: GroupInfo): GroupInfoAminoMsg { + return { + type: "cosmos-sdk/GroupInfo", + value: GroupInfo.toAmino(message) + }; + }, + fromProtoMsg(message: GroupInfoProtoMsg): GroupInfo { + return GroupInfo.decode(message.value); + }, + toProto(message: GroupInfo): Uint8Array { + return GroupInfo.encode(message).finish(); + }, + toProtoMsg(message: GroupInfo): GroupInfoProtoMsg { + return { + typeUrl: "/cosmos.group.v1.GroupInfo", + value: GroupInfo.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(GroupInfo.typeUrl, GroupInfo); +GlobalDecoderRegistry.registerAminoProtoMapping(GroupInfo.aminoType, GroupInfo.typeUrl); +function createBaseGroupMember(): GroupMember { + return { + groupId: BigInt(0), + member: undefined + }; +} +export const GroupMember = { + typeUrl: "/cosmos.group.v1.GroupMember", + aminoType: "cosmos-sdk/GroupMember", + is(o: any): o is GroupMember { + return o && (o.$typeUrl === GroupMember.typeUrl || typeof o.groupId === "bigint"); + }, + isAmino(o: any): o is GroupMemberAmino { + return o && (o.$typeUrl === GroupMember.typeUrl || typeof o.group_id === "bigint"); + }, + encode(message: GroupMember, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.groupId !== BigInt(0)) { + writer.uint32(8).uint64(message.groupId); + } + if (message.member !== undefined) { + Member.encode(message.member, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GroupMember { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGroupMember(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.groupId = reader.uint64(); + break; + case 2: + message.member = Member.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): GroupMember { + const message = createBaseGroupMember(); + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); + message.member = object.member !== undefined && object.member !== null ? Member.fromPartial(object.member) : undefined; + return message; + }, + fromAmino(object: GroupMemberAmino): GroupMember { + const message = createBaseGroupMember(); + if (object.group_id !== undefined && object.group_id !== null) { + message.groupId = BigInt(object.group_id); + } + if (object.member !== undefined && object.member !== null) { + message.member = Member.fromAmino(object.member); + } + return message; + }, + toAmino(message: GroupMember): GroupMemberAmino { + const obj: any = {}; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId?.toString() : undefined; + obj.member = message.member ? Member.toAmino(message.member) : undefined; + return obj; + }, + fromAminoMsg(object: GroupMemberAminoMsg): GroupMember { + return GroupMember.fromAmino(object.value); + }, + toAminoMsg(message: GroupMember): GroupMemberAminoMsg { + return { + type: "cosmos-sdk/GroupMember", + value: GroupMember.toAmino(message) + }; + }, + fromProtoMsg(message: GroupMemberProtoMsg): GroupMember { + return GroupMember.decode(message.value); + }, + toProto(message: GroupMember): Uint8Array { + return GroupMember.encode(message).finish(); + }, + toProtoMsg(message: GroupMember): GroupMemberProtoMsg { + return { + typeUrl: "/cosmos.group.v1.GroupMember", + value: GroupMember.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(GroupMember.typeUrl, GroupMember); +GlobalDecoderRegistry.registerAminoProtoMapping(GroupMember.aminoType, GroupMember.typeUrl); +function createBaseGroupPolicyInfo(): GroupPolicyInfo { + return { + address: "", + groupId: BigInt(0), + admin: "", + metadata: "", + version: BigInt(0), + decisionPolicy: undefined, + createdAt: new Date() + }; +} +export const GroupPolicyInfo = { + typeUrl: "/cosmos.group.v1.GroupPolicyInfo", + aminoType: "cosmos-sdk/GroupPolicyInfo", + is(o: any): o is GroupPolicyInfo { + return o && (o.$typeUrl === GroupPolicyInfo.typeUrl || typeof o.address === "string" && typeof o.groupId === "bigint" && typeof o.admin === "string" && typeof o.metadata === "string" && typeof o.version === "bigint" && Timestamp.is(o.createdAt)); + }, + isAmino(o: any): o is GroupPolicyInfoAmino { + return o && (o.$typeUrl === GroupPolicyInfo.typeUrl || typeof o.address === "string" && typeof o.group_id === "bigint" && typeof o.admin === "string" && typeof o.metadata === "string" && typeof o.version === "bigint" && Timestamp.isAmino(o.created_at)); + }, + encode(message: GroupPolicyInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.groupId !== BigInt(0)) { + writer.uint32(16).uint64(message.groupId); + } + if (message.admin !== "") { + writer.uint32(26).string(message.admin); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + if (message.version !== BigInt(0)) { + writer.uint32(40).uint64(message.version); + } + if (message.decisionPolicy !== undefined) { + Any.encode(GlobalDecoderRegistry.wrapAny(message.decisionPolicy), writer.uint32(50).fork()).ldelim(); + } + if (message.createdAt !== undefined) { + Timestamp.encode(toTimestamp(message.createdAt), writer.uint32(58).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GroupPolicyInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGroupPolicyInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.groupId = reader.uint64(); + break; + case 3: + message.admin = reader.string(); + break; + case 4: + message.metadata = reader.string(); + break; + case 5: + message.version = reader.uint64(); + break; + case 6: + message.decisionPolicy = GlobalDecoderRegistry.unwrapAny(reader); + break; + case 7: + message.createdAt = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): GroupPolicyInfo { + const message = createBaseGroupPolicyInfo(); + message.address = object.address ?? ""; + message.groupId = object.groupId !== undefined && object.groupId !== null ? BigInt(object.groupId.toString()) : BigInt(0); + message.admin = object.admin ?? ""; + message.metadata = object.metadata ?? ""; + message.version = object.version !== undefined && object.version !== null ? BigInt(object.version.toString()) : BigInt(0); + message.decisionPolicy = object.decisionPolicy !== undefined && object.decisionPolicy !== null ? GlobalDecoderRegistry.fromPartial(object.decisionPolicy) : undefined; + message.createdAt = object.createdAt ?? undefined; + return message; + }, + fromAmino(object: GroupPolicyInfoAmino): GroupPolicyInfo { + const message = createBaseGroupPolicyInfo(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.group_id !== undefined && object.group_id !== null) { + message.groupId = BigInt(object.group_id); + } + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + if (object.version !== undefined && object.version !== null) { + message.version = BigInt(object.version); + } + if (object.decision_policy !== undefined && object.decision_policy !== null) { + message.decisionPolicy = GlobalDecoderRegistry.fromAminoMsg(object.decision_policy); + } + if (object.created_at !== undefined && object.created_at !== null) { + message.createdAt = fromTimestamp(Timestamp.fromAmino(object.created_at)); + } + return message; + }, + toAmino(message: GroupPolicyInfo): GroupPolicyInfoAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId?.toString() : undefined; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.metadata = message.metadata === "" ? undefined : message.metadata; + obj.version = message.version !== BigInt(0) ? message.version?.toString() : undefined; + obj.decision_policy = message.decisionPolicy ? GlobalDecoderRegistry.toAminoMsg(message.decisionPolicy) : undefined; + obj.created_at = message.createdAt ? Timestamp.toAmino(toTimestamp(message.createdAt)) : new Date(); + return obj; + }, + fromAminoMsg(object: GroupPolicyInfoAminoMsg): GroupPolicyInfo { + return GroupPolicyInfo.fromAmino(object.value); + }, + toAminoMsg(message: GroupPolicyInfo): GroupPolicyInfoAminoMsg { + return { + type: "cosmos-sdk/GroupPolicyInfo", + value: GroupPolicyInfo.toAmino(message) + }; + }, + fromProtoMsg(message: GroupPolicyInfoProtoMsg): GroupPolicyInfo { + return GroupPolicyInfo.decode(message.value); + }, + toProto(message: GroupPolicyInfo): Uint8Array { + return GroupPolicyInfo.encode(message).finish(); + }, + toProtoMsg(message: GroupPolicyInfo): GroupPolicyInfoProtoMsg { + return { + typeUrl: "/cosmos.group.v1.GroupPolicyInfo", + value: GroupPolicyInfo.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(GroupPolicyInfo.typeUrl, GroupPolicyInfo); +GlobalDecoderRegistry.registerAminoProtoMapping(GroupPolicyInfo.aminoType, GroupPolicyInfo.typeUrl); +function createBaseProposal(): Proposal { + return { + id: BigInt(0), + groupPolicyAddress: "", + metadata: "", + proposers: [], + submitTime: new Date(), + groupVersion: BigInt(0), + groupPolicyVersion: BigInt(0), + status: 0, + finalTallyResult: TallyResult.fromPartial({}), + votingPeriodEnd: new Date(), + executorResult: 0, + messages: [], + title: "", + summary: "" + }; +} +export const Proposal = { + typeUrl: "/cosmos.group.v1.Proposal", + aminoType: "cosmos-sdk/Proposal", + is(o: any): o is Proposal { + return o && (o.$typeUrl === Proposal.typeUrl || typeof o.id === "bigint" && typeof o.groupPolicyAddress === "string" && typeof o.metadata === "string" && Array.isArray(o.proposers) && (!o.proposers.length || typeof o.proposers[0] === "string") && Timestamp.is(o.submitTime) && typeof o.groupVersion === "bigint" && typeof o.groupPolicyVersion === "bigint" && isSet(o.status) && TallyResult.is(o.finalTallyResult) && Timestamp.is(o.votingPeriodEnd) && isSet(o.executorResult) && Array.isArray(o.messages) && (!o.messages.length || Any.is(o.messages[0])) && typeof o.title === "string" && typeof o.summary === "string"); + }, + isAmino(o: any): o is ProposalAmino { + return o && (o.$typeUrl === Proposal.typeUrl || typeof o.id === "bigint" && typeof o.group_policy_address === "string" && typeof o.metadata === "string" && Array.isArray(o.proposers) && (!o.proposers.length || typeof o.proposers[0] === "string") && Timestamp.isAmino(o.submit_time) && typeof o.group_version === "bigint" && typeof o.group_policy_version === "bigint" && isSet(o.status) && TallyResult.isAmino(o.final_tally_result) && Timestamp.isAmino(o.voting_period_end) && isSet(o.executor_result) && Array.isArray(o.messages) && (!o.messages.length || Any.isAmino(o.messages[0])) && typeof o.title === "string" && typeof o.summary === "string"); + }, + encode(message: Proposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.id !== BigInt(0)) { + writer.uint32(8).uint64(message.id); + } + if (message.groupPolicyAddress !== "") { + writer.uint32(18).string(message.groupPolicyAddress); + } + if (message.metadata !== "") { + writer.uint32(26).string(message.metadata); + } + for (const v of message.proposers) { + writer.uint32(34).string(v!); + } + if (message.submitTime !== undefined) { + Timestamp.encode(toTimestamp(message.submitTime), writer.uint32(42).fork()).ldelim(); + } + if (message.groupVersion !== BigInt(0)) { + writer.uint32(48).uint64(message.groupVersion); + } + if (message.groupPolicyVersion !== BigInt(0)) { + writer.uint32(56).uint64(message.groupPolicyVersion); + } + if (message.status !== 0) { + writer.uint32(64).int32(message.status); + } + if (message.finalTallyResult !== undefined) { + TallyResult.encode(message.finalTallyResult, writer.uint32(74).fork()).ldelim(); + } + if (message.votingPeriodEnd !== undefined) { + Timestamp.encode(toTimestamp(message.votingPeriodEnd), writer.uint32(82).fork()).ldelim(); + } + if (message.executorResult !== 0) { + writer.uint32(88).int32(message.executorResult); + } + for (const v of message.messages) { + Any.encode(v!, writer.uint32(98).fork()).ldelim(); + } + if (message.title !== "") { + writer.uint32(106).string(message.title); + } + if (message.summary !== "") { + writer.uint32(114).string(message.summary); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Proposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.uint64(); + break; + case 2: + message.groupPolicyAddress = reader.string(); + break; + case 3: + message.metadata = reader.string(); + break; + case 4: + message.proposers.push(reader.string()); + break; + case 5: + message.submitTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 6: + message.groupVersion = reader.uint64(); + break; + case 7: + message.groupPolicyVersion = reader.uint64(); + break; + case 8: + message.status = (reader.int32() as any); + break; + case 9: + message.finalTallyResult = TallyResult.decode(reader, reader.uint32()); + break; + case 10: + message.votingPeriodEnd = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 11: + message.executorResult = (reader.int32() as any); + break; + case 12: + message.messages.push(Any.decode(reader, reader.uint32())); + break; + case 13: + message.title = reader.string(); + break; + case 14: + message.summary = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Proposal { + const message = createBaseProposal(); + message.id = object.id !== undefined && object.id !== null ? BigInt(object.id.toString()) : BigInt(0); + message.groupPolicyAddress = object.groupPolicyAddress ?? ""; + message.metadata = object.metadata ?? ""; + message.proposers = object.proposers?.map(e => e) || []; + message.submitTime = object.submitTime ?? undefined; + message.groupVersion = object.groupVersion !== undefined && object.groupVersion !== null ? BigInt(object.groupVersion.toString()) : BigInt(0); + message.groupPolicyVersion = object.groupPolicyVersion !== undefined && object.groupPolicyVersion !== null ? BigInt(object.groupPolicyVersion.toString()) : BigInt(0); + message.status = object.status ?? 0; + message.finalTallyResult = object.finalTallyResult !== undefined && object.finalTallyResult !== null ? TallyResult.fromPartial(object.finalTallyResult) : undefined; + message.votingPeriodEnd = object.votingPeriodEnd ?? undefined; + message.executorResult = object.executorResult ?? 0; + message.messages = object.messages?.map(e => Any.fromPartial(e)) || []; + message.title = object.title ?? ""; + message.summary = object.summary ?? ""; + return message; + }, + fromAmino(object: ProposalAmino): Proposal { + const message = createBaseProposal(); + if (object.id !== undefined && object.id !== null) { + message.id = BigInt(object.id); + } + if (object.group_policy_address !== undefined && object.group_policy_address !== null) { + message.groupPolicyAddress = object.group_policy_address; + } + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + message.proposers = object.proposers?.map(e => e) || []; + if (object.submit_time !== undefined && object.submit_time !== null) { + message.submitTime = fromTimestamp(Timestamp.fromAmino(object.submit_time)); + } + if (object.group_version !== undefined && object.group_version !== null) { + message.groupVersion = BigInt(object.group_version); + } + if (object.group_policy_version !== undefined && object.group_policy_version !== null) { + message.groupPolicyVersion = BigInt(object.group_policy_version); + } + if (object.status !== undefined && object.status !== null) { + message.status = object.status; + } + if (object.final_tally_result !== undefined && object.final_tally_result !== null) { + message.finalTallyResult = TallyResult.fromAmino(object.final_tally_result); + } + if (object.voting_period_end !== undefined && object.voting_period_end !== null) { + message.votingPeriodEnd = fromTimestamp(Timestamp.fromAmino(object.voting_period_end)); + } + if (object.executor_result !== undefined && object.executor_result !== null) { + message.executorResult = object.executor_result; + } + message.messages = object.messages?.map(e => Any.fromAmino(e)) || []; + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.summary !== undefined && object.summary !== null) { + message.summary = object.summary; + } + return message; + }, + toAmino(message: Proposal): ProposalAmino { + const obj: any = {}; + obj.id = message.id !== BigInt(0) ? message.id?.toString() : undefined; + obj.group_policy_address = message.groupPolicyAddress === "" ? undefined : message.groupPolicyAddress; + obj.metadata = message.metadata === "" ? undefined : message.metadata; + if (message.proposers) { + obj.proposers = message.proposers.map(e => e); + } else { + obj.proposers = message.proposers; + } + obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : new Date(); + obj.group_version = message.groupVersion !== BigInt(0) ? message.groupVersion?.toString() : undefined; + obj.group_policy_version = message.groupPolicyVersion !== BigInt(0) ? message.groupPolicyVersion?.toString() : undefined; + obj.status = message.status === 0 ? undefined : message.status; + obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : TallyResult.toAmino(TallyResult.fromPartial({})); + obj.voting_period_end = message.votingPeriodEnd ? Timestamp.toAmino(toTimestamp(message.votingPeriodEnd)) : new Date(); + obj.executor_result = message.executorResult === 0 ? undefined : message.executorResult; + if (message.messages) { + obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.messages = message.messages; + } + obj.title = message.title === "" ? undefined : message.title; + obj.summary = message.summary === "" ? undefined : message.summary; + return obj; + }, + fromAminoMsg(object: ProposalAminoMsg): Proposal { + return Proposal.fromAmino(object.value); + }, + toAminoMsg(message: Proposal): ProposalAminoMsg { + return { + type: "cosmos-sdk/Proposal", + value: Proposal.toAmino(message) + }; + }, + fromProtoMsg(message: ProposalProtoMsg): Proposal { + return Proposal.decode(message.value); + }, + toProto(message: Proposal): Uint8Array { + return Proposal.encode(message).finish(); + }, + toProtoMsg(message: Proposal): ProposalProtoMsg { + return { + typeUrl: "/cosmos.group.v1.Proposal", + value: Proposal.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Proposal.typeUrl, Proposal); +GlobalDecoderRegistry.registerAminoProtoMapping(Proposal.aminoType, Proposal.typeUrl); +function createBaseTallyResult(): TallyResult { + return { + yesCount: "", + abstainCount: "", + noCount: "", + noWithVetoCount: "" + }; +} +export const TallyResult = { + typeUrl: "/cosmos.group.v1.TallyResult", + aminoType: "cosmos-sdk/TallyResult", + is(o: any): o is TallyResult { + return o && (o.$typeUrl === TallyResult.typeUrl || typeof o.yesCount === "string" && typeof o.abstainCount === "string" && typeof o.noCount === "string" && typeof o.noWithVetoCount === "string"); + }, + isAmino(o: any): o is TallyResultAmino { + return o && (o.$typeUrl === TallyResult.typeUrl || typeof o.yes_count === "string" && typeof o.abstain_count === "string" && typeof o.no_count === "string" && typeof o.no_with_veto_count === "string"); + }, + encode(message: TallyResult, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.yesCount !== "") { + writer.uint32(10).string(message.yesCount); + } + if (message.abstainCount !== "") { + writer.uint32(18).string(message.abstainCount); + } + if (message.noCount !== "") { + writer.uint32(26).string(message.noCount); + } + if (message.noWithVetoCount !== "") { + writer.uint32(34).string(message.noWithVetoCount); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TallyResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTallyResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.yesCount = reader.string(); + break; + case 2: + message.abstainCount = reader.string(); + break; + case 3: + message.noCount = reader.string(); + break; + case 4: + message.noWithVetoCount = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): TallyResult { + const message = createBaseTallyResult(); + message.yesCount = object.yesCount ?? ""; + message.abstainCount = object.abstainCount ?? ""; + message.noCount = object.noCount ?? ""; + message.noWithVetoCount = object.noWithVetoCount ?? ""; + return message; + }, + fromAmino(object: TallyResultAmino): TallyResult { + const message = createBaseTallyResult(); + if (object.yes_count !== undefined && object.yes_count !== null) { + message.yesCount = object.yes_count; + } + if (object.abstain_count !== undefined && object.abstain_count !== null) { + message.abstainCount = object.abstain_count; + } + if (object.no_count !== undefined && object.no_count !== null) { + message.noCount = object.no_count; + } + if (object.no_with_veto_count !== undefined && object.no_with_veto_count !== null) { + message.noWithVetoCount = object.no_with_veto_count; + } + return message; + }, + toAmino(message: TallyResult): TallyResultAmino { + const obj: any = {}; + obj.yes_count = message.yesCount === "" ? undefined : message.yesCount; + obj.abstain_count = message.abstainCount === "" ? undefined : message.abstainCount; + obj.no_count = message.noCount === "" ? undefined : message.noCount; + obj.no_with_veto_count = message.noWithVetoCount === "" ? undefined : message.noWithVetoCount; + return obj; + }, + fromAminoMsg(object: TallyResultAminoMsg): TallyResult { + return TallyResult.fromAmino(object.value); + }, + toAminoMsg(message: TallyResult): TallyResultAminoMsg { + return { + type: "cosmos-sdk/TallyResult", + value: TallyResult.toAmino(message) + }; + }, + fromProtoMsg(message: TallyResultProtoMsg): TallyResult { + return TallyResult.decode(message.value); + }, + toProto(message: TallyResult): Uint8Array { + return TallyResult.encode(message).finish(); + }, + toProtoMsg(message: TallyResult): TallyResultProtoMsg { + return { + typeUrl: "/cosmos.group.v1.TallyResult", + value: TallyResult.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(TallyResult.typeUrl, TallyResult); +GlobalDecoderRegistry.registerAminoProtoMapping(TallyResult.aminoType, TallyResult.typeUrl); +function createBaseVote(): Vote { + return { + proposalId: BigInt(0), + voter: "", + option: 0, + metadata: "", + submitTime: new Date() + }; +} +export const Vote = { + typeUrl: "/cosmos.group.v1.Vote", + aminoType: "cosmos-sdk/Vote", + is(o: any): o is Vote { + return o && (o.$typeUrl === Vote.typeUrl || typeof o.proposalId === "bigint" && typeof o.voter === "string" && isSet(o.option) && typeof o.metadata === "string" && Timestamp.is(o.submitTime)); + }, + isAmino(o: any): o is VoteAmino { + return o && (o.$typeUrl === Vote.typeUrl || typeof o.proposal_id === "bigint" && typeof o.voter === "string" && isSet(o.option) && typeof o.metadata === "string" && Timestamp.isAmino(o.submit_time)); + }, + encode(message: Vote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.proposalId !== BigInt(0)) { + writer.uint32(8).uint64(message.proposalId); + } + if (message.voter !== "") { + writer.uint32(18).string(message.voter); + } + if (message.option !== 0) { + writer.uint32(24).int32(message.option); + } + if (message.metadata !== "") { + writer.uint32(34).string(message.metadata); + } + if (message.submitTime !== undefined) { + Timestamp.encode(toTimestamp(message.submitTime), writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Vote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proposalId = reader.uint64(); + break; + case 2: + message.voter = reader.string(); + break; + case 3: + message.option = (reader.int32() as any); + break; + case 4: + message.metadata = reader.string(); + break; + case 5: + message.submitTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Vote { + const message = createBaseVote(); + message.proposalId = object.proposalId !== undefined && object.proposalId !== null ? BigInt(object.proposalId.toString()) : BigInt(0); + message.voter = object.voter ?? ""; + message.option = object.option ?? 0; + message.metadata = object.metadata ?? ""; + message.submitTime = object.submitTime ?? undefined; + return message; + }, + fromAmino(object: VoteAmino): Vote { + const message = createBaseVote(); + if (object.proposal_id !== undefined && object.proposal_id !== null) { + message.proposalId = BigInt(object.proposal_id); + } + if (object.voter !== undefined && object.voter !== null) { + message.voter = object.voter; + } + if (object.option !== undefined && object.option !== null) { + message.option = object.option; + } + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = object.metadata; + } + if (object.submit_time !== undefined && object.submit_time !== null) { + message.submitTime = fromTimestamp(Timestamp.fromAmino(object.submit_time)); + } + return message; + }, + toAmino(message: Vote): VoteAmino { + const obj: any = {}; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId?.toString() : undefined; + obj.voter = message.voter === "" ? undefined : message.voter; + obj.option = message.option === 0 ? undefined : message.option; + obj.metadata = message.metadata === "" ? undefined : message.metadata; + obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : new Date(); + return obj; + }, + fromAminoMsg(object: VoteAminoMsg): Vote { + return Vote.fromAmino(object.value); + }, + toAminoMsg(message: Vote): VoteAminoMsg { + return { + type: "cosmos-sdk/Vote", + value: Vote.toAmino(message) + }; + }, + fromProtoMsg(message: VoteProtoMsg): Vote { + return Vote.decode(message.value); + }, + toProto(message: Vote): Uint8Array { + return Vote.encode(message).finish(); + }, + toProtoMsg(message: Vote): VoteProtoMsg { + return { + typeUrl: "/cosmos.group.v1.Vote", + value: Vote.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Vote.typeUrl, Vote); +GlobalDecoderRegistry.registerAminoProtoMapping(Vote.aminoType, Vote.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/ics23/v1/proofs.ts b/libs/interchain-query/src/cosmos/ics23/v1/proofs.ts new file mode 100644 index 00000000..c36d57da --- /dev/null +++ b/libs/interchain-query/src/cosmos/ics23/v1/proofs.ts @@ -0,0 +1,2052 @@ +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes, isSet } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; +export enum HashOp { + /** NO_HASH - NO_HASH is the default if no data passed. Note this is an illegal argument some places. */ + NO_HASH = 0, + SHA256 = 1, + SHA512 = 2, + KECCAK256 = 3, + RIPEMD160 = 4, + /** BITCOIN - ripemd160(sha256(x)) */ + BITCOIN = 5, + SHA512_256 = 6, + BLAKE2B_512 = 7, + BLAKE2S_256 = 8, + BLAKE3 = 9, + UNRECOGNIZED = -1, +} +export const HashOpAmino = HashOp; +export function hashOpFromJSON(object: any): HashOp { + switch (object) { + case 0: + case "NO_HASH": + return HashOp.NO_HASH; + case 1: + case "SHA256": + return HashOp.SHA256; + case 2: + case "SHA512": + return HashOp.SHA512; + case 3: + case "KECCAK256": + return HashOp.KECCAK256; + case 4: + case "RIPEMD160": + return HashOp.RIPEMD160; + case 5: + case "BITCOIN": + return HashOp.BITCOIN; + case 6: + case "SHA512_256": + return HashOp.SHA512_256; + case 7: + case "BLAKE2B_512": + return HashOp.BLAKE2B_512; + case 8: + case "BLAKE2S_256": + return HashOp.BLAKE2S_256; + case 9: + case "BLAKE3": + return HashOp.BLAKE3; + case -1: + case "UNRECOGNIZED": + default: + return HashOp.UNRECOGNIZED; + } +} +export function hashOpToJSON(object: HashOp): string { + switch (object) { + case HashOp.NO_HASH: + return "NO_HASH"; + case HashOp.SHA256: + return "SHA256"; + case HashOp.SHA512: + return "SHA512"; + case HashOp.KECCAK256: + return "KECCAK256"; + case HashOp.RIPEMD160: + return "RIPEMD160"; + case HashOp.BITCOIN: + return "BITCOIN"; + case HashOp.SHA512_256: + return "SHA512_256"; + case HashOp.BLAKE2B_512: + return "BLAKE2B_512"; + case HashOp.BLAKE2S_256: + return "BLAKE2S_256"; + case HashOp.BLAKE3: + return "BLAKE3"; + case HashOp.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** + * LengthOp defines how to process the key and value of the LeafOp + * to include length information. After encoding the length with the given + * algorithm, the length will be prepended to the key and value bytes. + * (Each one with it's own encoded length) + */ +export enum LengthOp { + /** NO_PREFIX - NO_PREFIX don't include any length info */ + NO_PREFIX = 0, + /** VAR_PROTO - VAR_PROTO uses protobuf (and go-amino) varint encoding of the length */ + VAR_PROTO = 1, + /** VAR_RLP - VAR_RLP uses rlp int encoding of the length */ + VAR_RLP = 2, + /** FIXED32_BIG - FIXED32_BIG uses big-endian encoding of the length as a 32 bit integer */ + FIXED32_BIG = 3, + /** FIXED32_LITTLE - FIXED32_LITTLE uses little-endian encoding of the length as a 32 bit integer */ + FIXED32_LITTLE = 4, + /** FIXED64_BIG - FIXED64_BIG uses big-endian encoding of the length as a 64 bit integer */ + FIXED64_BIG = 5, + /** FIXED64_LITTLE - FIXED64_LITTLE uses little-endian encoding of the length as a 64 bit integer */ + FIXED64_LITTLE = 6, + /** REQUIRE_32_BYTES - REQUIRE_32_BYTES is like NONE, but will fail if the input is not exactly 32 bytes (sha256 output) */ + REQUIRE_32_BYTES = 7, + /** REQUIRE_64_BYTES - REQUIRE_64_BYTES is like NONE, but will fail if the input is not exactly 64 bytes (sha512 output) */ + REQUIRE_64_BYTES = 8, + UNRECOGNIZED = -1, +} +export const LengthOpAmino = LengthOp; +export function lengthOpFromJSON(object: any): LengthOp { + switch (object) { + case 0: + case "NO_PREFIX": + return LengthOp.NO_PREFIX; + case 1: + case "VAR_PROTO": + return LengthOp.VAR_PROTO; + case 2: + case "VAR_RLP": + return LengthOp.VAR_RLP; + case 3: + case "FIXED32_BIG": + return LengthOp.FIXED32_BIG; + case 4: + case "FIXED32_LITTLE": + return LengthOp.FIXED32_LITTLE; + case 5: + case "FIXED64_BIG": + return LengthOp.FIXED64_BIG; + case 6: + case "FIXED64_LITTLE": + return LengthOp.FIXED64_LITTLE; + case 7: + case "REQUIRE_32_BYTES": + return LengthOp.REQUIRE_32_BYTES; + case 8: + case "REQUIRE_64_BYTES": + return LengthOp.REQUIRE_64_BYTES; + case -1: + case "UNRECOGNIZED": + default: + return LengthOp.UNRECOGNIZED; + } +} +export function lengthOpToJSON(object: LengthOp): string { + switch (object) { + case LengthOp.NO_PREFIX: + return "NO_PREFIX"; + case LengthOp.VAR_PROTO: + return "VAR_PROTO"; + case LengthOp.VAR_RLP: + return "VAR_RLP"; + case LengthOp.FIXED32_BIG: + return "FIXED32_BIG"; + case LengthOp.FIXED32_LITTLE: + return "FIXED32_LITTLE"; + case LengthOp.FIXED64_BIG: + return "FIXED64_BIG"; + case LengthOp.FIXED64_LITTLE: + return "FIXED64_LITTLE"; + case LengthOp.REQUIRE_32_BYTES: + return "REQUIRE_32_BYTES"; + case LengthOp.REQUIRE_64_BYTES: + return "REQUIRE_64_BYTES"; + case LengthOp.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** + * ExistenceProof takes a key and a value and a set of steps to perform on it. + * The result of peforming all these steps will provide a "root hash", which can + * be compared to the value in a header. + * + * Since it is computationally infeasible to produce a hash collission for any of the used + * cryptographic hash functions, if someone can provide a series of operations to transform + * a given key and value into a root hash that matches some trusted root, these key and values + * must be in the referenced merkle tree. + * + * The only possible issue is maliablity in LeafOp, such as providing extra prefix data, + * which should be controlled by a spec. Eg. with lengthOp as NONE, + * prefix = FOO, key = BAR, value = CHOICE + * and + * prefix = F, key = OOBAR, value = CHOICE + * would produce the same value. + * + * With LengthOp this is tricker but not impossible. Which is why the "leafPrefixEqual" field + * in the ProofSpec is valuable to prevent this mutability. And why all trees should + * length-prefix the data before hashing it. + */ +export interface ExistenceProof { + key: Uint8Array; + value: Uint8Array; + leaf?: LeafOp; + path: InnerOp[]; +} +export interface ExistenceProofProtoMsg { + typeUrl: "/cosmos.ics23.v1.ExistenceProof"; + value: Uint8Array; +} +/** + * ExistenceProof takes a key and a value and a set of steps to perform on it. + * The result of peforming all these steps will provide a "root hash", which can + * be compared to the value in a header. + * + * Since it is computationally infeasible to produce a hash collission for any of the used + * cryptographic hash functions, if someone can provide a series of operations to transform + * a given key and value into a root hash that matches some trusted root, these key and values + * must be in the referenced merkle tree. + * + * The only possible issue is maliablity in LeafOp, such as providing extra prefix data, + * which should be controlled by a spec. Eg. with lengthOp as NONE, + * prefix = FOO, key = BAR, value = CHOICE + * and + * prefix = F, key = OOBAR, value = CHOICE + * would produce the same value. + * + * With LengthOp this is tricker but not impossible. Which is why the "leafPrefixEqual" field + * in the ProofSpec is valuable to prevent this mutability. And why all trees should + * length-prefix the data before hashing it. + */ +export interface ExistenceProofAmino { + key: string; + value: string; + leaf?: LeafOpAmino; + path: InnerOpAmino[]; +} +export interface ExistenceProofAminoMsg { + type: "cosmos-sdk/ExistenceProof"; + value: ExistenceProofAmino; +} +/** + * NonExistenceProof takes a proof of two neighbors, one left of the desired key, + * one right of the desired key. If both proofs are valid AND they are neighbors, + * then there is no valid proof for the given key. + */ +export interface NonExistenceProof { + /** TODO: remove this as unnecessary??? we prove a range */ + key: Uint8Array; + left?: ExistenceProof; + right?: ExistenceProof; +} +export interface NonExistenceProofProtoMsg { + typeUrl: "/cosmos.ics23.v1.NonExistenceProof"; + value: Uint8Array; +} +/** + * NonExistenceProof takes a proof of two neighbors, one left of the desired key, + * one right of the desired key. If both proofs are valid AND they are neighbors, + * then there is no valid proof for the given key. + */ +export interface NonExistenceProofAmino { + /** TODO: remove this as unnecessary??? we prove a range */ + key: string; + left?: ExistenceProofAmino; + right?: ExistenceProofAmino; +} +export interface NonExistenceProofAminoMsg { + type: "cosmos-sdk/NonExistenceProof"; + value: NonExistenceProofAmino; +} +/** CommitmentProof is either an ExistenceProof or a NonExistenceProof, or a Batch of such messages */ +export interface CommitmentProof { + exist?: ExistenceProof; + nonexist?: NonExistenceProof; + batch?: BatchProof; + compressed?: CompressedBatchProof; +} +export interface CommitmentProofProtoMsg { + typeUrl: "/cosmos.ics23.v1.CommitmentProof"; + value: Uint8Array; +} +/** CommitmentProof is either an ExistenceProof or a NonExistenceProof, or a Batch of such messages */ +export interface CommitmentProofAmino { + exist?: ExistenceProofAmino; + nonexist?: NonExistenceProofAmino; + batch?: BatchProofAmino; + compressed?: CompressedBatchProofAmino; +} +export interface CommitmentProofAminoMsg { + type: "cosmos-sdk/CommitmentProof"; + value: CommitmentProofAmino; +} +/** + * LeafOp represents the raw key-value data we wish to prove, and + * must be flexible to represent the internal transformation from + * the original key-value pairs into the basis hash, for many existing + * merkle trees. + * + * key and value are passed in. So that the signature of this operation is: + * leafOp(key, value) -> output + * + * To process this, first prehash the keys and values if needed (ANY means no hash in this case): + * hkey = prehashKey(key) + * hvalue = prehashValue(value) + * + * Then combine the bytes, and hash it + * output = hash(prefix || length(hkey) || hkey || length(hvalue) || hvalue) + */ +export interface LeafOp { + hash: HashOp; + prehashKey: HashOp; + prehashValue: HashOp; + length: LengthOp; + /** + * prefix is a fixed bytes that may optionally be included at the beginning to differentiate + * a leaf node from an inner node. + */ + prefix: Uint8Array; +} +export interface LeafOpProtoMsg { + typeUrl: "/cosmos.ics23.v1.LeafOp"; + value: Uint8Array; +} +/** + * LeafOp represents the raw key-value data we wish to prove, and + * must be flexible to represent the internal transformation from + * the original key-value pairs into the basis hash, for many existing + * merkle trees. + * + * key and value are passed in. So that the signature of this operation is: + * leafOp(key, value) -> output + * + * To process this, first prehash the keys and values if needed (ANY means no hash in this case): + * hkey = prehashKey(key) + * hvalue = prehashValue(value) + * + * Then combine the bytes, and hash it + * output = hash(prefix || length(hkey) || hkey || length(hvalue) || hvalue) + */ +export interface LeafOpAmino { + hash: HashOp; + prehash_key: HashOp; + prehash_value: HashOp; + length: LengthOp; + /** + * prefix is a fixed bytes that may optionally be included at the beginning to differentiate + * a leaf node from an inner node. + */ + prefix: string; +} +export interface LeafOpAminoMsg { + type: "cosmos-sdk/LeafOp"; + value: LeafOpAmino; +} +/** + * InnerOp represents a merkle-proof step that is not a leaf. + * It represents concatenating two children and hashing them to provide the next result. + * + * The result of the previous step is passed in, so the signature of this op is: + * innerOp(child) -> output + * + * The result of applying InnerOp should be: + * output = op.hash(op.prefix || child || op.suffix) + * + * where the || operator is concatenation of binary data, + * and child is the result of hashing all the tree below this step. + * + * Any special data, like prepending child with the length, or prepending the entire operation with + * some value to differentiate from leaf nodes, should be included in prefix and suffix. + * If either of prefix or suffix is empty, we just treat it as an empty string + */ +export interface InnerOp { + hash: HashOp; + prefix: Uint8Array; + suffix: Uint8Array; +} +export interface InnerOpProtoMsg { + typeUrl: "/cosmos.ics23.v1.InnerOp"; + value: Uint8Array; +} +/** + * InnerOp represents a merkle-proof step that is not a leaf. + * It represents concatenating two children and hashing them to provide the next result. + * + * The result of the previous step is passed in, so the signature of this op is: + * innerOp(child) -> output + * + * The result of applying InnerOp should be: + * output = op.hash(op.prefix || child || op.suffix) + * + * where the || operator is concatenation of binary data, + * and child is the result of hashing all the tree below this step. + * + * Any special data, like prepending child with the length, or prepending the entire operation with + * some value to differentiate from leaf nodes, should be included in prefix and suffix. + * If either of prefix or suffix is empty, we just treat it as an empty string + */ +export interface InnerOpAmino { + hash: HashOp; + prefix: string; + suffix: string; +} +export interface InnerOpAminoMsg { + type: "cosmos-sdk/InnerOp"; + value: InnerOpAmino; +} +/** + * ProofSpec defines what the expected parameters are for a given proof type. + * This can be stored in the client and used to validate any incoming proofs. + * + * verify(ProofSpec, Proof) -> Proof | Error + * + * As demonstrated in tests, if we don't fix the algorithm used to calculate the + * LeafHash for a given tree, there are many possible key-value pairs that can + * generate a given hash (by interpretting the preimage differently). + * We need this for proper security, requires client knows a priori what + * tree format server uses. But not in code, rather a configuration object. + */ +export interface ProofSpec { + /** + * any field in the ExistenceProof must be the same as in this spec. + * except Prefix, which is just the first bytes of prefix (spec can be longer) + */ + leafSpec?: LeafOp; + innerSpec?: InnerSpec; + /** max_depth (if > 0) is the maximum number of InnerOps allowed (mainly for fixed-depth tries) */ + maxDepth: number; + /** min_depth (if > 0) is the minimum number of InnerOps allowed (mainly for fixed-depth tries) */ + minDepth: number; + /** + * prehash_key_before_comparison is a flag that indicates whether to use the + * prehash_key specified by LeafOp to compare lexical ordering of keys for + * non-existence proofs. + */ + prehashKeyBeforeComparison: boolean; +} +export interface ProofSpecProtoMsg { + typeUrl: "/cosmos.ics23.v1.ProofSpec"; + value: Uint8Array; +} +/** + * ProofSpec defines what the expected parameters are for a given proof type. + * This can be stored in the client and used to validate any incoming proofs. + * + * verify(ProofSpec, Proof) -> Proof | Error + * + * As demonstrated in tests, if we don't fix the algorithm used to calculate the + * LeafHash for a given tree, there are many possible key-value pairs that can + * generate a given hash (by interpretting the preimage differently). + * We need this for proper security, requires client knows a priori what + * tree format server uses. But not in code, rather a configuration object. + */ +export interface ProofSpecAmino { + /** + * any field in the ExistenceProof must be the same as in this spec. + * except Prefix, which is just the first bytes of prefix (spec can be longer) + */ + leaf_spec?: LeafOpAmino; + inner_spec?: InnerSpecAmino; + /** max_depth (if > 0) is the maximum number of InnerOps allowed (mainly for fixed-depth tries) */ + max_depth: number; + /** min_depth (if > 0) is the minimum number of InnerOps allowed (mainly for fixed-depth tries) */ + min_depth: number; + /** + * prehash_key_before_comparison is a flag that indicates whether to use the + * prehash_key specified by LeafOp to compare lexical ordering of keys for + * non-existence proofs. + */ + prehash_key_before_comparison: boolean; +} +export interface ProofSpecAminoMsg { + type: "cosmos-sdk/ProofSpec"; + value: ProofSpecAmino; +} +/** + * InnerSpec contains all store-specific structure info to determine if two proofs from a + * given store are neighbors. + * + * This enables: + * + * isLeftMost(spec: InnerSpec, op: InnerOp) + * isRightMost(spec: InnerSpec, op: InnerOp) + * isLeftNeighbor(spec: InnerSpec, left: InnerOp, right: InnerOp) + */ +export interface InnerSpec { + /** + * Child order is the ordering of the children node, must count from 0 + * iavl tree is [0, 1] (left then right) + * merk is [0, 2, 1] (left, right, here) + */ + childOrder: number[]; + childSize: number; + minPrefixLength: number; + maxPrefixLength: number; + /** empty child is the prehash image that is used when one child is nil (eg. 20 bytes of 0) */ + emptyChild: Uint8Array; + /** hash is the algorithm that must be used for each InnerOp */ + hash: HashOp; +} +export interface InnerSpecProtoMsg { + typeUrl: "/cosmos.ics23.v1.InnerSpec"; + value: Uint8Array; +} +/** + * InnerSpec contains all store-specific structure info to determine if two proofs from a + * given store are neighbors. + * + * This enables: + * + * isLeftMost(spec: InnerSpec, op: InnerOp) + * isRightMost(spec: InnerSpec, op: InnerOp) + * isLeftNeighbor(spec: InnerSpec, left: InnerOp, right: InnerOp) + */ +export interface InnerSpecAmino { + /** + * Child order is the ordering of the children node, must count from 0 + * iavl tree is [0, 1] (left then right) + * merk is [0, 2, 1] (left, right, here) + */ + child_order: number[]; + child_size: number; + min_prefix_length: number; + max_prefix_length: number; + /** empty child is the prehash image that is used when one child is nil (eg. 20 bytes of 0) */ + empty_child: string; + /** hash is the algorithm that must be used for each InnerOp */ + hash: HashOp; +} +export interface InnerSpecAminoMsg { + type: "cosmos-sdk/InnerSpec"; + value: InnerSpecAmino; +} +/** BatchProof is a group of multiple proof types than can be compressed */ +export interface BatchProof { + entries: BatchEntry[]; +} +export interface BatchProofProtoMsg { + typeUrl: "/cosmos.ics23.v1.BatchProof"; + value: Uint8Array; +} +/** BatchProof is a group of multiple proof types than can be compressed */ +export interface BatchProofAmino { + entries: BatchEntryAmino[]; +} +export interface BatchProofAminoMsg { + type: "cosmos-sdk/BatchProof"; + value: BatchProofAmino; +} +/** Use BatchEntry not CommitmentProof, to avoid recursion */ +export interface BatchEntry { + exist?: ExistenceProof; + nonexist?: NonExistenceProof; +} +export interface BatchEntryProtoMsg { + typeUrl: "/cosmos.ics23.v1.BatchEntry"; + value: Uint8Array; +} +/** Use BatchEntry not CommitmentProof, to avoid recursion */ +export interface BatchEntryAmino { + exist?: ExistenceProofAmino; + nonexist?: NonExistenceProofAmino; +} +export interface BatchEntryAminoMsg { + type: "cosmos-sdk/BatchEntry"; + value: BatchEntryAmino; +} +export interface CompressedBatchProof { + entries: CompressedBatchEntry[]; + lookupInners: InnerOp[]; +} +export interface CompressedBatchProofProtoMsg { + typeUrl: "/cosmos.ics23.v1.CompressedBatchProof"; + value: Uint8Array; +} +export interface CompressedBatchProofAmino { + entries: CompressedBatchEntryAmino[]; + lookup_inners: InnerOpAmino[]; +} +export interface CompressedBatchProofAminoMsg { + type: "cosmos-sdk/CompressedBatchProof"; + value: CompressedBatchProofAmino; +} +/** Use BatchEntry not CommitmentProof, to avoid recursion */ +export interface CompressedBatchEntry { + exist?: CompressedExistenceProof; + nonexist?: CompressedNonExistenceProof; +} +export interface CompressedBatchEntryProtoMsg { + typeUrl: "/cosmos.ics23.v1.CompressedBatchEntry"; + value: Uint8Array; +} +/** Use BatchEntry not CommitmentProof, to avoid recursion */ +export interface CompressedBatchEntryAmino { + exist?: CompressedExistenceProofAmino; + nonexist?: CompressedNonExistenceProofAmino; +} +export interface CompressedBatchEntryAminoMsg { + type: "cosmos-sdk/CompressedBatchEntry"; + value: CompressedBatchEntryAmino; +} +export interface CompressedExistenceProof { + key: Uint8Array; + value: Uint8Array; + leaf?: LeafOp; + /** these are indexes into the lookup_inners table in CompressedBatchProof */ + path: number[]; +} +export interface CompressedExistenceProofProtoMsg { + typeUrl: "/cosmos.ics23.v1.CompressedExistenceProof"; + value: Uint8Array; +} +export interface CompressedExistenceProofAmino { + key: string; + value: string; + leaf?: LeafOpAmino; + /** these are indexes into the lookup_inners table in CompressedBatchProof */ + path: number[]; +} +export interface CompressedExistenceProofAminoMsg { + type: "cosmos-sdk/CompressedExistenceProof"; + value: CompressedExistenceProofAmino; +} +export interface CompressedNonExistenceProof { + /** TODO: remove this as unnecessary??? we prove a range */ + key: Uint8Array; + left?: CompressedExistenceProof; + right?: CompressedExistenceProof; +} +export interface CompressedNonExistenceProofProtoMsg { + typeUrl: "/cosmos.ics23.v1.CompressedNonExistenceProof"; + value: Uint8Array; +} +export interface CompressedNonExistenceProofAmino { + /** TODO: remove this as unnecessary??? we prove a range */ + key: string; + left?: CompressedExistenceProofAmino; + right?: CompressedExistenceProofAmino; +} +export interface CompressedNonExistenceProofAminoMsg { + type: "cosmos-sdk/CompressedNonExistenceProof"; + value: CompressedNonExistenceProofAmino; +} +function createBaseExistenceProof(): ExistenceProof { + return { + key: new Uint8Array(), + value: new Uint8Array(), + leaf: undefined, + path: [] + }; +} +export const ExistenceProof = { + typeUrl: "/cosmos.ics23.v1.ExistenceProof", + aminoType: "cosmos-sdk/ExistenceProof", + is(o: any): o is ExistenceProof { + return o && (o.$typeUrl === ExistenceProof.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string") && Array.isArray(o.path) && (!o.path.length || InnerOp.is(o.path[0]))); + }, + isAmino(o: any): o is ExistenceProofAmino { + return o && (o.$typeUrl === ExistenceProof.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string") && Array.isArray(o.path) && (!o.path.length || InnerOp.isAmino(o.path[0]))); + }, + encode(message: ExistenceProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + if (message.leaf !== undefined) { + LeafOp.encode(message.leaf, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.path) { + InnerOp.encode(v!, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ExistenceProof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExistenceProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + case 2: + message.value = reader.bytes(); + break; + case 3: + message.leaf = LeafOp.decode(reader, reader.uint32()); + break; + case 4: + message.path.push(InnerOp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ExistenceProof { + const message = createBaseExistenceProof(); + message.key = object.key ?? new Uint8Array(); + message.value = object.value ?? new Uint8Array(); + message.leaf = object.leaf !== undefined && object.leaf !== null ? LeafOp.fromPartial(object.leaf) : undefined; + message.path = object.path?.map(e => InnerOp.fromPartial(e)) || []; + return message; + }, + fromAmino(object: ExistenceProofAmino): ExistenceProof { + const message = createBaseExistenceProof(); + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + if (object.value !== undefined && object.value !== null) { + message.value = bytesFromBase64(object.value); + } + if (object.leaf !== undefined && object.leaf !== null) { + message.leaf = LeafOp.fromAmino(object.leaf); + } + message.path = object.path?.map(e => InnerOp.fromAmino(e)) || []; + return message; + }, + toAmino(message: ExistenceProof): ExistenceProofAmino { + const obj: any = {}; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + obj.value = message.value ? base64FromBytes(message.value) : undefined; + obj.leaf = message.leaf ? LeafOp.toAmino(message.leaf) : undefined; + if (message.path) { + obj.path = message.path.map(e => e ? InnerOp.toAmino(e) : undefined); + } else { + obj.path = message.path; + } + return obj; + }, + fromAminoMsg(object: ExistenceProofAminoMsg): ExistenceProof { + return ExistenceProof.fromAmino(object.value); + }, + toAminoMsg(message: ExistenceProof): ExistenceProofAminoMsg { + return { + type: "cosmos-sdk/ExistenceProof", + value: ExistenceProof.toAmino(message) + }; + }, + fromProtoMsg(message: ExistenceProofProtoMsg): ExistenceProof { + return ExistenceProof.decode(message.value); + }, + toProto(message: ExistenceProof): Uint8Array { + return ExistenceProof.encode(message).finish(); + }, + toProtoMsg(message: ExistenceProof): ExistenceProofProtoMsg { + return { + typeUrl: "/cosmos.ics23.v1.ExistenceProof", + value: ExistenceProof.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ExistenceProof.typeUrl, ExistenceProof); +GlobalDecoderRegistry.registerAminoProtoMapping(ExistenceProof.aminoType, ExistenceProof.typeUrl); +function createBaseNonExistenceProof(): NonExistenceProof { + return { + key: new Uint8Array(), + left: undefined, + right: undefined + }; +} +export const NonExistenceProof = { + typeUrl: "/cosmos.ics23.v1.NonExistenceProof", + aminoType: "cosmos-sdk/NonExistenceProof", + is(o: any): o is NonExistenceProof { + return o && (o.$typeUrl === NonExistenceProof.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + isAmino(o: any): o is NonExistenceProofAmino { + return o && (o.$typeUrl === NonExistenceProof.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + encode(message: NonExistenceProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.left !== undefined) { + ExistenceProof.encode(message.left, writer.uint32(18).fork()).ldelim(); + } + if (message.right !== undefined) { + ExistenceProof.encode(message.right, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): NonExistenceProof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseNonExistenceProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + case 2: + message.left = ExistenceProof.decode(reader, reader.uint32()); + break; + case 3: + message.right = ExistenceProof.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): NonExistenceProof { + const message = createBaseNonExistenceProof(); + message.key = object.key ?? new Uint8Array(); + message.left = object.left !== undefined && object.left !== null ? ExistenceProof.fromPartial(object.left) : undefined; + message.right = object.right !== undefined && object.right !== null ? ExistenceProof.fromPartial(object.right) : undefined; + return message; + }, + fromAmino(object: NonExistenceProofAmino): NonExistenceProof { + const message = createBaseNonExistenceProof(); + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + if (object.left !== undefined && object.left !== null) { + message.left = ExistenceProof.fromAmino(object.left); + } + if (object.right !== undefined && object.right !== null) { + message.right = ExistenceProof.fromAmino(object.right); + } + return message; + }, + toAmino(message: NonExistenceProof): NonExistenceProofAmino { + const obj: any = {}; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + obj.left = message.left ? ExistenceProof.toAmino(message.left) : undefined; + obj.right = message.right ? ExistenceProof.toAmino(message.right) : undefined; + return obj; + }, + fromAminoMsg(object: NonExistenceProofAminoMsg): NonExistenceProof { + return NonExistenceProof.fromAmino(object.value); + }, + toAminoMsg(message: NonExistenceProof): NonExistenceProofAminoMsg { + return { + type: "cosmos-sdk/NonExistenceProof", + value: NonExistenceProof.toAmino(message) + }; + }, + fromProtoMsg(message: NonExistenceProofProtoMsg): NonExistenceProof { + return NonExistenceProof.decode(message.value); + }, + toProto(message: NonExistenceProof): Uint8Array { + return NonExistenceProof.encode(message).finish(); + }, + toProtoMsg(message: NonExistenceProof): NonExistenceProofProtoMsg { + return { + typeUrl: "/cosmos.ics23.v1.NonExistenceProof", + value: NonExistenceProof.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(NonExistenceProof.typeUrl, NonExistenceProof); +GlobalDecoderRegistry.registerAminoProtoMapping(NonExistenceProof.aminoType, NonExistenceProof.typeUrl); +function createBaseCommitmentProof(): CommitmentProof { + return { + exist: undefined, + nonexist: undefined, + batch: undefined, + compressed: undefined + }; +} +export const CommitmentProof = { + typeUrl: "/cosmos.ics23.v1.CommitmentProof", + aminoType: "cosmos-sdk/CommitmentProof", + is(o: any): o is CommitmentProof { + return o && o.$typeUrl === CommitmentProof.typeUrl; + }, + isAmino(o: any): o is CommitmentProofAmino { + return o && o.$typeUrl === CommitmentProof.typeUrl; + }, + encode(message: CommitmentProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.exist !== undefined) { + ExistenceProof.encode(message.exist, writer.uint32(10).fork()).ldelim(); + } + if (message.nonexist !== undefined) { + NonExistenceProof.encode(message.nonexist, writer.uint32(18).fork()).ldelim(); + } + if (message.batch !== undefined) { + BatchProof.encode(message.batch, writer.uint32(26).fork()).ldelim(); + } + if (message.compressed !== undefined) { + CompressedBatchProof.encode(message.compressed, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): CommitmentProof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitmentProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.exist = ExistenceProof.decode(reader, reader.uint32()); + break; + case 2: + message.nonexist = NonExistenceProof.decode(reader, reader.uint32()); + break; + case 3: + message.batch = BatchProof.decode(reader, reader.uint32()); + break; + case 4: + message.compressed = CompressedBatchProof.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): CommitmentProof { + const message = createBaseCommitmentProof(); + message.exist = object.exist !== undefined && object.exist !== null ? ExistenceProof.fromPartial(object.exist) : undefined; + message.nonexist = object.nonexist !== undefined && object.nonexist !== null ? NonExistenceProof.fromPartial(object.nonexist) : undefined; + message.batch = object.batch !== undefined && object.batch !== null ? BatchProof.fromPartial(object.batch) : undefined; + message.compressed = object.compressed !== undefined && object.compressed !== null ? CompressedBatchProof.fromPartial(object.compressed) : undefined; + return message; + }, + fromAmino(object: CommitmentProofAmino): CommitmentProof { + const message = createBaseCommitmentProof(); + if (object.exist !== undefined && object.exist !== null) { + message.exist = ExistenceProof.fromAmino(object.exist); + } + if (object.nonexist !== undefined && object.nonexist !== null) { + message.nonexist = NonExistenceProof.fromAmino(object.nonexist); + } + if (object.batch !== undefined && object.batch !== null) { + message.batch = BatchProof.fromAmino(object.batch); + } + if (object.compressed !== undefined && object.compressed !== null) { + message.compressed = CompressedBatchProof.fromAmino(object.compressed); + } + return message; + }, + toAmino(message: CommitmentProof): CommitmentProofAmino { + const obj: any = {}; + obj.exist = message.exist ? ExistenceProof.toAmino(message.exist) : undefined; + obj.nonexist = message.nonexist ? NonExistenceProof.toAmino(message.nonexist) : undefined; + obj.batch = message.batch ? BatchProof.toAmino(message.batch) : undefined; + obj.compressed = message.compressed ? CompressedBatchProof.toAmino(message.compressed) : undefined; + return obj; + }, + fromAminoMsg(object: CommitmentProofAminoMsg): CommitmentProof { + return CommitmentProof.fromAmino(object.value); + }, + toAminoMsg(message: CommitmentProof): CommitmentProofAminoMsg { + return { + type: "cosmos-sdk/CommitmentProof", + value: CommitmentProof.toAmino(message) + }; + }, + fromProtoMsg(message: CommitmentProofProtoMsg): CommitmentProof { + return CommitmentProof.decode(message.value); + }, + toProto(message: CommitmentProof): Uint8Array { + return CommitmentProof.encode(message).finish(); + }, + toProtoMsg(message: CommitmentProof): CommitmentProofProtoMsg { + return { + typeUrl: "/cosmos.ics23.v1.CommitmentProof", + value: CommitmentProof.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(CommitmentProof.typeUrl, CommitmentProof); +GlobalDecoderRegistry.registerAminoProtoMapping(CommitmentProof.aminoType, CommitmentProof.typeUrl); +function createBaseLeafOp(): LeafOp { + return { + hash: 0, + prehashKey: 0, + prehashValue: 0, + length: 0, + prefix: new Uint8Array() + }; +} +export const LeafOp = { + typeUrl: "/cosmos.ics23.v1.LeafOp", + aminoType: "cosmos-sdk/LeafOp", + is(o: any): o is LeafOp { + return o && (o.$typeUrl === LeafOp.typeUrl || isSet(o.hash) && isSet(o.prehashKey) && isSet(o.prehashValue) && isSet(o.length) && (o.prefix instanceof Uint8Array || typeof o.prefix === "string")); + }, + isAmino(o: any): o is LeafOpAmino { + return o && (o.$typeUrl === LeafOp.typeUrl || isSet(o.hash) && isSet(o.prehash_key) && isSet(o.prehash_value) && isSet(o.length) && (o.prefix instanceof Uint8Array || typeof o.prefix === "string")); + }, + encode(message: LeafOp, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.hash !== 0) { + writer.uint32(8).int32(message.hash); + } + if (message.prehashKey !== 0) { + writer.uint32(16).int32(message.prehashKey); + } + if (message.prehashValue !== 0) { + writer.uint32(24).int32(message.prehashValue); + } + if (message.length !== 0) { + writer.uint32(32).int32(message.length); + } + if (message.prefix.length !== 0) { + writer.uint32(42).bytes(message.prefix); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): LeafOp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLeafOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hash = (reader.int32() as any); + break; + case 2: + message.prehashKey = (reader.int32() as any); + break; + case 3: + message.prehashValue = (reader.int32() as any); + break; + case 4: + message.length = (reader.int32() as any); + break; + case 5: + message.prefix = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): LeafOp { + const message = createBaseLeafOp(); + message.hash = object.hash ?? 0; + message.prehashKey = object.prehashKey ?? 0; + message.prehashValue = object.prehashValue ?? 0; + message.length = object.length ?? 0; + message.prefix = object.prefix ?? new Uint8Array(); + return message; + }, + fromAmino(object: LeafOpAmino): LeafOp { + const message = createBaseLeafOp(); + if (object.hash !== undefined && object.hash !== null) { + message.hash = object.hash; + } + if (object.prehash_key !== undefined && object.prehash_key !== null) { + message.prehashKey = object.prehash_key; + } + if (object.prehash_value !== undefined && object.prehash_value !== null) { + message.prehashValue = object.prehash_value; + } + if (object.length !== undefined && object.length !== null) { + message.length = object.length; + } + if (object.prefix !== undefined && object.prefix !== null) { + message.prefix = bytesFromBase64(object.prefix); + } + return message; + }, + toAmino(message: LeafOp): LeafOpAmino { + const obj: any = {}; + obj.hash = message.hash === 0 ? undefined : message.hash; + obj.prehash_key = message.prehashKey === 0 ? undefined : message.prehashKey; + obj.prehash_value = message.prehashValue === 0 ? undefined : message.prehashValue; + obj.length = message.length === 0 ? undefined : message.length; + obj.prefix = message.prefix ? base64FromBytes(message.prefix) : undefined; + return obj; + }, + fromAminoMsg(object: LeafOpAminoMsg): LeafOp { + return LeafOp.fromAmino(object.value); + }, + toAminoMsg(message: LeafOp): LeafOpAminoMsg { + return { + type: "cosmos-sdk/LeafOp", + value: LeafOp.toAmino(message) + }; + }, + fromProtoMsg(message: LeafOpProtoMsg): LeafOp { + return LeafOp.decode(message.value); + }, + toProto(message: LeafOp): Uint8Array { + return LeafOp.encode(message).finish(); + }, + toProtoMsg(message: LeafOp): LeafOpProtoMsg { + return { + typeUrl: "/cosmos.ics23.v1.LeafOp", + value: LeafOp.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(LeafOp.typeUrl, LeafOp); +GlobalDecoderRegistry.registerAminoProtoMapping(LeafOp.aminoType, LeafOp.typeUrl); +function createBaseInnerOp(): InnerOp { + return { + hash: 0, + prefix: new Uint8Array(), + suffix: new Uint8Array() + }; +} +export const InnerOp = { + typeUrl: "/cosmos.ics23.v1.InnerOp", + aminoType: "cosmos-sdk/InnerOp", + is(o: any): o is InnerOp { + return o && (o.$typeUrl === InnerOp.typeUrl || isSet(o.hash) && (o.prefix instanceof Uint8Array || typeof o.prefix === "string") && (o.suffix instanceof Uint8Array || typeof o.suffix === "string")); + }, + isAmino(o: any): o is InnerOpAmino { + return o && (o.$typeUrl === InnerOp.typeUrl || isSet(o.hash) && (o.prefix instanceof Uint8Array || typeof o.prefix === "string") && (o.suffix instanceof Uint8Array || typeof o.suffix === "string")); + }, + encode(message: InnerOp, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.hash !== 0) { + writer.uint32(8).int32(message.hash); + } + if (message.prefix.length !== 0) { + writer.uint32(18).bytes(message.prefix); + } + if (message.suffix.length !== 0) { + writer.uint32(26).bytes(message.suffix); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): InnerOp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInnerOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hash = (reader.int32() as any); + break; + case 2: + message.prefix = reader.bytes(); + break; + case 3: + message.suffix = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): InnerOp { + const message = createBaseInnerOp(); + message.hash = object.hash ?? 0; + message.prefix = object.prefix ?? new Uint8Array(); + message.suffix = object.suffix ?? new Uint8Array(); + return message; + }, + fromAmino(object: InnerOpAmino): InnerOp { + const message = createBaseInnerOp(); + if (object.hash !== undefined && object.hash !== null) { + message.hash = object.hash; + } + if (object.prefix !== undefined && object.prefix !== null) { + message.prefix = bytesFromBase64(object.prefix); + } + if (object.suffix !== undefined && object.suffix !== null) { + message.suffix = bytesFromBase64(object.suffix); + } + return message; + }, + toAmino(message: InnerOp): InnerOpAmino { + const obj: any = {}; + obj.hash = message.hash === 0 ? undefined : message.hash; + obj.prefix = message.prefix ? base64FromBytes(message.prefix) : undefined; + obj.suffix = message.suffix ? base64FromBytes(message.suffix) : undefined; + return obj; + }, + fromAminoMsg(object: InnerOpAminoMsg): InnerOp { + return InnerOp.fromAmino(object.value); + }, + toAminoMsg(message: InnerOp): InnerOpAminoMsg { + return { + type: "cosmos-sdk/InnerOp", + value: InnerOp.toAmino(message) + }; + }, + fromProtoMsg(message: InnerOpProtoMsg): InnerOp { + return InnerOp.decode(message.value); + }, + toProto(message: InnerOp): Uint8Array { + return InnerOp.encode(message).finish(); + }, + toProtoMsg(message: InnerOp): InnerOpProtoMsg { + return { + typeUrl: "/cosmos.ics23.v1.InnerOp", + value: InnerOp.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(InnerOp.typeUrl, InnerOp); +GlobalDecoderRegistry.registerAminoProtoMapping(InnerOp.aminoType, InnerOp.typeUrl); +function createBaseProofSpec(): ProofSpec { + return { + leafSpec: undefined, + innerSpec: undefined, + maxDepth: 0, + minDepth: 0, + prehashKeyBeforeComparison: false + }; +} +export const ProofSpec = { + typeUrl: "/cosmos.ics23.v1.ProofSpec", + aminoType: "cosmos-sdk/ProofSpec", + is(o: any): o is ProofSpec { + return o && (o.$typeUrl === ProofSpec.typeUrl || typeof o.maxDepth === "number" && typeof o.minDepth === "number" && typeof o.prehashKeyBeforeComparison === "boolean"); + }, + isAmino(o: any): o is ProofSpecAmino { + return o && (o.$typeUrl === ProofSpec.typeUrl || typeof o.max_depth === "number" && typeof o.min_depth === "number" && typeof o.prehash_key_before_comparison === "boolean"); + }, + encode(message: ProofSpec, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.leafSpec !== undefined) { + LeafOp.encode(message.leafSpec, writer.uint32(10).fork()).ldelim(); + } + if (message.innerSpec !== undefined) { + InnerSpec.encode(message.innerSpec, writer.uint32(18).fork()).ldelim(); + } + if (message.maxDepth !== 0) { + writer.uint32(24).int32(message.maxDepth); + } + if (message.minDepth !== 0) { + writer.uint32(32).int32(message.minDepth); + } + if (message.prehashKeyBeforeComparison === true) { + writer.uint32(40).bool(message.prehashKeyBeforeComparison); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ProofSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProofSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.leafSpec = LeafOp.decode(reader, reader.uint32()); + break; + case 2: + message.innerSpec = InnerSpec.decode(reader, reader.uint32()); + break; + case 3: + message.maxDepth = reader.int32(); + break; + case 4: + message.minDepth = reader.int32(); + break; + case 5: + message.prehashKeyBeforeComparison = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ProofSpec { + const message = createBaseProofSpec(); + message.leafSpec = object.leafSpec !== undefined && object.leafSpec !== null ? LeafOp.fromPartial(object.leafSpec) : undefined; + message.innerSpec = object.innerSpec !== undefined && object.innerSpec !== null ? InnerSpec.fromPartial(object.innerSpec) : undefined; + message.maxDepth = object.maxDepth ?? 0; + message.minDepth = object.minDepth ?? 0; + message.prehashKeyBeforeComparison = object.prehashKeyBeforeComparison ?? false; + return message; + }, + fromAmino(object: ProofSpecAmino): ProofSpec { + const message = createBaseProofSpec(); + if (object.leaf_spec !== undefined && object.leaf_spec !== null) { + message.leafSpec = LeafOp.fromAmino(object.leaf_spec); + } + if (object.inner_spec !== undefined && object.inner_spec !== null) { + message.innerSpec = InnerSpec.fromAmino(object.inner_spec); + } + if (object.max_depth !== undefined && object.max_depth !== null) { + message.maxDepth = object.max_depth; + } + if (object.min_depth !== undefined && object.min_depth !== null) { + message.minDepth = object.min_depth; + } + if (object.prehash_key_before_comparison !== undefined && object.prehash_key_before_comparison !== null) { + message.prehashKeyBeforeComparison = object.prehash_key_before_comparison; + } + return message; + }, + toAmino(message: ProofSpec): ProofSpecAmino { + const obj: any = {}; + obj.leaf_spec = message.leafSpec ? LeafOp.toAmino(message.leafSpec) : undefined; + obj.inner_spec = message.innerSpec ? InnerSpec.toAmino(message.innerSpec) : undefined; + obj.max_depth = message.maxDepth === 0 ? undefined : message.maxDepth; + obj.min_depth = message.minDepth === 0 ? undefined : message.minDepth; + obj.prehash_key_before_comparison = message.prehashKeyBeforeComparison === false ? undefined : message.prehashKeyBeforeComparison; + return obj; + }, + fromAminoMsg(object: ProofSpecAminoMsg): ProofSpec { + return ProofSpec.fromAmino(object.value); + }, + toAminoMsg(message: ProofSpec): ProofSpecAminoMsg { + return { + type: "cosmos-sdk/ProofSpec", + value: ProofSpec.toAmino(message) + }; + }, + fromProtoMsg(message: ProofSpecProtoMsg): ProofSpec { + return ProofSpec.decode(message.value); + }, + toProto(message: ProofSpec): Uint8Array { + return ProofSpec.encode(message).finish(); + }, + toProtoMsg(message: ProofSpec): ProofSpecProtoMsg { + return { + typeUrl: "/cosmos.ics23.v1.ProofSpec", + value: ProofSpec.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ProofSpec.typeUrl, ProofSpec); +GlobalDecoderRegistry.registerAminoProtoMapping(ProofSpec.aminoType, ProofSpec.typeUrl); +function createBaseInnerSpec(): InnerSpec { + return { + childOrder: [], + childSize: 0, + minPrefixLength: 0, + maxPrefixLength: 0, + emptyChild: new Uint8Array(), + hash: 0 + }; +} +export const InnerSpec = { + typeUrl: "/cosmos.ics23.v1.InnerSpec", + aminoType: "cosmos-sdk/InnerSpec", + is(o: any): o is InnerSpec { + return o && (o.$typeUrl === InnerSpec.typeUrl || Array.isArray(o.childOrder) && (!o.childOrder.length || typeof o.childOrder[0] === "number") && typeof o.childSize === "number" && typeof o.minPrefixLength === "number" && typeof o.maxPrefixLength === "number" && (o.emptyChild instanceof Uint8Array || typeof o.emptyChild === "string") && isSet(o.hash)); + }, + isAmino(o: any): o is InnerSpecAmino { + return o && (o.$typeUrl === InnerSpec.typeUrl || Array.isArray(o.child_order) && (!o.child_order.length || typeof o.child_order[0] === "number") && typeof o.child_size === "number" && typeof o.min_prefix_length === "number" && typeof o.max_prefix_length === "number" && (o.empty_child instanceof Uint8Array || typeof o.empty_child === "string") && isSet(o.hash)); + }, + encode(message: InnerSpec, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + writer.uint32(10).fork(); + for (const v of message.childOrder) { + writer.int32(v); + } + writer.ldelim(); + if (message.childSize !== 0) { + writer.uint32(16).int32(message.childSize); + } + if (message.minPrefixLength !== 0) { + writer.uint32(24).int32(message.minPrefixLength); + } + if (message.maxPrefixLength !== 0) { + writer.uint32(32).int32(message.maxPrefixLength); + } + if (message.emptyChild.length !== 0) { + writer.uint32(42).bytes(message.emptyChild); + } + if (message.hash !== 0) { + writer.uint32(48).int32(message.hash); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): InnerSpec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInnerSpec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.childOrder.push(reader.int32()); + } + } else { + message.childOrder.push(reader.int32()); + } + break; + case 2: + message.childSize = reader.int32(); + break; + case 3: + message.minPrefixLength = reader.int32(); + break; + case 4: + message.maxPrefixLength = reader.int32(); + break; + case 5: + message.emptyChild = reader.bytes(); + break; + case 6: + message.hash = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): InnerSpec { + const message = createBaseInnerSpec(); + message.childOrder = object.childOrder?.map(e => e) || []; + message.childSize = object.childSize ?? 0; + message.minPrefixLength = object.minPrefixLength ?? 0; + message.maxPrefixLength = object.maxPrefixLength ?? 0; + message.emptyChild = object.emptyChild ?? new Uint8Array(); + message.hash = object.hash ?? 0; + return message; + }, + fromAmino(object: InnerSpecAmino): InnerSpec { + const message = createBaseInnerSpec(); + message.childOrder = object.child_order?.map(e => e) || []; + if (object.child_size !== undefined && object.child_size !== null) { + message.childSize = object.child_size; + } + if (object.min_prefix_length !== undefined && object.min_prefix_length !== null) { + message.minPrefixLength = object.min_prefix_length; + } + if (object.max_prefix_length !== undefined && object.max_prefix_length !== null) { + message.maxPrefixLength = object.max_prefix_length; + } + if (object.empty_child !== undefined && object.empty_child !== null) { + message.emptyChild = bytesFromBase64(object.empty_child); + } + if (object.hash !== undefined && object.hash !== null) { + message.hash = object.hash; + } + return message; + }, + toAmino(message: InnerSpec): InnerSpecAmino { + const obj: any = {}; + if (message.childOrder) { + obj.child_order = message.childOrder.map(e => e); + } else { + obj.child_order = message.childOrder; + } + obj.child_size = message.childSize === 0 ? undefined : message.childSize; + obj.min_prefix_length = message.minPrefixLength === 0 ? undefined : message.minPrefixLength; + obj.max_prefix_length = message.maxPrefixLength === 0 ? undefined : message.maxPrefixLength; + obj.empty_child = message.emptyChild ? base64FromBytes(message.emptyChild) : undefined; + obj.hash = message.hash === 0 ? undefined : message.hash; + return obj; + }, + fromAminoMsg(object: InnerSpecAminoMsg): InnerSpec { + return InnerSpec.fromAmino(object.value); + }, + toAminoMsg(message: InnerSpec): InnerSpecAminoMsg { + return { + type: "cosmos-sdk/InnerSpec", + value: InnerSpec.toAmino(message) + }; + }, + fromProtoMsg(message: InnerSpecProtoMsg): InnerSpec { + return InnerSpec.decode(message.value); + }, + toProto(message: InnerSpec): Uint8Array { + return InnerSpec.encode(message).finish(); + }, + toProtoMsg(message: InnerSpec): InnerSpecProtoMsg { + return { + typeUrl: "/cosmos.ics23.v1.InnerSpec", + value: InnerSpec.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(InnerSpec.typeUrl, InnerSpec); +GlobalDecoderRegistry.registerAminoProtoMapping(InnerSpec.aminoType, InnerSpec.typeUrl); +function createBaseBatchProof(): BatchProof { + return { + entries: [] + }; +} +export const BatchProof = { + typeUrl: "/cosmos.ics23.v1.BatchProof", + aminoType: "cosmos-sdk/BatchProof", + is(o: any): o is BatchProof { + return o && (o.$typeUrl === BatchProof.typeUrl || Array.isArray(o.entries) && (!o.entries.length || BatchEntry.is(o.entries[0]))); + }, + isAmino(o: any): o is BatchProofAmino { + return o && (o.$typeUrl === BatchProof.typeUrl || Array.isArray(o.entries) && (!o.entries.length || BatchEntry.isAmino(o.entries[0]))); + }, + encode(message: BatchProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.entries) { + BatchEntry.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): BatchProof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBatchProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.entries.push(BatchEntry.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): BatchProof { + const message = createBaseBatchProof(); + message.entries = object.entries?.map(e => BatchEntry.fromPartial(e)) || []; + return message; + }, + fromAmino(object: BatchProofAmino): BatchProof { + const message = createBaseBatchProof(); + message.entries = object.entries?.map(e => BatchEntry.fromAmino(e)) || []; + return message; + }, + toAmino(message: BatchProof): BatchProofAmino { + const obj: any = {}; + if (message.entries) { + obj.entries = message.entries.map(e => e ? BatchEntry.toAmino(e) : undefined); + } else { + obj.entries = message.entries; + } + return obj; + }, + fromAminoMsg(object: BatchProofAminoMsg): BatchProof { + return BatchProof.fromAmino(object.value); + }, + toAminoMsg(message: BatchProof): BatchProofAminoMsg { + return { + type: "cosmos-sdk/BatchProof", + value: BatchProof.toAmino(message) + }; + }, + fromProtoMsg(message: BatchProofProtoMsg): BatchProof { + return BatchProof.decode(message.value); + }, + toProto(message: BatchProof): Uint8Array { + return BatchProof.encode(message).finish(); + }, + toProtoMsg(message: BatchProof): BatchProofProtoMsg { + return { + typeUrl: "/cosmos.ics23.v1.BatchProof", + value: BatchProof.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(BatchProof.typeUrl, BatchProof); +GlobalDecoderRegistry.registerAminoProtoMapping(BatchProof.aminoType, BatchProof.typeUrl); +function createBaseBatchEntry(): BatchEntry { + return { + exist: undefined, + nonexist: undefined + }; +} +export const BatchEntry = { + typeUrl: "/cosmos.ics23.v1.BatchEntry", + aminoType: "cosmos-sdk/BatchEntry", + is(o: any): o is BatchEntry { + return o && o.$typeUrl === BatchEntry.typeUrl; + }, + isAmino(o: any): o is BatchEntryAmino { + return o && o.$typeUrl === BatchEntry.typeUrl; + }, + encode(message: BatchEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.exist !== undefined) { + ExistenceProof.encode(message.exist, writer.uint32(10).fork()).ldelim(); + } + if (message.nonexist !== undefined) { + NonExistenceProof.encode(message.nonexist, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): BatchEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBatchEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.exist = ExistenceProof.decode(reader, reader.uint32()); + break; + case 2: + message.nonexist = NonExistenceProof.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): BatchEntry { + const message = createBaseBatchEntry(); + message.exist = object.exist !== undefined && object.exist !== null ? ExistenceProof.fromPartial(object.exist) : undefined; + message.nonexist = object.nonexist !== undefined && object.nonexist !== null ? NonExistenceProof.fromPartial(object.nonexist) : undefined; + return message; + }, + fromAmino(object: BatchEntryAmino): BatchEntry { + const message = createBaseBatchEntry(); + if (object.exist !== undefined && object.exist !== null) { + message.exist = ExistenceProof.fromAmino(object.exist); + } + if (object.nonexist !== undefined && object.nonexist !== null) { + message.nonexist = NonExistenceProof.fromAmino(object.nonexist); + } + return message; + }, + toAmino(message: BatchEntry): BatchEntryAmino { + const obj: any = {}; + obj.exist = message.exist ? ExistenceProof.toAmino(message.exist) : undefined; + obj.nonexist = message.nonexist ? NonExistenceProof.toAmino(message.nonexist) : undefined; + return obj; + }, + fromAminoMsg(object: BatchEntryAminoMsg): BatchEntry { + return BatchEntry.fromAmino(object.value); + }, + toAminoMsg(message: BatchEntry): BatchEntryAminoMsg { + return { + type: "cosmos-sdk/BatchEntry", + value: BatchEntry.toAmino(message) + }; + }, + fromProtoMsg(message: BatchEntryProtoMsg): BatchEntry { + return BatchEntry.decode(message.value); + }, + toProto(message: BatchEntry): Uint8Array { + return BatchEntry.encode(message).finish(); + }, + toProtoMsg(message: BatchEntry): BatchEntryProtoMsg { + return { + typeUrl: "/cosmos.ics23.v1.BatchEntry", + value: BatchEntry.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(BatchEntry.typeUrl, BatchEntry); +GlobalDecoderRegistry.registerAminoProtoMapping(BatchEntry.aminoType, BatchEntry.typeUrl); +function createBaseCompressedBatchProof(): CompressedBatchProof { + return { + entries: [], + lookupInners: [] + }; +} +export const CompressedBatchProof = { + typeUrl: "/cosmos.ics23.v1.CompressedBatchProof", + aminoType: "cosmos-sdk/CompressedBatchProof", + is(o: any): o is CompressedBatchProof { + return o && (o.$typeUrl === CompressedBatchProof.typeUrl || Array.isArray(o.entries) && (!o.entries.length || CompressedBatchEntry.is(o.entries[0])) && Array.isArray(o.lookupInners) && (!o.lookupInners.length || InnerOp.is(o.lookupInners[0]))); + }, + isAmino(o: any): o is CompressedBatchProofAmino { + return o && (o.$typeUrl === CompressedBatchProof.typeUrl || Array.isArray(o.entries) && (!o.entries.length || CompressedBatchEntry.isAmino(o.entries[0])) && Array.isArray(o.lookup_inners) && (!o.lookup_inners.length || InnerOp.isAmino(o.lookup_inners[0]))); + }, + encode(message: CompressedBatchProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.entries) { + CompressedBatchEntry.encode(v!, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.lookupInners) { + InnerOp.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): CompressedBatchProof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCompressedBatchProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.entries.push(CompressedBatchEntry.decode(reader, reader.uint32())); + break; + case 2: + message.lookupInners.push(InnerOp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): CompressedBatchProof { + const message = createBaseCompressedBatchProof(); + message.entries = object.entries?.map(e => CompressedBatchEntry.fromPartial(e)) || []; + message.lookupInners = object.lookupInners?.map(e => InnerOp.fromPartial(e)) || []; + return message; + }, + fromAmino(object: CompressedBatchProofAmino): CompressedBatchProof { + const message = createBaseCompressedBatchProof(); + message.entries = object.entries?.map(e => CompressedBatchEntry.fromAmino(e)) || []; + message.lookupInners = object.lookup_inners?.map(e => InnerOp.fromAmino(e)) || []; + return message; + }, + toAmino(message: CompressedBatchProof): CompressedBatchProofAmino { + const obj: any = {}; + if (message.entries) { + obj.entries = message.entries.map(e => e ? CompressedBatchEntry.toAmino(e) : undefined); + } else { + obj.entries = message.entries; + } + if (message.lookupInners) { + obj.lookup_inners = message.lookupInners.map(e => e ? InnerOp.toAmino(e) : undefined); + } else { + obj.lookup_inners = message.lookupInners; + } + return obj; + }, + fromAminoMsg(object: CompressedBatchProofAminoMsg): CompressedBatchProof { + return CompressedBatchProof.fromAmino(object.value); + }, + toAminoMsg(message: CompressedBatchProof): CompressedBatchProofAminoMsg { + return { + type: "cosmos-sdk/CompressedBatchProof", + value: CompressedBatchProof.toAmino(message) + }; + }, + fromProtoMsg(message: CompressedBatchProofProtoMsg): CompressedBatchProof { + return CompressedBatchProof.decode(message.value); + }, + toProto(message: CompressedBatchProof): Uint8Array { + return CompressedBatchProof.encode(message).finish(); + }, + toProtoMsg(message: CompressedBatchProof): CompressedBatchProofProtoMsg { + return { + typeUrl: "/cosmos.ics23.v1.CompressedBatchProof", + value: CompressedBatchProof.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(CompressedBatchProof.typeUrl, CompressedBatchProof); +GlobalDecoderRegistry.registerAminoProtoMapping(CompressedBatchProof.aminoType, CompressedBatchProof.typeUrl); +function createBaseCompressedBatchEntry(): CompressedBatchEntry { + return { + exist: undefined, + nonexist: undefined + }; +} +export const CompressedBatchEntry = { + typeUrl: "/cosmos.ics23.v1.CompressedBatchEntry", + aminoType: "cosmos-sdk/CompressedBatchEntry", + is(o: any): o is CompressedBatchEntry { + return o && o.$typeUrl === CompressedBatchEntry.typeUrl; + }, + isAmino(o: any): o is CompressedBatchEntryAmino { + return o && o.$typeUrl === CompressedBatchEntry.typeUrl; + }, + encode(message: CompressedBatchEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.exist !== undefined) { + CompressedExistenceProof.encode(message.exist, writer.uint32(10).fork()).ldelim(); + } + if (message.nonexist !== undefined) { + CompressedNonExistenceProof.encode(message.nonexist, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): CompressedBatchEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCompressedBatchEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.exist = CompressedExistenceProof.decode(reader, reader.uint32()); + break; + case 2: + message.nonexist = CompressedNonExistenceProof.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): CompressedBatchEntry { + const message = createBaseCompressedBatchEntry(); + message.exist = object.exist !== undefined && object.exist !== null ? CompressedExistenceProof.fromPartial(object.exist) : undefined; + message.nonexist = object.nonexist !== undefined && object.nonexist !== null ? CompressedNonExistenceProof.fromPartial(object.nonexist) : undefined; + return message; + }, + fromAmino(object: CompressedBatchEntryAmino): CompressedBatchEntry { + const message = createBaseCompressedBatchEntry(); + if (object.exist !== undefined && object.exist !== null) { + message.exist = CompressedExistenceProof.fromAmino(object.exist); + } + if (object.nonexist !== undefined && object.nonexist !== null) { + message.nonexist = CompressedNonExistenceProof.fromAmino(object.nonexist); + } + return message; + }, + toAmino(message: CompressedBatchEntry): CompressedBatchEntryAmino { + const obj: any = {}; + obj.exist = message.exist ? CompressedExistenceProof.toAmino(message.exist) : undefined; + obj.nonexist = message.nonexist ? CompressedNonExistenceProof.toAmino(message.nonexist) : undefined; + return obj; + }, + fromAminoMsg(object: CompressedBatchEntryAminoMsg): CompressedBatchEntry { + return CompressedBatchEntry.fromAmino(object.value); + }, + toAminoMsg(message: CompressedBatchEntry): CompressedBatchEntryAminoMsg { + return { + type: "cosmos-sdk/CompressedBatchEntry", + value: CompressedBatchEntry.toAmino(message) + }; + }, + fromProtoMsg(message: CompressedBatchEntryProtoMsg): CompressedBatchEntry { + return CompressedBatchEntry.decode(message.value); + }, + toProto(message: CompressedBatchEntry): Uint8Array { + return CompressedBatchEntry.encode(message).finish(); + }, + toProtoMsg(message: CompressedBatchEntry): CompressedBatchEntryProtoMsg { + return { + typeUrl: "/cosmos.ics23.v1.CompressedBatchEntry", + value: CompressedBatchEntry.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(CompressedBatchEntry.typeUrl, CompressedBatchEntry); +GlobalDecoderRegistry.registerAminoProtoMapping(CompressedBatchEntry.aminoType, CompressedBatchEntry.typeUrl); +function createBaseCompressedExistenceProof(): CompressedExistenceProof { + return { + key: new Uint8Array(), + value: new Uint8Array(), + leaf: undefined, + path: [] + }; +} +export const CompressedExistenceProof = { + typeUrl: "/cosmos.ics23.v1.CompressedExistenceProof", + aminoType: "cosmos-sdk/CompressedExistenceProof", + is(o: any): o is CompressedExistenceProof { + return o && (o.$typeUrl === CompressedExistenceProof.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string") && Array.isArray(o.path) && (!o.path.length || typeof o.path[0] === "number")); + }, + isAmino(o: any): o is CompressedExistenceProofAmino { + return o && (o.$typeUrl === CompressedExistenceProof.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string") && Array.isArray(o.path) && (!o.path.length || typeof o.path[0] === "number")); + }, + encode(message: CompressedExistenceProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + if (message.leaf !== undefined) { + LeafOp.encode(message.leaf, writer.uint32(26).fork()).ldelim(); + } + writer.uint32(34).fork(); + for (const v of message.path) { + writer.int32(v); + } + writer.ldelim(); + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): CompressedExistenceProof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCompressedExistenceProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + case 2: + message.value = reader.bytes(); + break; + case 3: + message.leaf = LeafOp.decode(reader, reader.uint32()); + break; + case 4: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.path.push(reader.int32()); + } + } else { + message.path.push(reader.int32()); + } + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): CompressedExistenceProof { + const message = createBaseCompressedExistenceProof(); + message.key = object.key ?? new Uint8Array(); + message.value = object.value ?? new Uint8Array(); + message.leaf = object.leaf !== undefined && object.leaf !== null ? LeafOp.fromPartial(object.leaf) : undefined; + message.path = object.path?.map(e => e) || []; + return message; + }, + fromAmino(object: CompressedExistenceProofAmino): CompressedExistenceProof { + const message = createBaseCompressedExistenceProof(); + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + if (object.value !== undefined && object.value !== null) { + message.value = bytesFromBase64(object.value); + } + if (object.leaf !== undefined && object.leaf !== null) { + message.leaf = LeafOp.fromAmino(object.leaf); + } + message.path = object.path?.map(e => e) || []; + return message; + }, + toAmino(message: CompressedExistenceProof): CompressedExistenceProofAmino { + const obj: any = {}; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + obj.value = message.value ? base64FromBytes(message.value) : undefined; + obj.leaf = message.leaf ? LeafOp.toAmino(message.leaf) : undefined; + if (message.path) { + obj.path = message.path.map(e => e); + } else { + obj.path = message.path; + } + return obj; + }, + fromAminoMsg(object: CompressedExistenceProofAminoMsg): CompressedExistenceProof { + return CompressedExistenceProof.fromAmino(object.value); + }, + toAminoMsg(message: CompressedExistenceProof): CompressedExistenceProofAminoMsg { + return { + type: "cosmos-sdk/CompressedExistenceProof", + value: CompressedExistenceProof.toAmino(message) + }; + }, + fromProtoMsg(message: CompressedExistenceProofProtoMsg): CompressedExistenceProof { + return CompressedExistenceProof.decode(message.value); + }, + toProto(message: CompressedExistenceProof): Uint8Array { + return CompressedExistenceProof.encode(message).finish(); + }, + toProtoMsg(message: CompressedExistenceProof): CompressedExistenceProofProtoMsg { + return { + typeUrl: "/cosmos.ics23.v1.CompressedExistenceProof", + value: CompressedExistenceProof.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(CompressedExistenceProof.typeUrl, CompressedExistenceProof); +GlobalDecoderRegistry.registerAminoProtoMapping(CompressedExistenceProof.aminoType, CompressedExistenceProof.typeUrl); +function createBaseCompressedNonExistenceProof(): CompressedNonExistenceProof { + return { + key: new Uint8Array(), + left: undefined, + right: undefined + }; +} +export const CompressedNonExistenceProof = { + typeUrl: "/cosmos.ics23.v1.CompressedNonExistenceProof", + aminoType: "cosmos-sdk/CompressedNonExistenceProof", + is(o: any): o is CompressedNonExistenceProof { + return o && (o.$typeUrl === CompressedNonExistenceProof.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + isAmino(o: any): o is CompressedNonExistenceProofAmino { + return o && (o.$typeUrl === CompressedNonExistenceProof.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + encode(message: CompressedNonExistenceProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.left !== undefined) { + CompressedExistenceProof.encode(message.left, writer.uint32(18).fork()).ldelim(); + } + if (message.right !== undefined) { + CompressedExistenceProof.encode(message.right, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): CompressedNonExistenceProof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCompressedNonExistenceProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + case 2: + message.left = CompressedExistenceProof.decode(reader, reader.uint32()); + break; + case 3: + message.right = CompressedExistenceProof.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): CompressedNonExistenceProof { + const message = createBaseCompressedNonExistenceProof(); + message.key = object.key ?? new Uint8Array(); + message.left = object.left !== undefined && object.left !== null ? CompressedExistenceProof.fromPartial(object.left) : undefined; + message.right = object.right !== undefined && object.right !== null ? CompressedExistenceProof.fromPartial(object.right) : undefined; + return message; + }, + fromAmino(object: CompressedNonExistenceProofAmino): CompressedNonExistenceProof { + const message = createBaseCompressedNonExistenceProof(); + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + if (object.left !== undefined && object.left !== null) { + message.left = CompressedExistenceProof.fromAmino(object.left); + } + if (object.right !== undefined && object.right !== null) { + message.right = CompressedExistenceProof.fromAmino(object.right); + } + return message; + }, + toAmino(message: CompressedNonExistenceProof): CompressedNonExistenceProofAmino { + const obj: any = {}; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + obj.left = message.left ? CompressedExistenceProof.toAmino(message.left) : undefined; + obj.right = message.right ? CompressedExistenceProof.toAmino(message.right) : undefined; + return obj; + }, + fromAminoMsg(object: CompressedNonExistenceProofAminoMsg): CompressedNonExistenceProof { + return CompressedNonExistenceProof.fromAmino(object.value); + }, + toAminoMsg(message: CompressedNonExistenceProof): CompressedNonExistenceProofAminoMsg { + return { + type: "cosmos-sdk/CompressedNonExistenceProof", + value: CompressedNonExistenceProof.toAmino(message) + }; + }, + fromProtoMsg(message: CompressedNonExistenceProofProtoMsg): CompressedNonExistenceProof { + return CompressedNonExistenceProof.decode(message.value); + }, + toProto(message: CompressedNonExistenceProof): Uint8Array { + return CompressedNonExistenceProof.encode(message).finish(); + }, + toProtoMsg(message: CompressedNonExistenceProof): CompressedNonExistenceProofProtoMsg { + return { + typeUrl: "/cosmos.ics23.v1.CompressedNonExistenceProof", + value: CompressedNonExistenceProof.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(CompressedNonExistenceProof.typeUrl, CompressedNonExistenceProof); +GlobalDecoderRegistry.registerAminoProtoMapping(CompressedNonExistenceProof.aminoType, CompressedNonExistenceProof.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/msg/v1/msg.ts b/libs/interchain-query/src/cosmos/msg/v1/msg.ts new file mode 100644 index 00000000..693da49f --- /dev/null +++ b/libs/interchain-query/src/cosmos/msg/v1/msg.ts @@ -0,0 +1 @@ +export {} \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/query/v1/query.ts b/libs/interchain-query/src/cosmos/query/v1/query.ts new file mode 100644 index 00000000..693da49f --- /dev/null +++ b/libs/interchain-query/src/cosmos/query/v1/query.ts @@ -0,0 +1 @@ +export {} \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/staking/v1beta1/query.rpc.func.ts b/libs/interchain-query/src/cosmos/staking/v1beta1/query.rpc.func.ts new file mode 100644 index 00000000..0d3c0cfc --- /dev/null +++ b/libs/interchain-query/src/cosmos/staking/v1beta1/query.rpc.func.ts @@ -0,0 +1,157 @@ +import { RpcResolver, buildQuery } from "../../../helper-func-types"; +import { buildUseQuery } from "../../../react-query"; +import { QueryValidatorsRequest, QueryValidatorsResponse, QueryValidatorRequest, QueryValidatorResponse, QueryValidatorDelegationsRequest, QueryValidatorDelegationsResponse, QueryValidatorUnbondingDelegationsRequest, QueryValidatorUnbondingDelegationsResponse, QueryDelegationRequest, QueryDelegationResponse, QueryUnbondingDelegationRequest, QueryUnbondingDelegationResponse, QueryDelegatorDelegationsRequest, QueryDelegatorDelegationsResponse, QueryDelegatorUnbondingDelegationsRequest, QueryDelegatorUnbondingDelegationsResponse, QueryRedelegationsRequest, QueryRedelegationsResponse, QueryDelegatorValidatorsRequest, QueryDelegatorValidatorsResponse, QueryDelegatorValidatorRequest, QueryDelegatorValidatorResponse, QueryHistoricalInfoRequest, QueryHistoricalInfoResponse, QueryPoolRequest, QueryPoolResponse, QueryParamsRequest, QueryParamsResponse } from "./query"; +export const createGetValidators = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryValidatorsRequest.encode, + decode: QueryValidatorsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "Validators", + clientResolver +}); +export const useGetValidators = buildUseQuery({ + builderQueryFn: createGetValidators, + queryKeyPrefix: "ValidatorsQuery" +}); +export const createGetValidator = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryValidatorRequest.encode, + decode: QueryValidatorResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "Validator", + clientResolver +}); +export const useGetValidator = buildUseQuery({ + builderQueryFn: createGetValidator, + queryKeyPrefix: "ValidatorQuery" +}); +export const createGetValidatorDelegations = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryValidatorDelegationsRequest.encode, + decode: QueryValidatorDelegationsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "ValidatorDelegations", + clientResolver +}); +export const useGetValidatorDelegations = buildUseQuery({ + builderQueryFn: createGetValidatorDelegations, + queryKeyPrefix: "ValidatorDelegationsQuery" +}); +export const createGetValidatorUnbondingDelegations = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryValidatorUnbondingDelegationsRequest.encode, + decode: QueryValidatorUnbondingDelegationsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "ValidatorUnbondingDelegations", + clientResolver +}); +export const useGetValidatorUnbondingDelegations = buildUseQuery({ + builderQueryFn: createGetValidatorUnbondingDelegations, + queryKeyPrefix: "ValidatorUnbondingDelegationsQuery" +}); +export const createGetDelegation = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryDelegationRequest.encode, + decode: QueryDelegationResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "Delegation", + clientResolver +}); +export const useGetDelegation = buildUseQuery({ + builderQueryFn: createGetDelegation, + queryKeyPrefix: "DelegationQuery" +}); +export const createGetUnbondingDelegation = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryUnbondingDelegationRequest.encode, + decode: QueryUnbondingDelegationResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "UnbondingDelegation", + clientResolver +}); +export const useGetUnbondingDelegation = buildUseQuery({ + builderQueryFn: createGetUnbondingDelegation, + queryKeyPrefix: "UnbondingDelegationQuery" +}); +export const createGetDelegatorDelegations = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryDelegatorDelegationsRequest.encode, + decode: QueryDelegatorDelegationsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "DelegatorDelegations", + clientResolver +}); +export const useGetDelegatorDelegations = buildUseQuery({ + builderQueryFn: createGetDelegatorDelegations, + queryKeyPrefix: "DelegatorDelegationsQuery" +}); +export const createGetDelegatorUnbondingDelegations = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryDelegatorUnbondingDelegationsRequest.encode, + decode: QueryDelegatorUnbondingDelegationsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "DelegatorUnbondingDelegations", + clientResolver +}); +export const useGetDelegatorUnbondingDelegations = buildUseQuery({ + builderQueryFn: createGetDelegatorUnbondingDelegations, + queryKeyPrefix: "DelegatorUnbondingDelegationsQuery" +}); +export const createGetRedelegations = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryRedelegationsRequest.encode, + decode: QueryRedelegationsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "Redelegations", + clientResolver +}); +export const useGetRedelegations = buildUseQuery({ + builderQueryFn: createGetRedelegations, + queryKeyPrefix: "RedelegationsQuery" +}); +export const createGetDelegatorValidators = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryDelegatorValidatorsRequest.encode, + decode: QueryDelegatorValidatorsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "DelegatorValidators", + clientResolver +}); +export const useGetDelegatorValidators = buildUseQuery({ + builderQueryFn: createGetDelegatorValidators, + queryKeyPrefix: "DelegatorValidatorsQuery" +}); +export const createGetDelegatorValidator = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryDelegatorValidatorRequest.encode, + decode: QueryDelegatorValidatorResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "DelegatorValidator", + clientResolver +}); +export const useGetDelegatorValidator = buildUseQuery({ + builderQueryFn: createGetDelegatorValidator, + queryKeyPrefix: "DelegatorValidatorQuery" +}); +export const createGetHistoricalInfo = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryHistoricalInfoRequest.encode, + decode: QueryHistoricalInfoResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "HistoricalInfo", + clientResolver +}); +export const useGetHistoricalInfo = buildUseQuery({ + builderQueryFn: createGetHistoricalInfo, + queryKeyPrefix: "HistoricalInfoQuery" +}); +export const createGetPool = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryPoolRequest.encode, + decode: QueryPoolResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "Pool", + clientResolver +}); +export const useGetPool = buildUseQuery({ + builderQueryFn: createGetPool, + queryKeyPrefix: "PoolQuery" +}); +export const createGetParams = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmos.staking.v1beta1.Query", + method: "Params", + clientResolver +}); +export const useGetParams = buildUseQuery({ + builderQueryFn: createGetParams, + queryKeyPrefix: "ParamsQuery" +}); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/staking/v1beta1/query.ts b/libs/interchain-query/src/cosmos/staking/v1beta1/query.ts new file mode 100644 index 00000000..f4754096 --- /dev/null +++ b/libs/interchain-query/src/cosmos/staking/v1beta1/query.ts @@ -0,0 +1,3073 @@ +import { PageRequest, PageRequestAmino, PageResponse, PageResponseAmino } from "../../base/query/v1beta1/pagination"; +import { Validator, ValidatorAmino, DelegationResponse, DelegationResponseAmino, UnbondingDelegation, UnbondingDelegationAmino, RedelegationResponse, RedelegationResponseAmino, HistoricalInfo, HistoricalInfoAmino, Pool, PoolAmino, Params, ParamsAmino } from "./staking"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; +/** QueryValidatorsRequest is request type for Query/Validators RPC method. */ +export interface QueryValidatorsRequest { + /** status enables to query for validators matching a given status. */ + status: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryValidatorsRequestProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorsRequest"; + value: Uint8Array; +} +/** QueryValidatorsRequest is request type for Query/Validators RPC method. */ +export interface QueryValidatorsRequestAmino { + /** status enables to query for validators matching a given status. */ + status: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryValidatorsRequestAminoMsg { + type: "cosmos-sdk/QueryValidatorsRequest"; + value: QueryValidatorsRequestAmino; +} +/** QueryValidatorsResponse is response type for the Query/Validators RPC method */ +export interface QueryValidatorsResponse { + /** validators contains all the queried validators. */ + validators: Validator[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryValidatorsResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorsResponse"; + value: Uint8Array; +} +/** QueryValidatorsResponse is response type for the Query/Validators RPC method */ +export interface QueryValidatorsResponseAmino { + /** validators contains all the queried validators. */ + validators: ValidatorAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryValidatorsResponseAminoMsg { + type: "cosmos-sdk/QueryValidatorsResponse"; + value: QueryValidatorsResponseAmino; +} +/** QueryValidatorRequest is response type for the Query/Validator RPC method */ +export interface QueryValidatorRequest { + /** validator_addr defines the validator address to query for. */ + validatorAddr: string; +} +export interface QueryValidatorRequestProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorRequest"; + value: Uint8Array; +} +/** QueryValidatorRequest is response type for the Query/Validator RPC method */ +export interface QueryValidatorRequestAmino { + /** validator_addr defines the validator address to query for. */ + validator_addr: string; +} +export interface QueryValidatorRequestAminoMsg { + type: "cosmos-sdk/QueryValidatorRequest"; + value: QueryValidatorRequestAmino; +} +/** QueryValidatorResponse is response type for the Query/Validator RPC method */ +export interface QueryValidatorResponse { + /** validator defines the validator info. */ + validator: Validator; +} +export interface QueryValidatorResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorResponse"; + value: Uint8Array; +} +/** QueryValidatorResponse is response type for the Query/Validator RPC method */ +export interface QueryValidatorResponseAmino { + /** validator defines the validator info. */ + validator: ValidatorAmino; +} +export interface QueryValidatorResponseAminoMsg { + type: "cosmos-sdk/QueryValidatorResponse"; + value: QueryValidatorResponseAmino; +} +/** + * QueryValidatorDelegationsRequest is request type for the + * Query/ValidatorDelegations RPC method + */ +export interface QueryValidatorDelegationsRequest { + /** validator_addr defines the validator address to query for. */ + validatorAddr: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryValidatorDelegationsRequestProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorDelegationsRequest"; + value: Uint8Array; +} +/** + * QueryValidatorDelegationsRequest is request type for the + * Query/ValidatorDelegations RPC method + */ +export interface QueryValidatorDelegationsRequestAmino { + /** validator_addr defines the validator address to query for. */ + validator_addr: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryValidatorDelegationsRequestAminoMsg { + type: "cosmos-sdk/QueryValidatorDelegationsRequest"; + value: QueryValidatorDelegationsRequestAmino; +} +/** + * QueryValidatorDelegationsResponse is response type for the + * Query/ValidatorDelegations RPC method + */ +export interface QueryValidatorDelegationsResponse { + delegationResponses: DelegationResponse[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryValidatorDelegationsResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorDelegationsResponse"; + value: Uint8Array; +} +/** + * QueryValidatorDelegationsResponse is response type for the + * Query/ValidatorDelegations RPC method + */ +export interface QueryValidatorDelegationsResponseAmino { + delegation_responses: DelegationResponseAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryValidatorDelegationsResponseAminoMsg { + type: "cosmos-sdk/QueryValidatorDelegationsResponse"; + value: QueryValidatorDelegationsResponseAmino; +} +/** + * QueryValidatorUnbondingDelegationsRequest is required type for the + * Query/ValidatorUnbondingDelegations RPC method + */ +export interface QueryValidatorUnbondingDelegationsRequest { + /** validator_addr defines the validator address to query for. */ + validatorAddr: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryValidatorUnbondingDelegationsRequestProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest"; + value: Uint8Array; +} +/** + * QueryValidatorUnbondingDelegationsRequest is required type for the + * Query/ValidatorUnbondingDelegations RPC method + */ +export interface QueryValidatorUnbondingDelegationsRequestAmino { + /** validator_addr defines the validator address to query for. */ + validator_addr: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryValidatorUnbondingDelegationsRequestAminoMsg { + type: "cosmos-sdk/QueryValidatorUnbondingDelegationsRequest"; + value: QueryValidatorUnbondingDelegationsRequestAmino; +} +/** + * QueryValidatorUnbondingDelegationsResponse is response type for the + * Query/ValidatorUnbondingDelegations RPC method. + */ +export interface QueryValidatorUnbondingDelegationsResponse { + unbondingResponses: UnbondingDelegation[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryValidatorUnbondingDelegationsResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse"; + value: Uint8Array; +} +/** + * QueryValidatorUnbondingDelegationsResponse is response type for the + * Query/ValidatorUnbondingDelegations RPC method. + */ +export interface QueryValidatorUnbondingDelegationsResponseAmino { + unbonding_responses: UnbondingDelegationAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryValidatorUnbondingDelegationsResponseAminoMsg { + type: "cosmos-sdk/QueryValidatorUnbondingDelegationsResponse"; + value: QueryValidatorUnbondingDelegationsResponseAmino; +} +/** QueryDelegationRequest is request type for the Query/Delegation RPC method. */ +export interface QueryDelegationRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** validator_addr defines the validator address to query for. */ + validatorAddr: string; +} +export interface QueryDelegationRequestProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegationRequest"; + value: Uint8Array; +} +/** QueryDelegationRequest is request type for the Query/Delegation RPC method. */ +export interface QueryDelegationRequestAmino { + /** delegator_addr defines the delegator address to query for. */ + delegator_addr: string; + /** validator_addr defines the validator address to query for. */ + validator_addr: string; +} +export interface QueryDelegationRequestAminoMsg { + type: "cosmos-sdk/QueryDelegationRequest"; + value: QueryDelegationRequestAmino; +} +/** QueryDelegationResponse is response type for the Query/Delegation RPC method. */ +export interface QueryDelegationResponse { + /** delegation_responses defines the delegation info of a delegation. */ + delegationResponse?: DelegationResponse; +} +export interface QueryDelegationResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegationResponse"; + value: Uint8Array; +} +/** QueryDelegationResponse is response type for the Query/Delegation RPC method. */ +export interface QueryDelegationResponseAmino { + /** delegation_responses defines the delegation info of a delegation. */ + delegation_response?: DelegationResponseAmino; +} +export interface QueryDelegationResponseAminoMsg { + type: "cosmos-sdk/QueryDelegationResponse"; + value: QueryDelegationResponseAmino; +} +/** + * QueryUnbondingDelegationRequest is request type for the + * Query/UnbondingDelegation RPC method. + */ +export interface QueryUnbondingDelegationRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** validator_addr defines the validator address to query for. */ + validatorAddr: string; +} +export interface QueryUnbondingDelegationRequestProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryUnbondingDelegationRequest"; + value: Uint8Array; +} +/** + * QueryUnbondingDelegationRequest is request type for the + * Query/UnbondingDelegation RPC method. + */ +export interface QueryUnbondingDelegationRequestAmino { + /** delegator_addr defines the delegator address to query for. */ + delegator_addr: string; + /** validator_addr defines the validator address to query for. */ + validator_addr: string; +} +export interface QueryUnbondingDelegationRequestAminoMsg { + type: "cosmos-sdk/QueryUnbondingDelegationRequest"; + value: QueryUnbondingDelegationRequestAmino; +} +/** + * QueryDelegationResponse is response type for the Query/UnbondingDelegation + * RPC method. + */ +export interface QueryUnbondingDelegationResponse { + /** unbond defines the unbonding information of a delegation. */ + unbond: UnbondingDelegation; +} +export interface QueryUnbondingDelegationResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryUnbondingDelegationResponse"; + value: Uint8Array; +} +/** + * QueryDelegationResponse is response type for the Query/UnbondingDelegation + * RPC method. + */ +export interface QueryUnbondingDelegationResponseAmino { + /** unbond defines the unbonding information of a delegation. */ + unbond: UnbondingDelegationAmino; +} +export interface QueryUnbondingDelegationResponseAminoMsg { + type: "cosmos-sdk/QueryUnbondingDelegationResponse"; + value: QueryUnbondingDelegationResponseAmino; +} +/** + * QueryDelegatorDelegationsRequest is request type for the + * Query/DelegatorDelegations RPC method. + */ +export interface QueryDelegatorDelegationsRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryDelegatorDelegationsRequestProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest"; + value: Uint8Array; +} +/** + * QueryDelegatorDelegationsRequest is request type for the + * Query/DelegatorDelegations RPC method. + */ +export interface QueryDelegatorDelegationsRequestAmino { + /** delegator_addr defines the delegator address to query for. */ + delegator_addr: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryDelegatorDelegationsRequestAminoMsg { + type: "cosmos-sdk/QueryDelegatorDelegationsRequest"; + value: QueryDelegatorDelegationsRequestAmino; +} +/** + * QueryDelegatorDelegationsResponse is response type for the + * Query/DelegatorDelegations RPC method. + */ +export interface QueryDelegatorDelegationsResponse { + /** delegation_responses defines all the delegations' info of a delegator. */ + delegationResponses: DelegationResponse[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryDelegatorDelegationsResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse"; + value: Uint8Array; +} +/** + * QueryDelegatorDelegationsResponse is response type for the + * Query/DelegatorDelegations RPC method. + */ +export interface QueryDelegatorDelegationsResponseAmino { + /** delegation_responses defines all the delegations' info of a delegator. */ + delegation_responses: DelegationResponseAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryDelegatorDelegationsResponseAminoMsg { + type: "cosmos-sdk/QueryDelegatorDelegationsResponse"; + value: QueryDelegatorDelegationsResponseAmino; +} +/** + * QueryDelegatorUnbondingDelegationsRequest is request type for the + * Query/DelegatorUnbondingDelegations RPC method. + */ +export interface QueryDelegatorUnbondingDelegationsRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryDelegatorUnbondingDelegationsRequestProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest"; + value: Uint8Array; +} +/** + * QueryDelegatorUnbondingDelegationsRequest is request type for the + * Query/DelegatorUnbondingDelegations RPC method. + */ +export interface QueryDelegatorUnbondingDelegationsRequestAmino { + /** delegator_addr defines the delegator address to query for. */ + delegator_addr: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryDelegatorUnbondingDelegationsRequestAminoMsg { + type: "cosmos-sdk/QueryDelegatorUnbondingDelegationsRequest"; + value: QueryDelegatorUnbondingDelegationsRequestAmino; +} +/** + * QueryUnbondingDelegatorDelegationsResponse is response type for the + * Query/UnbondingDelegatorDelegations RPC method. + */ +export interface QueryDelegatorUnbondingDelegationsResponse { + unbondingResponses: UnbondingDelegation[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryDelegatorUnbondingDelegationsResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse"; + value: Uint8Array; +} +/** + * QueryUnbondingDelegatorDelegationsResponse is response type for the + * Query/UnbondingDelegatorDelegations RPC method. + */ +export interface QueryDelegatorUnbondingDelegationsResponseAmino { + unbonding_responses: UnbondingDelegationAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryDelegatorUnbondingDelegationsResponseAminoMsg { + type: "cosmos-sdk/QueryDelegatorUnbondingDelegationsResponse"; + value: QueryDelegatorUnbondingDelegationsResponseAmino; +} +/** + * QueryRedelegationsRequest is request type for the Query/Redelegations RPC + * method. + */ +export interface QueryRedelegationsRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** src_validator_addr defines the validator address to redelegate from. */ + srcValidatorAddr: string; + /** dst_validator_addr defines the validator address to redelegate to. */ + dstValidatorAddr: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryRedelegationsRequestProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryRedelegationsRequest"; + value: Uint8Array; +} +/** + * QueryRedelegationsRequest is request type for the Query/Redelegations RPC + * method. + */ +export interface QueryRedelegationsRequestAmino { + /** delegator_addr defines the delegator address to query for. */ + delegator_addr: string; + /** src_validator_addr defines the validator address to redelegate from. */ + src_validator_addr: string; + /** dst_validator_addr defines the validator address to redelegate to. */ + dst_validator_addr: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryRedelegationsRequestAminoMsg { + type: "cosmos-sdk/QueryRedelegationsRequest"; + value: QueryRedelegationsRequestAmino; +} +/** + * QueryRedelegationsResponse is response type for the Query/Redelegations RPC + * method. + */ +export interface QueryRedelegationsResponse { + redelegationResponses: RedelegationResponse[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryRedelegationsResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryRedelegationsResponse"; + value: Uint8Array; +} +/** + * QueryRedelegationsResponse is response type for the Query/Redelegations RPC + * method. + */ +export interface QueryRedelegationsResponseAmino { + redelegation_responses: RedelegationResponseAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryRedelegationsResponseAminoMsg { + type: "cosmos-sdk/QueryRedelegationsResponse"; + value: QueryRedelegationsResponseAmino; +} +/** + * QueryDelegatorValidatorsRequest is request type for the + * Query/DelegatorValidators RPC method. + */ +export interface QueryDelegatorValidatorsRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryDelegatorValidatorsRequestProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest"; + value: Uint8Array; +} +/** + * QueryDelegatorValidatorsRequest is request type for the + * Query/DelegatorValidators RPC method. + */ +export interface QueryDelegatorValidatorsRequestAmino { + /** delegator_addr defines the delegator address to query for. */ + delegator_addr: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryDelegatorValidatorsRequestAminoMsg { + type: "cosmos-sdk/QueryDelegatorValidatorsRequest"; + value: QueryDelegatorValidatorsRequestAmino; +} +/** + * QueryDelegatorValidatorsResponse is response type for the + * Query/DelegatorValidators RPC method. + */ +export interface QueryDelegatorValidatorsResponse { + /** validators defines the validators' info of a delegator. */ + validators: Validator[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryDelegatorValidatorsResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse"; + value: Uint8Array; +} +/** + * QueryDelegatorValidatorsResponse is response type for the + * Query/DelegatorValidators RPC method. + */ +export interface QueryDelegatorValidatorsResponseAmino { + /** validators defines the validators' info of a delegator. */ + validators: ValidatorAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryDelegatorValidatorsResponseAminoMsg { + type: "cosmos-sdk/QueryDelegatorValidatorsResponse"; + value: QueryDelegatorValidatorsResponseAmino; +} +/** + * QueryDelegatorValidatorRequest is request type for the + * Query/DelegatorValidator RPC method. + */ +export interface QueryDelegatorValidatorRequest { + /** delegator_addr defines the delegator address to query for. */ + delegatorAddr: string; + /** validator_addr defines the validator address to query for. */ + validatorAddr: string; +} +export interface QueryDelegatorValidatorRequestProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorRequest"; + value: Uint8Array; +} +/** + * QueryDelegatorValidatorRequest is request type for the + * Query/DelegatorValidator RPC method. + */ +export interface QueryDelegatorValidatorRequestAmino { + /** delegator_addr defines the delegator address to query for. */ + delegator_addr: string; + /** validator_addr defines the validator address to query for. */ + validator_addr: string; +} +export interface QueryDelegatorValidatorRequestAminoMsg { + type: "cosmos-sdk/QueryDelegatorValidatorRequest"; + value: QueryDelegatorValidatorRequestAmino; +} +/** + * QueryDelegatorValidatorResponse response type for the + * Query/DelegatorValidator RPC method. + */ +export interface QueryDelegatorValidatorResponse { + /** validator defines the validator info. */ + validator: Validator; +} +export interface QueryDelegatorValidatorResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorResponse"; + value: Uint8Array; +} +/** + * QueryDelegatorValidatorResponse response type for the + * Query/DelegatorValidator RPC method. + */ +export interface QueryDelegatorValidatorResponseAmino { + /** validator defines the validator info. */ + validator: ValidatorAmino; +} +export interface QueryDelegatorValidatorResponseAminoMsg { + type: "cosmos-sdk/QueryDelegatorValidatorResponse"; + value: QueryDelegatorValidatorResponseAmino; +} +/** + * QueryHistoricalInfoRequest is request type for the Query/HistoricalInfo RPC + * method. + */ +export interface QueryHistoricalInfoRequest { + /** height defines at which height to query the historical info. */ + height: bigint; +} +export interface QueryHistoricalInfoRequestProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryHistoricalInfoRequest"; + value: Uint8Array; +} +/** + * QueryHistoricalInfoRequest is request type for the Query/HistoricalInfo RPC + * method. + */ +export interface QueryHistoricalInfoRequestAmino { + /** height defines at which height to query the historical info. */ + height: string; +} +export interface QueryHistoricalInfoRequestAminoMsg { + type: "cosmos-sdk/QueryHistoricalInfoRequest"; + value: QueryHistoricalInfoRequestAmino; +} +/** + * QueryHistoricalInfoResponse is response type for the Query/HistoricalInfo RPC + * method. + */ +export interface QueryHistoricalInfoResponse { + /** hist defines the historical info at the given height. */ + hist?: HistoricalInfo; +} +export interface QueryHistoricalInfoResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryHistoricalInfoResponse"; + value: Uint8Array; +} +/** + * QueryHistoricalInfoResponse is response type for the Query/HistoricalInfo RPC + * method. + */ +export interface QueryHistoricalInfoResponseAmino { + /** hist defines the historical info at the given height. */ + hist?: HistoricalInfoAmino; +} +export interface QueryHistoricalInfoResponseAminoMsg { + type: "cosmos-sdk/QueryHistoricalInfoResponse"; + value: QueryHistoricalInfoResponseAmino; +} +/** QueryPoolRequest is request type for the Query/Pool RPC method. */ +export interface QueryPoolRequest {} +export interface QueryPoolRequestProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryPoolRequest"; + value: Uint8Array; +} +/** QueryPoolRequest is request type for the Query/Pool RPC method. */ +export interface QueryPoolRequestAmino {} +export interface QueryPoolRequestAminoMsg { + type: "cosmos-sdk/QueryPoolRequest"; + value: QueryPoolRequestAmino; +} +/** QueryPoolResponse is response type for the Query/Pool RPC method. */ +export interface QueryPoolResponse { + /** pool defines the pool info. */ + pool: Pool; +} +export interface QueryPoolResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryPoolResponse"; + value: Uint8Array; +} +/** QueryPoolResponse is response type for the Query/Pool RPC method. */ +export interface QueryPoolResponseAmino { + /** pool defines the pool info. */ + pool: PoolAmino; +} +export interface QueryPoolResponseAminoMsg { + type: "cosmos-sdk/QueryPoolResponse"; + value: QueryPoolResponseAmino; +} +/** QueryParamsRequest is request type for the Query/Params RPC method. */ +export interface QueryParamsRequest {} +export interface QueryParamsRequestProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryParamsRequest"; + value: Uint8Array; +} +/** QueryParamsRequest is request type for the Query/Params RPC method. */ +export interface QueryParamsRequestAmino {} +export interface QueryParamsRequestAminoMsg { + type: "cosmos-sdk/QueryParamsRequest"; + value: QueryParamsRequestAmino; +} +/** QueryParamsResponse is response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** params holds all the parameters of this module. */ + params: Params; +} +export interface QueryParamsResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.QueryParamsResponse"; + value: Uint8Array; +} +/** QueryParamsResponse is response type for the Query/Params RPC method. */ +export interface QueryParamsResponseAmino { + /** params holds all the parameters of this module. */ + params: ParamsAmino; +} +export interface QueryParamsResponseAminoMsg { + type: "cosmos-sdk/QueryParamsResponse"; + value: QueryParamsResponseAmino; +} +function createBaseQueryValidatorsRequest(): QueryValidatorsRequest { + return { + status: "", + pagination: undefined + }; +} +export const QueryValidatorsRequest = { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorsRequest", + aminoType: "cosmos-sdk/QueryValidatorsRequest", + is(o: any): o is QueryValidatorsRequest { + return o && (o.$typeUrl === QueryValidatorsRequest.typeUrl || typeof o.status === "string"); + }, + isAmino(o: any): o is QueryValidatorsRequestAmino { + return o && (o.$typeUrl === QueryValidatorsRequest.typeUrl || typeof o.status === "string"); + }, + encode(message: QueryValidatorsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.status !== "") { + writer.uint32(10).string(message.status); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.status = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryValidatorsRequest { + const message = createBaseQueryValidatorsRequest(); + message.status = object.status ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryValidatorsRequestAmino): QueryValidatorsRequest { + const message = createBaseQueryValidatorsRequest(); + if (object.status !== undefined && object.status !== null) { + message.status = object.status; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryValidatorsRequest): QueryValidatorsRequestAmino { + const obj: any = {}; + obj.status = message.status === "" ? undefined : message.status; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryValidatorsRequestAminoMsg): QueryValidatorsRequest { + return QueryValidatorsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryValidatorsRequest): QueryValidatorsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryValidatorsRequest", + value: QueryValidatorsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryValidatorsRequestProtoMsg): QueryValidatorsRequest { + return QueryValidatorsRequest.decode(message.value); + }, + toProto(message: QueryValidatorsRequest): Uint8Array { + return QueryValidatorsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryValidatorsRequest): QueryValidatorsRequestProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorsRequest", + value: QueryValidatorsRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryValidatorsRequest.typeUrl, QueryValidatorsRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryValidatorsRequest.aminoType, QueryValidatorsRequest.typeUrl); +function createBaseQueryValidatorsResponse(): QueryValidatorsResponse { + return { + validators: [], + pagination: undefined + }; +} +export const QueryValidatorsResponse = { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorsResponse", + aminoType: "cosmos-sdk/QueryValidatorsResponse", + is(o: any): o is QueryValidatorsResponse { + return o && (o.$typeUrl === QueryValidatorsResponse.typeUrl || Array.isArray(o.validators) && (!o.validators.length || Validator.is(o.validators[0]))); + }, + isAmino(o: any): o is QueryValidatorsResponseAmino { + return o && (o.$typeUrl === QueryValidatorsResponse.typeUrl || Array.isArray(o.validators) && (!o.validators.length || Validator.isAmino(o.validators[0]))); + }, + encode(message: QueryValidatorsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validators.push(Validator.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryValidatorsResponse { + const message = createBaseQueryValidatorsResponse(); + message.validators = object.validators?.map(e => Validator.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryValidatorsResponseAmino): QueryValidatorsResponse { + const message = createBaseQueryValidatorsResponse(); + message.validators = object.validators?.map(e => Validator.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryValidatorsResponse): QueryValidatorsResponseAmino { + const obj: any = {}; + if (message.validators) { + obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); + } else { + obj.validators = message.validators; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryValidatorsResponseAminoMsg): QueryValidatorsResponse { + return QueryValidatorsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryValidatorsResponse): QueryValidatorsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryValidatorsResponse", + value: QueryValidatorsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryValidatorsResponseProtoMsg): QueryValidatorsResponse { + return QueryValidatorsResponse.decode(message.value); + }, + toProto(message: QueryValidatorsResponse): Uint8Array { + return QueryValidatorsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryValidatorsResponse): QueryValidatorsResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorsResponse", + value: QueryValidatorsResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryValidatorsResponse.typeUrl, QueryValidatorsResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryValidatorsResponse.aminoType, QueryValidatorsResponse.typeUrl); +function createBaseQueryValidatorRequest(): QueryValidatorRequest { + return { + validatorAddr: "" + }; +} +export const QueryValidatorRequest = { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorRequest", + aminoType: "cosmos-sdk/QueryValidatorRequest", + is(o: any): o is QueryValidatorRequest { + return o && (o.$typeUrl === QueryValidatorRequest.typeUrl || typeof o.validatorAddr === "string"); + }, + isAmino(o: any): o is QueryValidatorRequestAmino { + return o && (o.$typeUrl === QueryValidatorRequest.typeUrl || typeof o.validator_addr === "string"); + }, + encode(message: QueryValidatorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.validatorAddr !== "") { + writer.uint32(10).string(message.validatorAddr); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validatorAddr = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryValidatorRequest { + const message = createBaseQueryValidatorRequest(); + message.validatorAddr = object.validatorAddr ?? ""; + return message; + }, + fromAmino(object: QueryValidatorRequestAmino): QueryValidatorRequest { + const message = createBaseQueryValidatorRequest(); + if (object.validator_addr !== undefined && object.validator_addr !== null) { + message.validatorAddr = object.validator_addr; + } + return message; + }, + toAmino(message: QueryValidatorRequest): QueryValidatorRequestAmino { + const obj: any = {}; + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; + return obj; + }, + fromAminoMsg(object: QueryValidatorRequestAminoMsg): QueryValidatorRequest { + return QueryValidatorRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryValidatorRequest): QueryValidatorRequestAminoMsg { + return { + type: "cosmos-sdk/QueryValidatorRequest", + value: QueryValidatorRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryValidatorRequestProtoMsg): QueryValidatorRequest { + return QueryValidatorRequest.decode(message.value); + }, + toProto(message: QueryValidatorRequest): Uint8Array { + return QueryValidatorRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryValidatorRequest): QueryValidatorRequestProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorRequest", + value: QueryValidatorRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryValidatorRequest.typeUrl, QueryValidatorRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryValidatorRequest.aminoType, QueryValidatorRequest.typeUrl); +function createBaseQueryValidatorResponse(): QueryValidatorResponse { + return { + validator: Validator.fromPartial({}) + }; +} +export const QueryValidatorResponse = { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorResponse", + aminoType: "cosmos-sdk/QueryValidatorResponse", + is(o: any): o is QueryValidatorResponse { + return o && (o.$typeUrl === QueryValidatorResponse.typeUrl || Validator.is(o.validator)); + }, + isAmino(o: any): o is QueryValidatorResponseAmino { + return o && (o.$typeUrl === QueryValidatorResponse.typeUrl || Validator.isAmino(o.validator)); + }, + encode(message: QueryValidatorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator = Validator.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryValidatorResponse { + const message = createBaseQueryValidatorResponse(); + message.validator = object.validator !== undefined && object.validator !== null ? Validator.fromPartial(object.validator) : undefined; + return message; + }, + fromAmino(object: QueryValidatorResponseAmino): QueryValidatorResponse { + const message = createBaseQueryValidatorResponse(); + if (object.validator !== undefined && object.validator !== null) { + message.validator = Validator.fromAmino(object.validator); + } + return message; + }, + toAmino(message: QueryValidatorResponse): QueryValidatorResponseAmino { + const obj: any = {}; + obj.validator = message.validator ? Validator.toAmino(message.validator) : Validator.toAmino(Validator.fromPartial({})); + return obj; + }, + fromAminoMsg(object: QueryValidatorResponseAminoMsg): QueryValidatorResponse { + return QueryValidatorResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryValidatorResponse): QueryValidatorResponseAminoMsg { + return { + type: "cosmos-sdk/QueryValidatorResponse", + value: QueryValidatorResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryValidatorResponseProtoMsg): QueryValidatorResponse { + return QueryValidatorResponse.decode(message.value); + }, + toProto(message: QueryValidatorResponse): Uint8Array { + return QueryValidatorResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryValidatorResponse): QueryValidatorResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorResponse", + value: QueryValidatorResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryValidatorResponse.typeUrl, QueryValidatorResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryValidatorResponse.aminoType, QueryValidatorResponse.typeUrl); +function createBaseQueryValidatorDelegationsRequest(): QueryValidatorDelegationsRequest { + return { + validatorAddr: "", + pagination: undefined + }; +} +export const QueryValidatorDelegationsRequest = { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorDelegationsRequest", + aminoType: "cosmos-sdk/QueryValidatorDelegationsRequest", + is(o: any): o is QueryValidatorDelegationsRequest { + return o && (o.$typeUrl === QueryValidatorDelegationsRequest.typeUrl || typeof o.validatorAddr === "string"); + }, + isAmino(o: any): o is QueryValidatorDelegationsRequestAmino { + return o && (o.$typeUrl === QueryValidatorDelegationsRequest.typeUrl || typeof o.validator_addr === "string"); + }, + encode(message: QueryValidatorDelegationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.validatorAddr !== "") { + writer.uint32(10).string(message.validatorAddr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorDelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validatorAddr = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryValidatorDelegationsRequest { + const message = createBaseQueryValidatorDelegationsRequest(); + message.validatorAddr = object.validatorAddr ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryValidatorDelegationsRequestAmino): QueryValidatorDelegationsRequest { + const message = createBaseQueryValidatorDelegationsRequest(); + if (object.validator_addr !== undefined && object.validator_addr !== null) { + message.validatorAddr = object.validator_addr; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryValidatorDelegationsRequest): QueryValidatorDelegationsRequestAmino { + const obj: any = {}; + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryValidatorDelegationsRequestAminoMsg): QueryValidatorDelegationsRequest { + return QueryValidatorDelegationsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryValidatorDelegationsRequest): QueryValidatorDelegationsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryValidatorDelegationsRequest", + value: QueryValidatorDelegationsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryValidatorDelegationsRequestProtoMsg): QueryValidatorDelegationsRequest { + return QueryValidatorDelegationsRequest.decode(message.value); + }, + toProto(message: QueryValidatorDelegationsRequest): Uint8Array { + return QueryValidatorDelegationsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryValidatorDelegationsRequest): QueryValidatorDelegationsRequestProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorDelegationsRequest", + value: QueryValidatorDelegationsRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryValidatorDelegationsRequest.typeUrl, QueryValidatorDelegationsRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryValidatorDelegationsRequest.aminoType, QueryValidatorDelegationsRequest.typeUrl); +function createBaseQueryValidatorDelegationsResponse(): QueryValidatorDelegationsResponse { + return { + delegationResponses: [], + pagination: undefined + }; +} +export const QueryValidatorDelegationsResponse = { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorDelegationsResponse", + aminoType: "cosmos-sdk/QueryValidatorDelegationsResponse", + is(o: any): o is QueryValidatorDelegationsResponse { + return o && (o.$typeUrl === QueryValidatorDelegationsResponse.typeUrl || Array.isArray(o.delegationResponses) && (!o.delegationResponses.length || DelegationResponse.is(o.delegationResponses[0]))); + }, + isAmino(o: any): o is QueryValidatorDelegationsResponseAmino { + return o && (o.$typeUrl === QueryValidatorDelegationsResponse.typeUrl || Array.isArray(o.delegation_responses) && (!o.delegation_responses.length || DelegationResponse.isAmino(o.delegation_responses[0]))); + }, + encode(message: QueryValidatorDelegationsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.delegationResponses) { + DelegationResponse.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorDelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorDelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegationResponses.push(DelegationResponse.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryValidatorDelegationsResponse { + const message = createBaseQueryValidatorDelegationsResponse(); + message.delegationResponses = object.delegationResponses?.map(e => DelegationResponse.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryValidatorDelegationsResponseAmino): QueryValidatorDelegationsResponse { + const message = createBaseQueryValidatorDelegationsResponse(); + message.delegationResponses = object.delegation_responses?.map(e => DelegationResponse.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryValidatorDelegationsResponse): QueryValidatorDelegationsResponseAmino { + const obj: any = {}; + if (message.delegationResponses) { + obj.delegation_responses = message.delegationResponses.map(e => e ? DelegationResponse.toAmino(e) : undefined); + } else { + obj.delegation_responses = message.delegationResponses; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryValidatorDelegationsResponseAminoMsg): QueryValidatorDelegationsResponse { + return QueryValidatorDelegationsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryValidatorDelegationsResponse): QueryValidatorDelegationsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryValidatorDelegationsResponse", + value: QueryValidatorDelegationsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryValidatorDelegationsResponseProtoMsg): QueryValidatorDelegationsResponse { + return QueryValidatorDelegationsResponse.decode(message.value); + }, + toProto(message: QueryValidatorDelegationsResponse): Uint8Array { + return QueryValidatorDelegationsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryValidatorDelegationsResponse): QueryValidatorDelegationsResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorDelegationsResponse", + value: QueryValidatorDelegationsResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryValidatorDelegationsResponse.typeUrl, QueryValidatorDelegationsResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryValidatorDelegationsResponse.aminoType, QueryValidatorDelegationsResponse.typeUrl); +function createBaseQueryValidatorUnbondingDelegationsRequest(): QueryValidatorUnbondingDelegationsRequest { + return { + validatorAddr: "", + pagination: undefined + }; +} +export const QueryValidatorUnbondingDelegationsRequest = { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest", + aminoType: "cosmos-sdk/QueryValidatorUnbondingDelegationsRequest", + is(o: any): o is QueryValidatorUnbondingDelegationsRequest { + return o && (o.$typeUrl === QueryValidatorUnbondingDelegationsRequest.typeUrl || typeof o.validatorAddr === "string"); + }, + isAmino(o: any): o is QueryValidatorUnbondingDelegationsRequestAmino { + return o && (o.$typeUrl === QueryValidatorUnbondingDelegationsRequest.typeUrl || typeof o.validator_addr === "string"); + }, + encode(message: QueryValidatorUnbondingDelegationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.validatorAddr !== "") { + writer.uint32(10).string(message.validatorAddr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorUnbondingDelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorUnbondingDelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validatorAddr = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryValidatorUnbondingDelegationsRequest { + const message = createBaseQueryValidatorUnbondingDelegationsRequest(); + message.validatorAddr = object.validatorAddr ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryValidatorUnbondingDelegationsRequestAmino): QueryValidatorUnbondingDelegationsRequest { + const message = createBaseQueryValidatorUnbondingDelegationsRequest(); + if (object.validator_addr !== undefined && object.validator_addr !== null) { + message.validatorAddr = object.validator_addr; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryValidatorUnbondingDelegationsRequest): QueryValidatorUnbondingDelegationsRequestAmino { + const obj: any = {}; + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryValidatorUnbondingDelegationsRequestAminoMsg): QueryValidatorUnbondingDelegationsRequest { + return QueryValidatorUnbondingDelegationsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryValidatorUnbondingDelegationsRequest): QueryValidatorUnbondingDelegationsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryValidatorUnbondingDelegationsRequest", + value: QueryValidatorUnbondingDelegationsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryValidatorUnbondingDelegationsRequestProtoMsg): QueryValidatorUnbondingDelegationsRequest { + return QueryValidatorUnbondingDelegationsRequest.decode(message.value); + }, + toProto(message: QueryValidatorUnbondingDelegationsRequest): Uint8Array { + return QueryValidatorUnbondingDelegationsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryValidatorUnbondingDelegationsRequest): QueryValidatorUnbondingDelegationsRequestProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsRequest", + value: QueryValidatorUnbondingDelegationsRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryValidatorUnbondingDelegationsRequest.typeUrl, QueryValidatorUnbondingDelegationsRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryValidatorUnbondingDelegationsRequest.aminoType, QueryValidatorUnbondingDelegationsRequest.typeUrl); +function createBaseQueryValidatorUnbondingDelegationsResponse(): QueryValidatorUnbondingDelegationsResponse { + return { + unbondingResponses: [], + pagination: undefined + }; +} +export const QueryValidatorUnbondingDelegationsResponse = { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse", + aminoType: "cosmos-sdk/QueryValidatorUnbondingDelegationsResponse", + is(o: any): o is QueryValidatorUnbondingDelegationsResponse { + return o && (o.$typeUrl === QueryValidatorUnbondingDelegationsResponse.typeUrl || Array.isArray(o.unbondingResponses) && (!o.unbondingResponses.length || UnbondingDelegation.is(o.unbondingResponses[0]))); + }, + isAmino(o: any): o is QueryValidatorUnbondingDelegationsResponseAmino { + return o && (o.$typeUrl === QueryValidatorUnbondingDelegationsResponse.typeUrl || Array.isArray(o.unbonding_responses) && (!o.unbonding_responses.length || UnbondingDelegation.isAmino(o.unbonding_responses[0]))); + }, + encode(message: QueryValidatorUnbondingDelegationsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.unbondingResponses) { + UnbondingDelegation.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryValidatorUnbondingDelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryValidatorUnbondingDelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.unbondingResponses.push(UnbondingDelegation.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryValidatorUnbondingDelegationsResponse { + const message = createBaseQueryValidatorUnbondingDelegationsResponse(); + message.unbondingResponses = object.unbondingResponses?.map(e => UnbondingDelegation.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryValidatorUnbondingDelegationsResponseAmino): QueryValidatorUnbondingDelegationsResponse { + const message = createBaseQueryValidatorUnbondingDelegationsResponse(); + message.unbondingResponses = object.unbonding_responses?.map(e => UnbondingDelegation.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryValidatorUnbondingDelegationsResponse): QueryValidatorUnbondingDelegationsResponseAmino { + const obj: any = {}; + if (message.unbondingResponses) { + obj.unbonding_responses = message.unbondingResponses.map(e => e ? UnbondingDelegation.toAmino(e) : undefined); + } else { + obj.unbonding_responses = message.unbondingResponses; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryValidatorUnbondingDelegationsResponseAminoMsg): QueryValidatorUnbondingDelegationsResponse { + return QueryValidatorUnbondingDelegationsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryValidatorUnbondingDelegationsResponse): QueryValidatorUnbondingDelegationsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryValidatorUnbondingDelegationsResponse", + value: QueryValidatorUnbondingDelegationsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryValidatorUnbondingDelegationsResponseProtoMsg): QueryValidatorUnbondingDelegationsResponse { + return QueryValidatorUnbondingDelegationsResponse.decode(message.value); + }, + toProto(message: QueryValidatorUnbondingDelegationsResponse): Uint8Array { + return QueryValidatorUnbondingDelegationsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryValidatorUnbondingDelegationsResponse): QueryValidatorUnbondingDelegationsResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryValidatorUnbondingDelegationsResponse", + value: QueryValidatorUnbondingDelegationsResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryValidatorUnbondingDelegationsResponse.typeUrl, QueryValidatorUnbondingDelegationsResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryValidatorUnbondingDelegationsResponse.aminoType, QueryValidatorUnbondingDelegationsResponse.typeUrl); +function createBaseQueryDelegationRequest(): QueryDelegationRequest { + return { + delegatorAddr: "", + validatorAddr: "" + }; +} +export const QueryDelegationRequest = { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegationRequest", + aminoType: "cosmos-sdk/QueryDelegationRequest", + is(o: any): o is QueryDelegationRequest { + return o && (o.$typeUrl === QueryDelegationRequest.typeUrl || typeof o.delegatorAddr === "string" && typeof o.validatorAddr === "string"); + }, + isAmino(o: any): o is QueryDelegationRequestAmino { + return o && (o.$typeUrl === QueryDelegationRequest.typeUrl || typeof o.delegator_addr === "string" && typeof o.validator_addr === "string"); + }, + encode(message: QueryDelegationRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.validatorAddr !== "") { + writer.uint32(18).string(message.validatorAddr); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegationRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddr = reader.string(); + break; + case 2: + message.validatorAddr = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDelegationRequest { + const message = createBaseQueryDelegationRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.validatorAddr = object.validatorAddr ?? ""; + return message; + }, + fromAmino(object: QueryDelegationRequestAmino): QueryDelegationRequest { + const message = createBaseQueryDelegationRequest(); + if (object.delegator_addr !== undefined && object.delegator_addr !== null) { + message.delegatorAddr = object.delegator_addr; + } + if (object.validator_addr !== undefined && object.validator_addr !== null) { + message.validatorAddr = object.validator_addr; + } + return message; + }, + toAmino(message: QueryDelegationRequest): QueryDelegationRequestAmino { + const obj: any = {}; + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; + return obj; + }, + fromAminoMsg(object: QueryDelegationRequestAminoMsg): QueryDelegationRequest { + return QueryDelegationRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegationRequest): QueryDelegationRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDelegationRequest", + value: QueryDelegationRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegationRequestProtoMsg): QueryDelegationRequest { + return QueryDelegationRequest.decode(message.value); + }, + toProto(message: QueryDelegationRequest): Uint8Array { + return QueryDelegationRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegationRequest): QueryDelegationRequestProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegationRequest", + value: QueryDelegationRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryDelegationRequest.typeUrl, QueryDelegationRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryDelegationRequest.aminoType, QueryDelegationRequest.typeUrl); +function createBaseQueryDelegationResponse(): QueryDelegationResponse { + return { + delegationResponse: undefined + }; +} +export const QueryDelegationResponse = { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegationResponse", + aminoType: "cosmos-sdk/QueryDelegationResponse", + is(o: any): o is QueryDelegationResponse { + return o && o.$typeUrl === QueryDelegationResponse.typeUrl; + }, + isAmino(o: any): o is QueryDelegationResponseAmino { + return o && o.$typeUrl === QueryDelegationResponse.typeUrl; + }, + encode(message: QueryDelegationResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegationResponse !== undefined) { + DelegationResponse.encode(message.delegationResponse, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegationResponse = DelegationResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDelegationResponse { + const message = createBaseQueryDelegationResponse(); + message.delegationResponse = object.delegationResponse !== undefined && object.delegationResponse !== null ? DelegationResponse.fromPartial(object.delegationResponse) : undefined; + return message; + }, + fromAmino(object: QueryDelegationResponseAmino): QueryDelegationResponse { + const message = createBaseQueryDelegationResponse(); + if (object.delegation_response !== undefined && object.delegation_response !== null) { + message.delegationResponse = DelegationResponse.fromAmino(object.delegation_response); + } + return message; + }, + toAmino(message: QueryDelegationResponse): QueryDelegationResponseAmino { + const obj: any = {}; + obj.delegation_response = message.delegationResponse ? DelegationResponse.toAmino(message.delegationResponse) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDelegationResponseAminoMsg): QueryDelegationResponse { + return QueryDelegationResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegationResponse): QueryDelegationResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDelegationResponse", + value: QueryDelegationResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegationResponseProtoMsg): QueryDelegationResponse { + return QueryDelegationResponse.decode(message.value); + }, + toProto(message: QueryDelegationResponse): Uint8Array { + return QueryDelegationResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegationResponse): QueryDelegationResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegationResponse", + value: QueryDelegationResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryDelegationResponse.typeUrl, QueryDelegationResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryDelegationResponse.aminoType, QueryDelegationResponse.typeUrl); +function createBaseQueryUnbondingDelegationRequest(): QueryUnbondingDelegationRequest { + return { + delegatorAddr: "", + validatorAddr: "" + }; +} +export const QueryUnbondingDelegationRequest = { + typeUrl: "/cosmos.staking.v1beta1.QueryUnbondingDelegationRequest", + aminoType: "cosmos-sdk/QueryUnbondingDelegationRequest", + is(o: any): o is QueryUnbondingDelegationRequest { + return o && (o.$typeUrl === QueryUnbondingDelegationRequest.typeUrl || typeof o.delegatorAddr === "string" && typeof o.validatorAddr === "string"); + }, + isAmino(o: any): o is QueryUnbondingDelegationRequestAmino { + return o && (o.$typeUrl === QueryUnbondingDelegationRequest.typeUrl || typeof o.delegator_addr === "string" && typeof o.validator_addr === "string"); + }, + encode(message: QueryUnbondingDelegationRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.validatorAddr !== "") { + writer.uint32(18).string(message.validatorAddr); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryUnbondingDelegationRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUnbondingDelegationRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddr = reader.string(); + break; + case 2: + message.validatorAddr = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryUnbondingDelegationRequest { + const message = createBaseQueryUnbondingDelegationRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.validatorAddr = object.validatorAddr ?? ""; + return message; + }, + fromAmino(object: QueryUnbondingDelegationRequestAmino): QueryUnbondingDelegationRequest { + const message = createBaseQueryUnbondingDelegationRequest(); + if (object.delegator_addr !== undefined && object.delegator_addr !== null) { + message.delegatorAddr = object.delegator_addr; + } + if (object.validator_addr !== undefined && object.validator_addr !== null) { + message.validatorAddr = object.validator_addr; + } + return message; + }, + toAmino(message: QueryUnbondingDelegationRequest): QueryUnbondingDelegationRequestAmino { + const obj: any = {}; + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; + return obj; + }, + fromAminoMsg(object: QueryUnbondingDelegationRequestAminoMsg): QueryUnbondingDelegationRequest { + return QueryUnbondingDelegationRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryUnbondingDelegationRequest): QueryUnbondingDelegationRequestAminoMsg { + return { + type: "cosmos-sdk/QueryUnbondingDelegationRequest", + value: QueryUnbondingDelegationRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryUnbondingDelegationRequestProtoMsg): QueryUnbondingDelegationRequest { + return QueryUnbondingDelegationRequest.decode(message.value); + }, + toProto(message: QueryUnbondingDelegationRequest): Uint8Array { + return QueryUnbondingDelegationRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryUnbondingDelegationRequest): QueryUnbondingDelegationRequestProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryUnbondingDelegationRequest", + value: QueryUnbondingDelegationRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryUnbondingDelegationRequest.typeUrl, QueryUnbondingDelegationRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryUnbondingDelegationRequest.aminoType, QueryUnbondingDelegationRequest.typeUrl); +function createBaseQueryUnbondingDelegationResponse(): QueryUnbondingDelegationResponse { + return { + unbond: UnbondingDelegation.fromPartial({}) + }; +} +export const QueryUnbondingDelegationResponse = { + typeUrl: "/cosmos.staking.v1beta1.QueryUnbondingDelegationResponse", + aminoType: "cosmos-sdk/QueryUnbondingDelegationResponse", + is(o: any): o is QueryUnbondingDelegationResponse { + return o && (o.$typeUrl === QueryUnbondingDelegationResponse.typeUrl || UnbondingDelegation.is(o.unbond)); + }, + isAmino(o: any): o is QueryUnbondingDelegationResponseAmino { + return o && (o.$typeUrl === QueryUnbondingDelegationResponse.typeUrl || UnbondingDelegation.isAmino(o.unbond)); + }, + encode(message: QueryUnbondingDelegationResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.unbond !== undefined) { + UnbondingDelegation.encode(message.unbond, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryUnbondingDelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryUnbondingDelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.unbond = UnbondingDelegation.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryUnbondingDelegationResponse { + const message = createBaseQueryUnbondingDelegationResponse(); + message.unbond = object.unbond !== undefined && object.unbond !== null ? UnbondingDelegation.fromPartial(object.unbond) : undefined; + return message; + }, + fromAmino(object: QueryUnbondingDelegationResponseAmino): QueryUnbondingDelegationResponse { + const message = createBaseQueryUnbondingDelegationResponse(); + if (object.unbond !== undefined && object.unbond !== null) { + message.unbond = UnbondingDelegation.fromAmino(object.unbond); + } + return message; + }, + toAmino(message: QueryUnbondingDelegationResponse): QueryUnbondingDelegationResponseAmino { + const obj: any = {}; + obj.unbond = message.unbond ? UnbondingDelegation.toAmino(message.unbond) : UnbondingDelegation.toAmino(UnbondingDelegation.fromPartial({})); + return obj; + }, + fromAminoMsg(object: QueryUnbondingDelegationResponseAminoMsg): QueryUnbondingDelegationResponse { + return QueryUnbondingDelegationResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryUnbondingDelegationResponse): QueryUnbondingDelegationResponseAminoMsg { + return { + type: "cosmos-sdk/QueryUnbondingDelegationResponse", + value: QueryUnbondingDelegationResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryUnbondingDelegationResponseProtoMsg): QueryUnbondingDelegationResponse { + return QueryUnbondingDelegationResponse.decode(message.value); + }, + toProto(message: QueryUnbondingDelegationResponse): Uint8Array { + return QueryUnbondingDelegationResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryUnbondingDelegationResponse): QueryUnbondingDelegationResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryUnbondingDelegationResponse", + value: QueryUnbondingDelegationResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryUnbondingDelegationResponse.typeUrl, QueryUnbondingDelegationResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryUnbondingDelegationResponse.aminoType, QueryUnbondingDelegationResponse.typeUrl); +function createBaseQueryDelegatorDelegationsRequest(): QueryDelegatorDelegationsRequest { + return { + delegatorAddr: "", + pagination: undefined + }; +} +export const QueryDelegatorDelegationsRequest = { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest", + aminoType: "cosmos-sdk/QueryDelegatorDelegationsRequest", + is(o: any): o is QueryDelegatorDelegationsRequest { + return o && (o.$typeUrl === QueryDelegatorDelegationsRequest.typeUrl || typeof o.delegatorAddr === "string"); + }, + isAmino(o: any): o is QueryDelegatorDelegationsRequestAmino { + return o && (o.$typeUrl === QueryDelegatorDelegationsRequest.typeUrl || typeof o.delegator_addr === "string"); + }, + encode(message: QueryDelegatorDelegationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorDelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorDelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddr = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDelegatorDelegationsRequest { + const message = createBaseQueryDelegatorDelegationsRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryDelegatorDelegationsRequestAmino): QueryDelegatorDelegationsRequest { + const message = createBaseQueryDelegatorDelegationsRequest(); + if (object.delegator_addr !== undefined && object.delegator_addr !== null) { + message.delegatorAddr = object.delegator_addr; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDelegatorDelegationsRequest): QueryDelegatorDelegationsRequestAmino { + const obj: any = {}; + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDelegatorDelegationsRequestAminoMsg): QueryDelegatorDelegationsRequest { + return QueryDelegatorDelegationsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegatorDelegationsRequest): QueryDelegatorDelegationsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDelegatorDelegationsRequest", + value: QueryDelegatorDelegationsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegatorDelegationsRequestProtoMsg): QueryDelegatorDelegationsRequest { + return QueryDelegatorDelegationsRequest.decode(message.value); + }, + toProto(message: QueryDelegatorDelegationsRequest): Uint8Array { + return QueryDelegatorDelegationsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegatorDelegationsRequest): QueryDelegatorDelegationsRequestProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorDelegationsRequest", + value: QueryDelegatorDelegationsRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryDelegatorDelegationsRequest.typeUrl, QueryDelegatorDelegationsRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryDelegatorDelegationsRequest.aminoType, QueryDelegatorDelegationsRequest.typeUrl); +function createBaseQueryDelegatorDelegationsResponse(): QueryDelegatorDelegationsResponse { + return { + delegationResponses: [], + pagination: undefined + }; +} +export const QueryDelegatorDelegationsResponse = { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse", + aminoType: "cosmos-sdk/QueryDelegatorDelegationsResponse", + is(o: any): o is QueryDelegatorDelegationsResponse { + return o && (o.$typeUrl === QueryDelegatorDelegationsResponse.typeUrl || Array.isArray(o.delegationResponses) && (!o.delegationResponses.length || DelegationResponse.is(o.delegationResponses[0]))); + }, + isAmino(o: any): o is QueryDelegatorDelegationsResponseAmino { + return o && (o.$typeUrl === QueryDelegatorDelegationsResponse.typeUrl || Array.isArray(o.delegation_responses) && (!o.delegation_responses.length || DelegationResponse.isAmino(o.delegation_responses[0]))); + }, + encode(message: QueryDelegatorDelegationsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.delegationResponses) { + DelegationResponse.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorDelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorDelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegationResponses.push(DelegationResponse.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDelegatorDelegationsResponse { + const message = createBaseQueryDelegatorDelegationsResponse(); + message.delegationResponses = object.delegationResponses?.map(e => DelegationResponse.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryDelegatorDelegationsResponseAmino): QueryDelegatorDelegationsResponse { + const message = createBaseQueryDelegatorDelegationsResponse(); + message.delegationResponses = object.delegation_responses?.map(e => DelegationResponse.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDelegatorDelegationsResponse): QueryDelegatorDelegationsResponseAmino { + const obj: any = {}; + if (message.delegationResponses) { + obj.delegation_responses = message.delegationResponses.map(e => e ? DelegationResponse.toAmino(e) : undefined); + } else { + obj.delegation_responses = message.delegationResponses; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDelegatorDelegationsResponseAminoMsg): QueryDelegatorDelegationsResponse { + return QueryDelegatorDelegationsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegatorDelegationsResponse): QueryDelegatorDelegationsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDelegatorDelegationsResponse", + value: QueryDelegatorDelegationsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegatorDelegationsResponseProtoMsg): QueryDelegatorDelegationsResponse { + return QueryDelegatorDelegationsResponse.decode(message.value); + }, + toProto(message: QueryDelegatorDelegationsResponse): Uint8Array { + return QueryDelegatorDelegationsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegatorDelegationsResponse): QueryDelegatorDelegationsResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorDelegationsResponse", + value: QueryDelegatorDelegationsResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryDelegatorDelegationsResponse.typeUrl, QueryDelegatorDelegationsResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryDelegatorDelegationsResponse.aminoType, QueryDelegatorDelegationsResponse.typeUrl); +function createBaseQueryDelegatorUnbondingDelegationsRequest(): QueryDelegatorUnbondingDelegationsRequest { + return { + delegatorAddr: "", + pagination: undefined + }; +} +export const QueryDelegatorUnbondingDelegationsRequest = { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest", + aminoType: "cosmos-sdk/QueryDelegatorUnbondingDelegationsRequest", + is(o: any): o is QueryDelegatorUnbondingDelegationsRequest { + return o && (o.$typeUrl === QueryDelegatorUnbondingDelegationsRequest.typeUrl || typeof o.delegatorAddr === "string"); + }, + isAmino(o: any): o is QueryDelegatorUnbondingDelegationsRequestAmino { + return o && (o.$typeUrl === QueryDelegatorUnbondingDelegationsRequest.typeUrl || typeof o.delegator_addr === "string"); + }, + encode(message: QueryDelegatorUnbondingDelegationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorUnbondingDelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorUnbondingDelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddr = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDelegatorUnbondingDelegationsRequest { + const message = createBaseQueryDelegatorUnbondingDelegationsRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryDelegatorUnbondingDelegationsRequestAmino): QueryDelegatorUnbondingDelegationsRequest { + const message = createBaseQueryDelegatorUnbondingDelegationsRequest(); + if (object.delegator_addr !== undefined && object.delegator_addr !== null) { + message.delegatorAddr = object.delegator_addr; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDelegatorUnbondingDelegationsRequest): QueryDelegatorUnbondingDelegationsRequestAmino { + const obj: any = {}; + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDelegatorUnbondingDelegationsRequestAminoMsg): QueryDelegatorUnbondingDelegationsRequest { + return QueryDelegatorUnbondingDelegationsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegatorUnbondingDelegationsRequest): QueryDelegatorUnbondingDelegationsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDelegatorUnbondingDelegationsRequest", + value: QueryDelegatorUnbondingDelegationsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegatorUnbondingDelegationsRequestProtoMsg): QueryDelegatorUnbondingDelegationsRequest { + return QueryDelegatorUnbondingDelegationsRequest.decode(message.value); + }, + toProto(message: QueryDelegatorUnbondingDelegationsRequest): Uint8Array { + return QueryDelegatorUnbondingDelegationsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegatorUnbondingDelegationsRequest): QueryDelegatorUnbondingDelegationsRequestProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsRequest", + value: QueryDelegatorUnbondingDelegationsRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryDelegatorUnbondingDelegationsRequest.typeUrl, QueryDelegatorUnbondingDelegationsRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryDelegatorUnbondingDelegationsRequest.aminoType, QueryDelegatorUnbondingDelegationsRequest.typeUrl); +function createBaseQueryDelegatorUnbondingDelegationsResponse(): QueryDelegatorUnbondingDelegationsResponse { + return { + unbondingResponses: [], + pagination: undefined + }; +} +export const QueryDelegatorUnbondingDelegationsResponse = { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse", + aminoType: "cosmos-sdk/QueryDelegatorUnbondingDelegationsResponse", + is(o: any): o is QueryDelegatorUnbondingDelegationsResponse { + return o && (o.$typeUrl === QueryDelegatorUnbondingDelegationsResponse.typeUrl || Array.isArray(o.unbondingResponses) && (!o.unbondingResponses.length || UnbondingDelegation.is(o.unbondingResponses[0]))); + }, + isAmino(o: any): o is QueryDelegatorUnbondingDelegationsResponseAmino { + return o && (o.$typeUrl === QueryDelegatorUnbondingDelegationsResponse.typeUrl || Array.isArray(o.unbonding_responses) && (!o.unbonding_responses.length || UnbondingDelegation.isAmino(o.unbonding_responses[0]))); + }, + encode(message: QueryDelegatorUnbondingDelegationsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.unbondingResponses) { + UnbondingDelegation.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorUnbondingDelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorUnbondingDelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.unbondingResponses.push(UnbondingDelegation.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDelegatorUnbondingDelegationsResponse { + const message = createBaseQueryDelegatorUnbondingDelegationsResponse(); + message.unbondingResponses = object.unbondingResponses?.map(e => UnbondingDelegation.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryDelegatorUnbondingDelegationsResponseAmino): QueryDelegatorUnbondingDelegationsResponse { + const message = createBaseQueryDelegatorUnbondingDelegationsResponse(); + message.unbondingResponses = object.unbonding_responses?.map(e => UnbondingDelegation.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDelegatorUnbondingDelegationsResponse): QueryDelegatorUnbondingDelegationsResponseAmino { + const obj: any = {}; + if (message.unbondingResponses) { + obj.unbonding_responses = message.unbondingResponses.map(e => e ? UnbondingDelegation.toAmino(e) : undefined); + } else { + obj.unbonding_responses = message.unbondingResponses; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDelegatorUnbondingDelegationsResponseAminoMsg): QueryDelegatorUnbondingDelegationsResponse { + return QueryDelegatorUnbondingDelegationsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegatorUnbondingDelegationsResponse): QueryDelegatorUnbondingDelegationsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDelegatorUnbondingDelegationsResponse", + value: QueryDelegatorUnbondingDelegationsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegatorUnbondingDelegationsResponseProtoMsg): QueryDelegatorUnbondingDelegationsResponse { + return QueryDelegatorUnbondingDelegationsResponse.decode(message.value); + }, + toProto(message: QueryDelegatorUnbondingDelegationsResponse): Uint8Array { + return QueryDelegatorUnbondingDelegationsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegatorUnbondingDelegationsResponse): QueryDelegatorUnbondingDelegationsResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorUnbondingDelegationsResponse", + value: QueryDelegatorUnbondingDelegationsResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryDelegatorUnbondingDelegationsResponse.typeUrl, QueryDelegatorUnbondingDelegationsResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryDelegatorUnbondingDelegationsResponse.aminoType, QueryDelegatorUnbondingDelegationsResponse.typeUrl); +function createBaseQueryRedelegationsRequest(): QueryRedelegationsRequest { + return { + delegatorAddr: "", + srcValidatorAddr: "", + dstValidatorAddr: "", + pagination: undefined + }; +} +export const QueryRedelegationsRequest = { + typeUrl: "/cosmos.staking.v1beta1.QueryRedelegationsRequest", + aminoType: "cosmos-sdk/QueryRedelegationsRequest", + is(o: any): o is QueryRedelegationsRequest { + return o && (o.$typeUrl === QueryRedelegationsRequest.typeUrl || typeof o.delegatorAddr === "string" && typeof o.srcValidatorAddr === "string" && typeof o.dstValidatorAddr === "string"); + }, + isAmino(o: any): o is QueryRedelegationsRequestAmino { + return o && (o.$typeUrl === QueryRedelegationsRequest.typeUrl || typeof o.delegator_addr === "string" && typeof o.src_validator_addr === "string" && typeof o.dst_validator_addr === "string"); + }, + encode(message: QueryRedelegationsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.srcValidatorAddr !== "") { + writer.uint32(18).string(message.srcValidatorAddr); + } + if (message.dstValidatorAddr !== "") { + writer.uint32(26).string(message.dstValidatorAddr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryRedelegationsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRedelegationsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddr = reader.string(); + break; + case 2: + message.srcValidatorAddr = reader.string(); + break; + case 3: + message.dstValidatorAddr = reader.string(); + break; + case 4: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryRedelegationsRequest { + const message = createBaseQueryRedelegationsRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.srcValidatorAddr = object.srcValidatorAddr ?? ""; + message.dstValidatorAddr = object.dstValidatorAddr ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryRedelegationsRequestAmino): QueryRedelegationsRequest { + const message = createBaseQueryRedelegationsRequest(); + if (object.delegator_addr !== undefined && object.delegator_addr !== null) { + message.delegatorAddr = object.delegator_addr; + } + if (object.src_validator_addr !== undefined && object.src_validator_addr !== null) { + message.srcValidatorAddr = object.src_validator_addr; + } + if (object.dst_validator_addr !== undefined && object.dst_validator_addr !== null) { + message.dstValidatorAddr = object.dst_validator_addr; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryRedelegationsRequest): QueryRedelegationsRequestAmino { + const obj: any = {}; + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; + obj.src_validator_addr = message.srcValidatorAddr === "" ? undefined : message.srcValidatorAddr; + obj.dst_validator_addr = message.dstValidatorAddr === "" ? undefined : message.dstValidatorAddr; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryRedelegationsRequestAminoMsg): QueryRedelegationsRequest { + return QueryRedelegationsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryRedelegationsRequest): QueryRedelegationsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryRedelegationsRequest", + value: QueryRedelegationsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryRedelegationsRequestProtoMsg): QueryRedelegationsRequest { + return QueryRedelegationsRequest.decode(message.value); + }, + toProto(message: QueryRedelegationsRequest): Uint8Array { + return QueryRedelegationsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryRedelegationsRequest): QueryRedelegationsRequestProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryRedelegationsRequest", + value: QueryRedelegationsRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryRedelegationsRequest.typeUrl, QueryRedelegationsRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryRedelegationsRequest.aminoType, QueryRedelegationsRequest.typeUrl); +function createBaseQueryRedelegationsResponse(): QueryRedelegationsResponse { + return { + redelegationResponses: [], + pagination: undefined + }; +} +export const QueryRedelegationsResponse = { + typeUrl: "/cosmos.staking.v1beta1.QueryRedelegationsResponse", + aminoType: "cosmos-sdk/QueryRedelegationsResponse", + is(o: any): o is QueryRedelegationsResponse { + return o && (o.$typeUrl === QueryRedelegationsResponse.typeUrl || Array.isArray(o.redelegationResponses) && (!o.redelegationResponses.length || RedelegationResponse.is(o.redelegationResponses[0]))); + }, + isAmino(o: any): o is QueryRedelegationsResponseAmino { + return o && (o.$typeUrl === QueryRedelegationsResponse.typeUrl || Array.isArray(o.redelegation_responses) && (!o.redelegation_responses.length || RedelegationResponse.isAmino(o.redelegation_responses[0]))); + }, + encode(message: QueryRedelegationsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.redelegationResponses) { + RedelegationResponse.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryRedelegationsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRedelegationsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.redelegationResponses.push(RedelegationResponse.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryRedelegationsResponse { + const message = createBaseQueryRedelegationsResponse(); + message.redelegationResponses = object.redelegationResponses?.map(e => RedelegationResponse.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryRedelegationsResponseAmino): QueryRedelegationsResponse { + const message = createBaseQueryRedelegationsResponse(); + message.redelegationResponses = object.redelegation_responses?.map(e => RedelegationResponse.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryRedelegationsResponse): QueryRedelegationsResponseAmino { + const obj: any = {}; + if (message.redelegationResponses) { + obj.redelegation_responses = message.redelegationResponses.map(e => e ? RedelegationResponse.toAmino(e) : undefined); + } else { + obj.redelegation_responses = message.redelegationResponses; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryRedelegationsResponseAminoMsg): QueryRedelegationsResponse { + return QueryRedelegationsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryRedelegationsResponse): QueryRedelegationsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryRedelegationsResponse", + value: QueryRedelegationsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryRedelegationsResponseProtoMsg): QueryRedelegationsResponse { + return QueryRedelegationsResponse.decode(message.value); + }, + toProto(message: QueryRedelegationsResponse): Uint8Array { + return QueryRedelegationsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryRedelegationsResponse): QueryRedelegationsResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryRedelegationsResponse", + value: QueryRedelegationsResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryRedelegationsResponse.typeUrl, QueryRedelegationsResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryRedelegationsResponse.aminoType, QueryRedelegationsResponse.typeUrl); +function createBaseQueryDelegatorValidatorsRequest(): QueryDelegatorValidatorsRequest { + return { + delegatorAddr: "", + pagination: undefined + }; +} +export const QueryDelegatorValidatorsRequest = { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest", + aminoType: "cosmos-sdk/QueryDelegatorValidatorsRequest", + is(o: any): o is QueryDelegatorValidatorsRequest { + return o && (o.$typeUrl === QueryDelegatorValidatorsRequest.typeUrl || typeof o.delegatorAddr === "string"); + }, + isAmino(o: any): o is QueryDelegatorValidatorsRequestAmino { + return o && (o.$typeUrl === QueryDelegatorValidatorsRequest.typeUrl || typeof o.delegator_addr === "string"); + }, + encode(message: QueryDelegatorValidatorsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddr = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryDelegatorValidatorsRequestAmino): QueryDelegatorValidatorsRequest { + const message = createBaseQueryDelegatorValidatorsRequest(); + if (object.delegator_addr !== undefined && object.delegator_addr !== null) { + message.delegatorAddr = object.delegator_addr; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDelegatorValidatorsRequest): QueryDelegatorValidatorsRequestAmino { + const obj: any = {}; + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDelegatorValidatorsRequestAminoMsg): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegatorValidatorsRequest): QueryDelegatorValidatorsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDelegatorValidatorsRequest", + value: QueryDelegatorValidatorsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegatorValidatorsRequestProtoMsg): QueryDelegatorValidatorsRequest { + return QueryDelegatorValidatorsRequest.decode(message.value); + }, + toProto(message: QueryDelegatorValidatorsRequest): Uint8Array { + return QueryDelegatorValidatorsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegatorValidatorsRequest): QueryDelegatorValidatorsRequestProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorsRequest", + value: QueryDelegatorValidatorsRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryDelegatorValidatorsRequest.typeUrl, QueryDelegatorValidatorsRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryDelegatorValidatorsRequest.aminoType, QueryDelegatorValidatorsRequest.typeUrl); +function createBaseQueryDelegatorValidatorsResponse(): QueryDelegatorValidatorsResponse { + return { + validators: [], + pagination: undefined + }; +} +export const QueryDelegatorValidatorsResponse = { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse", + aminoType: "cosmos-sdk/QueryDelegatorValidatorsResponse", + is(o: any): o is QueryDelegatorValidatorsResponse { + return o && (o.$typeUrl === QueryDelegatorValidatorsResponse.typeUrl || Array.isArray(o.validators) && (!o.validators.length || Validator.is(o.validators[0]))); + }, + isAmino(o: any): o is QueryDelegatorValidatorsResponseAmino { + return o && (o.$typeUrl === QueryDelegatorValidatorsResponse.typeUrl || Array.isArray(o.validators) && (!o.validators.length || Validator.isAmino(o.validators[0]))); + }, + encode(message: QueryDelegatorValidatorsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validators.push(Validator.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDelegatorValidatorsResponse { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map(e => Validator.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryDelegatorValidatorsResponseAmino): QueryDelegatorValidatorsResponse { + const message = createBaseQueryDelegatorValidatorsResponse(); + message.validators = object.validators?.map(e => Validator.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryDelegatorValidatorsResponse): QueryDelegatorValidatorsResponseAmino { + const obj: any = {}; + if (message.validators) { + obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); + } else { + obj.validators = message.validators; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryDelegatorValidatorsResponseAminoMsg): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegatorValidatorsResponse): QueryDelegatorValidatorsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDelegatorValidatorsResponse", + value: QueryDelegatorValidatorsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegatorValidatorsResponseProtoMsg): QueryDelegatorValidatorsResponse { + return QueryDelegatorValidatorsResponse.decode(message.value); + }, + toProto(message: QueryDelegatorValidatorsResponse): Uint8Array { + return QueryDelegatorValidatorsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegatorValidatorsResponse): QueryDelegatorValidatorsResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorsResponse", + value: QueryDelegatorValidatorsResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryDelegatorValidatorsResponse.typeUrl, QueryDelegatorValidatorsResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryDelegatorValidatorsResponse.aminoType, QueryDelegatorValidatorsResponse.typeUrl); +function createBaseQueryDelegatorValidatorRequest(): QueryDelegatorValidatorRequest { + return { + delegatorAddr: "", + validatorAddr: "" + }; +} +export const QueryDelegatorValidatorRequest = { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorRequest", + aminoType: "cosmos-sdk/QueryDelegatorValidatorRequest", + is(o: any): o is QueryDelegatorValidatorRequest { + return o && (o.$typeUrl === QueryDelegatorValidatorRequest.typeUrl || typeof o.delegatorAddr === "string" && typeof o.validatorAddr === "string"); + }, + isAmino(o: any): o is QueryDelegatorValidatorRequestAmino { + return o && (o.$typeUrl === QueryDelegatorValidatorRequest.typeUrl || typeof o.delegator_addr === "string" && typeof o.validator_addr === "string"); + }, + encode(message: QueryDelegatorValidatorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegatorAddr !== "") { + writer.uint32(10).string(message.delegatorAddr); + } + if (message.validatorAddr !== "") { + writer.uint32(18).string(message.validatorAddr); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddr = reader.string(); + break; + case 2: + message.validatorAddr = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDelegatorValidatorRequest { + const message = createBaseQueryDelegatorValidatorRequest(); + message.delegatorAddr = object.delegatorAddr ?? ""; + message.validatorAddr = object.validatorAddr ?? ""; + return message; + }, + fromAmino(object: QueryDelegatorValidatorRequestAmino): QueryDelegatorValidatorRequest { + const message = createBaseQueryDelegatorValidatorRequest(); + if (object.delegator_addr !== undefined && object.delegator_addr !== null) { + message.delegatorAddr = object.delegator_addr; + } + if (object.validator_addr !== undefined && object.validator_addr !== null) { + message.validatorAddr = object.validator_addr; + } + return message; + }, + toAmino(message: QueryDelegatorValidatorRequest): QueryDelegatorValidatorRequestAmino { + const obj: any = {}; + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; + return obj; + }, + fromAminoMsg(object: QueryDelegatorValidatorRequestAminoMsg): QueryDelegatorValidatorRequest { + return QueryDelegatorValidatorRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegatorValidatorRequest): QueryDelegatorValidatorRequestAminoMsg { + return { + type: "cosmos-sdk/QueryDelegatorValidatorRequest", + value: QueryDelegatorValidatorRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegatorValidatorRequestProtoMsg): QueryDelegatorValidatorRequest { + return QueryDelegatorValidatorRequest.decode(message.value); + }, + toProto(message: QueryDelegatorValidatorRequest): Uint8Array { + return QueryDelegatorValidatorRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegatorValidatorRequest): QueryDelegatorValidatorRequestProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorRequest", + value: QueryDelegatorValidatorRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryDelegatorValidatorRequest.typeUrl, QueryDelegatorValidatorRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryDelegatorValidatorRequest.aminoType, QueryDelegatorValidatorRequest.typeUrl); +function createBaseQueryDelegatorValidatorResponse(): QueryDelegatorValidatorResponse { + return { + validator: Validator.fromPartial({}) + }; +} +export const QueryDelegatorValidatorResponse = { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorResponse", + aminoType: "cosmos-sdk/QueryDelegatorValidatorResponse", + is(o: any): o is QueryDelegatorValidatorResponse { + return o && (o.$typeUrl === QueryDelegatorValidatorResponse.typeUrl || Validator.is(o.validator)); + }, + isAmino(o: any): o is QueryDelegatorValidatorResponseAmino { + return o && (o.$typeUrl === QueryDelegatorValidatorResponse.typeUrl || Validator.isAmino(o.validator)); + }, + encode(message: QueryDelegatorValidatorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryDelegatorValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryDelegatorValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator = Validator.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryDelegatorValidatorResponse { + const message = createBaseQueryDelegatorValidatorResponse(); + message.validator = object.validator !== undefined && object.validator !== null ? Validator.fromPartial(object.validator) : undefined; + return message; + }, + fromAmino(object: QueryDelegatorValidatorResponseAmino): QueryDelegatorValidatorResponse { + const message = createBaseQueryDelegatorValidatorResponse(); + if (object.validator !== undefined && object.validator !== null) { + message.validator = Validator.fromAmino(object.validator); + } + return message; + }, + toAmino(message: QueryDelegatorValidatorResponse): QueryDelegatorValidatorResponseAmino { + const obj: any = {}; + obj.validator = message.validator ? Validator.toAmino(message.validator) : Validator.toAmino(Validator.fromPartial({})); + return obj; + }, + fromAminoMsg(object: QueryDelegatorValidatorResponseAminoMsg): QueryDelegatorValidatorResponse { + return QueryDelegatorValidatorResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryDelegatorValidatorResponse): QueryDelegatorValidatorResponseAminoMsg { + return { + type: "cosmos-sdk/QueryDelegatorValidatorResponse", + value: QueryDelegatorValidatorResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryDelegatorValidatorResponseProtoMsg): QueryDelegatorValidatorResponse { + return QueryDelegatorValidatorResponse.decode(message.value); + }, + toProto(message: QueryDelegatorValidatorResponse): Uint8Array { + return QueryDelegatorValidatorResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryDelegatorValidatorResponse): QueryDelegatorValidatorResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryDelegatorValidatorResponse", + value: QueryDelegatorValidatorResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryDelegatorValidatorResponse.typeUrl, QueryDelegatorValidatorResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryDelegatorValidatorResponse.aminoType, QueryDelegatorValidatorResponse.typeUrl); +function createBaseQueryHistoricalInfoRequest(): QueryHistoricalInfoRequest { + return { + height: BigInt(0) + }; +} +export const QueryHistoricalInfoRequest = { + typeUrl: "/cosmos.staking.v1beta1.QueryHistoricalInfoRequest", + aminoType: "cosmos-sdk/QueryHistoricalInfoRequest", + is(o: any): o is QueryHistoricalInfoRequest { + return o && (o.$typeUrl === QueryHistoricalInfoRequest.typeUrl || typeof o.height === "bigint"); + }, + isAmino(o: any): o is QueryHistoricalInfoRequestAmino { + return o && (o.$typeUrl === QueryHistoricalInfoRequest.typeUrl || typeof o.height === "bigint"); + }, + encode(message: QueryHistoricalInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { + writer.uint32(8).int64(message.height); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryHistoricalInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryHistoricalInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryHistoricalInfoRequest { + const message = createBaseQueryHistoricalInfoRequest(); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + return message; + }, + fromAmino(object: QueryHistoricalInfoRequestAmino): QueryHistoricalInfoRequest { + const message = createBaseQueryHistoricalInfoRequest(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + return message; + }, + toAmino(message: QueryHistoricalInfoRequest): QueryHistoricalInfoRequestAmino { + const obj: any = {}; + obj.height = message.height !== BigInt(0) ? message.height?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QueryHistoricalInfoRequestAminoMsg): QueryHistoricalInfoRequest { + return QueryHistoricalInfoRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryHistoricalInfoRequest): QueryHistoricalInfoRequestAminoMsg { + return { + type: "cosmos-sdk/QueryHistoricalInfoRequest", + value: QueryHistoricalInfoRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryHistoricalInfoRequestProtoMsg): QueryHistoricalInfoRequest { + return QueryHistoricalInfoRequest.decode(message.value); + }, + toProto(message: QueryHistoricalInfoRequest): Uint8Array { + return QueryHistoricalInfoRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryHistoricalInfoRequest): QueryHistoricalInfoRequestProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryHistoricalInfoRequest", + value: QueryHistoricalInfoRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryHistoricalInfoRequest.typeUrl, QueryHistoricalInfoRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryHistoricalInfoRequest.aminoType, QueryHistoricalInfoRequest.typeUrl); +function createBaseQueryHistoricalInfoResponse(): QueryHistoricalInfoResponse { + return { + hist: undefined + }; +} +export const QueryHistoricalInfoResponse = { + typeUrl: "/cosmos.staking.v1beta1.QueryHistoricalInfoResponse", + aminoType: "cosmos-sdk/QueryHistoricalInfoResponse", + is(o: any): o is QueryHistoricalInfoResponse { + return o && o.$typeUrl === QueryHistoricalInfoResponse.typeUrl; + }, + isAmino(o: any): o is QueryHistoricalInfoResponseAmino { + return o && o.$typeUrl === QueryHistoricalInfoResponse.typeUrl; + }, + encode(message: QueryHistoricalInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.hist !== undefined) { + HistoricalInfo.encode(message.hist, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryHistoricalInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryHistoricalInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hist = HistoricalInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryHistoricalInfoResponse { + const message = createBaseQueryHistoricalInfoResponse(); + message.hist = object.hist !== undefined && object.hist !== null ? HistoricalInfo.fromPartial(object.hist) : undefined; + return message; + }, + fromAmino(object: QueryHistoricalInfoResponseAmino): QueryHistoricalInfoResponse { + const message = createBaseQueryHistoricalInfoResponse(); + if (object.hist !== undefined && object.hist !== null) { + message.hist = HistoricalInfo.fromAmino(object.hist); + } + return message; + }, + toAmino(message: QueryHistoricalInfoResponse): QueryHistoricalInfoResponseAmino { + const obj: any = {}; + obj.hist = message.hist ? HistoricalInfo.toAmino(message.hist) : undefined; + return obj; + }, + fromAminoMsg(object: QueryHistoricalInfoResponseAminoMsg): QueryHistoricalInfoResponse { + return QueryHistoricalInfoResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryHistoricalInfoResponse): QueryHistoricalInfoResponseAminoMsg { + return { + type: "cosmos-sdk/QueryHistoricalInfoResponse", + value: QueryHistoricalInfoResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryHistoricalInfoResponseProtoMsg): QueryHistoricalInfoResponse { + return QueryHistoricalInfoResponse.decode(message.value); + }, + toProto(message: QueryHistoricalInfoResponse): Uint8Array { + return QueryHistoricalInfoResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryHistoricalInfoResponse): QueryHistoricalInfoResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryHistoricalInfoResponse", + value: QueryHistoricalInfoResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryHistoricalInfoResponse.typeUrl, QueryHistoricalInfoResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryHistoricalInfoResponse.aminoType, QueryHistoricalInfoResponse.typeUrl); +function createBaseQueryPoolRequest(): QueryPoolRequest { + return {}; +} +export const QueryPoolRequest = { + typeUrl: "/cosmos.staking.v1beta1.QueryPoolRequest", + aminoType: "cosmos-sdk/QueryPoolRequest", + is(o: any): o is QueryPoolRequest { + return o && o.$typeUrl === QueryPoolRequest.typeUrl; + }, + isAmino(o: any): o is QueryPoolRequestAmino { + return o && o.$typeUrl === QueryPoolRequest.typeUrl; + }, + encode(_: QueryPoolRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryPoolRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPoolRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): QueryPoolRequest { + const message = createBaseQueryPoolRequest(); + return message; + }, + fromAmino(_: QueryPoolRequestAmino): QueryPoolRequest { + const message = createBaseQueryPoolRequest(); + return message; + }, + toAmino(_: QueryPoolRequest): QueryPoolRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryPoolRequestAminoMsg): QueryPoolRequest { + return QueryPoolRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryPoolRequest): QueryPoolRequestAminoMsg { + return { + type: "cosmos-sdk/QueryPoolRequest", + value: QueryPoolRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryPoolRequestProtoMsg): QueryPoolRequest { + return QueryPoolRequest.decode(message.value); + }, + toProto(message: QueryPoolRequest): Uint8Array { + return QueryPoolRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryPoolRequest): QueryPoolRequestProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryPoolRequest", + value: QueryPoolRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryPoolRequest.typeUrl, QueryPoolRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryPoolRequest.aminoType, QueryPoolRequest.typeUrl); +function createBaseQueryPoolResponse(): QueryPoolResponse { + return { + pool: Pool.fromPartial({}) + }; +} +export const QueryPoolResponse = { + typeUrl: "/cosmos.staking.v1beta1.QueryPoolResponse", + aminoType: "cosmos-sdk/QueryPoolResponse", + is(o: any): o is QueryPoolResponse { + return o && (o.$typeUrl === QueryPoolResponse.typeUrl || Pool.is(o.pool)); + }, + isAmino(o: any): o is QueryPoolResponseAmino { + return o && (o.$typeUrl === QueryPoolResponse.typeUrl || Pool.isAmino(o.pool)); + }, + encode(message: QueryPoolResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.pool !== undefined) { + Pool.encode(message.pool, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryPoolResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPoolResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pool = Pool.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryPoolResponse { + const message = createBaseQueryPoolResponse(); + message.pool = object.pool !== undefined && object.pool !== null ? Pool.fromPartial(object.pool) : undefined; + return message; + }, + fromAmino(object: QueryPoolResponseAmino): QueryPoolResponse { + const message = createBaseQueryPoolResponse(); + if (object.pool !== undefined && object.pool !== null) { + message.pool = Pool.fromAmino(object.pool); + } + return message; + }, + toAmino(message: QueryPoolResponse): QueryPoolResponseAmino { + const obj: any = {}; + obj.pool = message.pool ? Pool.toAmino(message.pool) : Pool.toAmino(Pool.fromPartial({})); + return obj; + }, + fromAminoMsg(object: QueryPoolResponseAminoMsg): QueryPoolResponse { + return QueryPoolResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryPoolResponse): QueryPoolResponseAminoMsg { + return { + type: "cosmos-sdk/QueryPoolResponse", + value: QueryPoolResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryPoolResponseProtoMsg): QueryPoolResponse { + return QueryPoolResponse.decode(message.value); + }, + toProto(message: QueryPoolResponse): Uint8Array { + return QueryPoolResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryPoolResponse): QueryPoolResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryPoolResponse", + value: QueryPoolResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryPoolResponse.typeUrl, QueryPoolResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryPoolResponse.aminoType, QueryPoolResponse.typeUrl); +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} +export const QueryParamsRequest = { + typeUrl: "/cosmos.staking.v1beta1.QueryParamsRequest", + aminoType: "cosmos-sdk/QueryParamsRequest", + is(o: any): o is QueryParamsRequest { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, + fromAmino(_: QueryParamsRequestAmino): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, + toAmino(_: QueryParamsRequest): QueryParamsRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { + return QueryParamsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsRequest): QueryParamsRequestAminoMsg { + return { + type: "cosmos-sdk/QueryParamsRequest", + value: QueryParamsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsRequestProtoMsg): QueryParamsRequest { + return QueryParamsRequest.decode(message.value); + }, + toProto(message: QueryParamsRequest): Uint8Array { + return QueryParamsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsRequest): QueryParamsRequestProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryParamsRequest", + value: QueryParamsRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryParamsRequest.typeUrl, QueryParamsRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryParamsRequest.aminoType, QueryParamsRequest.typeUrl); +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { + params: Params.fromPartial({}) + }; +} +export const QueryParamsResponse = { + typeUrl: "/cosmos.staking.v1beta1.QueryParamsResponse", + aminoType: "cosmos-sdk/QueryParamsResponse", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.is(o.params)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isAmino(o.params)); + }, + encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: QueryParamsResponseAmino): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); + return obj; + }, + fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { + return QueryParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsResponse): QueryParamsResponseAminoMsg { + return { + type: "cosmos-sdk/QueryParamsResponse", + value: QueryParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsResponseProtoMsg): QueryParamsResponse { + return QueryParamsResponse.decode(message.value); + }, + toProto(message: QueryParamsResponse): Uint8Array { + return QueryParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsResponse): QueryParamsResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.QueryParamsResponse", + value: QueryParamsResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryParamsResponse.typeUrl, QueryParamsResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryParamsResponse.aminoType, QueryParamsResponse.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/staking/v1beta1/staking.ts b/libs/interchain-query/src/cosmos/staking/v1beta1/staking.ts new file mode 100644 index 00000000..ab2a299e --- /dev/null +++ b/libs/interchain-query/src/cosmos/staking/v1beta1/staking.ts @@ -0,0 +1,3005 @@ +import { Header, HeaderAmino } from "../../../tendermint/types/types"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Any, AnyProtoMsg, AnyAmino } from "../../../google/protobuf/any"; +import { Duration, DurationAmino } from "../../../google/protobuf/duration"; +import { Coin, CoinAmino } from "../../base/v1beta1/coin"; +import { ValidatorUpdate, ValidatorUpdateAmino } from "../../../tendermint/abci/types"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial, toTimestamp, fromTimestamp, isSet } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; +import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; +/** BondStatus is the status of a validator. */ +export enum BondStatus { + /** BOND_STATUS_UNSPECIFIED - UNSPECIFIED defines an invalid validator status. */ + BOND_STATUS_UNSPECIFIED = 0, + /** BOND_STATUS_UNBONDED - UNBONDED defines a validator that is not bonded. */ + BOND_STATUS_UNBONDED = 1, + /** BOND_STATUS_UNBONDING - UNBONDING defines a validator that is unbonding. */ + BOND_STATUS_UNBONDING = 2, + /** BOND_STATUS_BONDED - BONDED defines a validator that is bonded. */ + BOND_STATUS_BONDED = 3, + UNRECOGNIZED = -1, +} +export const BondStatusAmino = BondStatus; +export function bondStatusFromJSON(object: any): BondStatus { + switch (object) { + case 0: + case "BOND_STATUS_UNSPECIFIED": + return BondStatus.BOND_STATUS_UNSPECIFIED; + case 1: + case "BOND_STATUS_UNBONDED": + return BondStatus.BOND_STATUS_UNBONDED; + case 2: + case "BOND_STATUS_UNBONDING": + return BondStatus.BOND_STATUS_UNBONDING; + case 3: + case "BOND_STATUS_BONDED": + return BondStatus.BOND_STATUS_BONDED; + case -1: + case "UNRECOGNIZED": + default: + return BondStatus.UNRECOGNIZED; + } +} +export function bondStatusToJSON(object: BondStatus): string { + switch (object) { + case BondStatus.BOND_STATUS_UNSPECIFIED: + return "BOND_STATUS_UNSPECIFIED"; + case BondStatus.BOND_STATUS_UNBONDED: + return "BOND_STATUS_UNBONDED"; + case BondStatus.BOND_STATUS_UNBONDING: + return "BOND_STATUS_UNBONDING"; + case BondStatus.BOND_STATUS_BONDED: + return "BOND_STATUS_BONDED"; + case BondStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** Infraction indicates the infraction a validator commited. */ +export enum Infraction { + /** INFRACTION_UNSPECIFIED - UNSPECIFIED defines an empty infraction. */ + INFRACTION_UNSPECIFIED = 0, + /** INFRACTION_DOUBLE_SIGN - DOUBLE_SIGN defines a validator that double-signs a block. */ + INFRACTION_DOUBLE_SIGN = 1, + /** INFRACTION_DOWNTIME - DOWNTIME defines a validator that missed signing too many blocks. */ + INFRACTION_DOWNTIME = 2, + UNRECOGNIZED = -1, +} +export const InfractionAmino = Infraction; +export function infractionFromJSON(object: any): Infraction { + switch (object) { + case 0: + case "INFRACTION_UNSPECIFIED": + return Infraction.INFRACTION_UNSPECIFIED; + case 1: + case "INFRACTION_DOUBLE_SIGN": + return Infraction.INFRACTION_DOUBLE_SIGN; + case 2: + case "INFRACTION_DOWNTIME": + return Infraction.INFRACTION_DOWNTIME; + case -1: + case "UNRECOGNIZED": + default: + return Infraction.UNRECOGNIZED; + } +} +export function infractionToJSON(object: Infraction): string { + switch (object) { + case Infraction.INFRACTION_UNSPECIFIED: + return "INFRACTION_UNSPECIFIED"; + case Infraction.INFRACTION_DOUBLE_SIGN: + return "INFRACTION_DOUBLE_SIGN"; + case Infraction.INFRACTION_DOWNTIME: + return "INFRACTION_DOWNTIME"; + case Infraction.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** + * HistoricalInfo contains header and validator information for a given block. + * It is stored as part of staking module's state, which persists the `n` most + * recent HistoricalInfo + * (`n` is set by the staking module's `historical_entries` parameter). + */ +export interface HistoricalInfo { + header: Header; + valset: Validator[]; +} +export interface HistoricalInfoProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.HistoricalInfo"; + value: Uint8Array; +} +/** + * HistoricalInfo contains header and validator information for a given block. + * It is stored as part of staking module's state, which persists the `n` most + * recent HistoricalInfo + * (`n` is set by the staking module's `historical_entries` parameter). + */ +export interface HistoricalInfoAmino { + header: HeaderAmino; + valset: ValidatorAmino[]; +} +export interface HistoricalInfoAminoMsg { + type: "cosmos-sdk/HistoricalInfo"; + value: HistoricalInfoAmino; +} +/** + * CommissionRates defines the initial commission rates to be used for creating + * a validator. + */ +export interface CommissionRates { + /** rate is the commission rate charged to delegators, as a fraction. */ + rate: string; + /** max_rate defines the maximum commission rate which validator can ever charge, as a fraction. */ + maxRate: string; + /** max_change_rate defines the maximum daily increase of the validator commission, as a fraction. */ + maxChangeRate: string; +} +export interface CommissionRatesProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.CommissionRates"; + value: Uint8Array; +} +/** + * CommissionRates defines the initial commission rates to be used for creating + * a validator. + */ +export interface CommissionRatesAmino { + /** rate is the commission rate charged to delegators, as a fraction. */ + rate: string; + /** max_rate defines the maximum commission rate which validator can ever charge, as a fraction. */ + max_rate: string; + /** max_change_rate defines the maximum daily increase of the validator commission, as a fraction. */ + max_change_rate: string; +} +export interface CommissionRatesAminoMsg { + type: "cosmos-sdk/CommissionRates"; + value: CommissionRatesAmino; +} +/** Commission defines commission parameters for a given validator. */ +export interface Commission { + /** commission_rates defines the initial commission rates to be used for creating a validator. */ + commissionRates: CommissionRates; + /** update_time is the last time the commission rate was changed. */ + updateTime: Date; +} +export interface CommissionProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.Commission"; + value: Uint8Array; +} +/** Commission defines commission parameters for a given validator. */ +export interface CommissionAmino { + /** commission_rates defines the initial commission rates to be used for creating a validator. */ + commission_rates: CommissionRatesAmino; + /** update_time is the last time the commission rate was changed. */ + update_time: string; +} +export interface CommissionAminoMsg { + type: "cosmos-sdk/Commission"; + value: CommissionAmino; +} +/** Description defines a validator description. */ +export interface Description { + /** moniker defines a human-readable name for the validator. */ + moniker: string; + /** identity defines an optional identity signature (ex. UPort or Keybase). */ + identity: string; + /** website defines an optional website link. */ + website: string; + /** security_contact defines an optional email for security contact. */ + securityContact: string; + /** details define other optional details. */ + details: string; +} +export interface DescriptionProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.Description"; + value: Uint8Array; +} +/** Description defines a validator description. */ +export interface DescriptionAmino { + /** moniker defines a human-readable name for the validator. */ + moniker: string; + /** identity defines an optional identity signature (ex. UPort or Keybase). */ + identity: string; + /** website defines an optional website link. */ + website: string; + /** security_contact defines an optional email for security contact. */ + security_contact: string; + /** details define other optional details. */ + details: string; +} +export interface DescriptionAminoMsg { + type: "cosmos-sdk/Description"; + value: DescriptionAmino; +} +/** + * Validator defines a validator, together with the total amount of the + * Validator's bond shares and their exchange rate to coins. Slashing results in + * a decrease in the exchange rate, allowing correct calculation of future + * undelegations without iterating over delegators. When coins are delegated to + * this validator, the validator is credited with a delegation whose number of + * bond shares is based on the amount of coins delegated divided by the current + * exchange rate. Voting power can be calculated as total bonded shares + * multiplied by exchange rate. + */ +export interface Validator { + /** operator_address defines the address of the validator's operator; bech encoded in JSON. */ + operatorAddress: string; + /** consensus_pubkey is the consensus public key of the validator, as a Protobuf Any. */ + consensusPubkey?: Any | undefined; + /** jailed defined whether the validator has been jailed from bonded status or not. */ + jailed: boolean; + /** status is the validator status (bonded/unbonding/unbonded). */ + status: BondStatus; + /** tokens define the delegated tokens (incl. self-delegation). */ + tokens: string; + /** delegator_shares defines total shares issued to a validator's delegators. */ + delegatorShares: string; + /** description defines the description terms for the validator. */ + description: Description; + /** unbonding_height defines, if unbonding, the height at which this validator has begun unbonding. */ + unbondingHeight: bigint; + /** unbonding_time defines, if unbonding, the min time for the validator to complete unbonding. */ + unbondingTime: Date; + /** commission defines the commission parameters. */ + commission: Commission; + /** + * min_self_delegation is the validator's self declared minimum self delegation. + * + * Since: cosmos-sdk 0.46 + */ + minSelfDelegation: string; + /** strictly positive if this validator's unbonding has been stopped by external modules */ + unbondingOnHoldRefCount: bigint; + /** list of unbonding ids, each uniquely identifing an unbonding of this validator */ + unbondingIds: bigint[]; +} +export interface ValidatorProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.Validator"; + value: Uint8Array; +} +export type ValidatorEncoded = Omit & { + /** consensus_pubkey is the consensus public key of the validator, as a Protobuf Any. */consensusPubkey?: AnyProtoMsg | undefined; +}; +/** + * Validator defines a validator, together with the total amount of the + * Validator's bond shares and their exchange rate to coins. Slashing results in + * a decrease in the exchange rate, allowing correct calculation of future + * undelegations without iterating over delegators. When coins are delegated to + * this validator, the validator is credited with a delegation whose number of + * bond shares is based on the amount of coins delegated divided by the current + * exchange rate. Voting power can be calculated as total bonded shares + * multiplied by exchange rate. + */ +export interface ValidatorAmino { + /** operator_address defines the address of the validator's operator; bech encoded in JSON. */ + operator_address: string; + /** consensus_pubkey is the consensus public key of the validator, as a Protobuf Any. */ + consensus_pubkey?: AnyAmino; + /** jailed defined whether the validator has been jailed from bonded status or not. */ + jailed: boolean; + /** status is the validator status (bonded/unbonding/unbonded). */ + status: BondStatus; + /** tokens define the delegated tokens (incl. self-delegation). */ + tokens: string; + /** delegator_shares defines total shares issued to a validator's delegators. */ + delegator_shares: string; + /** description defines the description terms for the validator. */ + description: DescriptionAmino; + /** unbonding_height defines, if unbonding, the height at which this validator has begun unbonding. */ + unbonding_height: string; + /** unbonding_time defines, if unbonding, the min time for the validator to complete unbonding. */ + unbonding_time: string; + /** commission defines the commission parameters. */ + commission: CommissionAmino; + /** + * min_self_delegation is the validator's self declared minimum self delegation. + * + * Since: cosmos-sdk 0.46 + */ + min_self_delegation: string; + /** strictly positive if this validator's unbonding has been stopped by external modules */ + unbonding_on_hold_ref_count: string; + /** list of unbonding ids, each uniquely identifing an unbonding of this validator */ + unbonding_ids: string[]; +} +export interface ValidatorAminoMsg { + type: "cosmos-sdk/Validator"; + value: ValidatorAmino; +} +/** ValAddresses defines a repeated set of validator addresses. */ +export interface ValAddresses { + addresses: string[]; +} +export interface ValAddressesProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.ValAddresses"; + value: Uint8Array; +} +/** ValAddresses defines a repeated set of validator addresses. */ +export interface ValAddressesAmino { + addresses: string[]; +} +export interface ValAddressesAminoMsg { + type: "cosmos-sdk/ValAddresses"; + value: ValAddressesAmino; +} +/** + * DVPair is struct that just has a delegator-validator pair with no other data. + * It is intended to be used as a marshalable pointer. For example, a DVPair can + * be used to construct the key to getting an UnbondingDelegation from state. + */ +export interface DVPair { + delegatorAddress: string; + validatorAddress: string; +} +export interface DVPairProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.DVPair"; + value: Uint8Array; +} +/** + * DVPair is struct that just has a delegator-validator pair with no other data. + * It is intended to be used as a marshalable pointer. For example, a DVPair can + * be used to construct the key to getting an UnbondingDelegation from state. + */ +export interface DVPairAmino { + delegator_address: string; + validator_address: string; +} +export interface DVPairAminoMsg { + type: "cosmos-sdk/DVPair"; + value: DVPairAmino; +} +/** DVPairs defines an array of DVPair objects. */ +export interface DVPairs { + pairs: DVPair[]; +} +export interface DVPairsProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.DVPairs"; + value: Uint8Array; +} +/** DVPairs defines an array of DVPair objects. */ +export interface DVPairsAmino { + pairs: DVPairAmino[]; +} +export interface DVPairsAminoMsg { + type: "cosmos-sdk/DVPairs"; + value: DVPairsAmino; +} +/** + * DVVTriplet is struct that just has a delegator-validator-validator triplet + * with no other data. It is intended to be used as a marshalable pointer. For + * example, a DVVTriplet can be used to construct the key to getting a + * Redelegation from state. + */ +export interface DVVTriplet { + delegatorAddress: string; + validatorSrcAddress: string; + validatorDstAddress: string; +} +export interface DVVTripletProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.DVVTriplet"; + value: Uint8Array; +} +/** + * DVVTriplet is struct that just has a delegator-validator-validator triplet + * with no other data. It is intended to be used as a marshalable pointer. For + * example, a DVVTriplet can be used to construct the key to getting a + * Redelegation from state. + */ +export interface DVVTripletAmino { + delegator_address: string; + validator_src_address: string; + validator_dst_address: string; +} +export interface DVVTripletAminoMsg { + type: "cosmos-sdk/DVVTriplet"; + value: DVVTripletAmino; +} +/** DVVTriplets defines an array of DVVTriplet objects. */ +export interface DVVTriplets { + triplets: DVVTriplet[]; +} +export interface DVVTripletsProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.DVVTriplets"; + value: Uint8Array; +} +/** DVVTriplets defines an array of DVVTriplet objects. */ +export interface DVVTripletsAmino { + triplets: DVVTripletAmino[]; +} +export interface DVVTripletsAminoMsg { + type: "cosmos-sdk/DVVTriplets"; + value: DVVTripletsAmino; +} +/** + * Delegation represents the bond with tokens held by an account. It is + * owned by one delegator, and is associated with the voting power of one + * validator. + */ +export interface Delegation { + /** delegator_address is the encoded address of the delegator. */ + delegatorAddress: string; + /** validator_address is the encoded address of the validator. */ + validatorAddress: string; + /** shares define the delegation shares received. */ + shares: string; +} +export interface DelegationProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.Delegation"; + value: Uint8Array; +} +/** + * Delegation represents the bond with tokens held by an account. It is + * owned by one delegator, and is associated with the voting power of one + * validator. + */ +export interface DelegationAmino { + /** delegator_address is the encoded address of the delegator. */ + delegator_address: string; + /** validator_address is the encoded address of the validator. */ + validator_address: string; + /** shares define the delegation shares received. */ + shares: string; +} +export interface DelegationAminoMsg { + type: "cosmos-sdk/Delegation"; + value: DelegationAmino; +} +/** + * UnbondingDelegation stores all of a single delegator's unbonding bonds + * for a single validator in an time-ordered list. + */ +export interface UnbondingDelegation { + /** delegator_address is the encoded address of the delegator. */ + delegatorAddress: string; + /** validator_address is the encoded address of the validator. */ + validatorAddress: string; + /** entries are the unbonding delegation entries. */ + entries: UnbondingDelegationEntry[]; +} +export interface UnbondingDelegationProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.UnbondingDelegation"; + value: Uint8Array; +} +/** + * UnbondingDelegation stores all of a single delegator's unbonding bonds + * for a single validator in an time-ordered list. + */ +export interface UnbondingDelegationAmino { + /** delegator_address is the encoded address of the delegator. */ + delegator_address: string; + /** validator_address is the encoded address of the validator. */ + validator_address: string; + /** entries are the unbonding delegation entries. */ + entries: UnbondingDelegationEntryAmino[]; +} +export interface UnbondingDelegationAminoMsg { + type: "cosmos-sdk/UnbondingDelegation"; + value: UnbondingDelegationAmino; +} +/** UnbondingDelegationEntry defines an unbonding object with relevant metadata. */ +export interface UnbondingDelegationEntry { + /** creation_height is the height which the unbonding took place. */ + creationHeight: bigint; + /** completion_time is the unix time for unbonding completion. */ + completionTime: Date; + /** initial_balance defines the tokens initially scheduled to receive at completion. */ + initialBalance: string; + /** balance defines the tokens to receive at completion. */ + balance: string; + /** Incrementing id that uniquely identifies this entry */ + unbondingId: bigint; + /** Strictly positive if this entry's unbonding has been stopped by external modules */ + unbondingOnHoldRefCount: bigint; +} +export interface UnbondingDelegationEntryProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.UnbondingDelegationEntry"; + value: Uint8Array; +} +/** UnbondingDelegationEntry defines an unbonding object with relevant metadata. */ +export interface UnbondingDelegationEntryAmino { + /** creation_height is the height which the unbonding took place. */ + creation_height: string; + /** completion_time is the unix time for unbonding completion. */ + completion_time: string; + /** initial_balance defines the tokens initially scheduled to receive at completion. */ + initial_balance: string; + /** balance defines the tokens to receive at completion. */ + balance: string; + /** Incrementing id that uniquely identifies this entry */ + unbonding_id: string; + /** Strictly positive if this entry's unbonding has been stopped by external modules */ + unbonding_on_hold_ref_count: string; +} +export interface UnbondingDelegationEntryAminoMsg { + type: "cosmos-sdk/UnbondingDelegationEntry"; + value: UnbondingDelegationEntryAmino; +} +/** RedelegationEntry defines a redelegation object with relevant metadata. */ +export interface RedelegationEntry { + /** creation_height defines the height which the redelegation took place. */ + creationHeight: bigint; + /** completion_time defines the unix time for redelegation completion. */ + completionTime: Date; + /** initial_balance defines the initial balance when redelegation started. */ + initialBalance: string; + /** shares_dst is the amount of destination-validator shares created by redelegation. */ + sharesDst: string; + /** Incrementing id that uniquely identifies this entry */ + unbondingId: bigint; + /** Strictly positive if this entry's unbonding has been stopped by external modules */ + unbondingOnHoldRefCount: bigint; +} +export interface RedelegationEntryProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.RedelegationEntry"; + value: Uint8Array; +} +/** RedelegationEntry defines a redelegation object with relevant metadata. */ +export interface RedelegationEntryAmino { + /** creation_height defines the height which the redelegation took place. */ + creation_height: string; + /** completion_time defines the unix time for redelegation completion. */ + completion_time: string; + /** initial_balance defines the initial balance when redelegation started. */ + initial_balance: string; + /** shares_dst is the amount of destination-validator shares created by redelegation. */ + shares_dst: string; + /** Incrementing id that uniquely identifies this entry */ + unbonding_id: string; + /** Strictly positive if this entry's unbonding has been stopped by external modules */ + unbonding_on_hold_ref_count: string; +} +export interface RedelegationEntryAminoMsg { + type: "cosmos-sdk/RedelegationEntry"; + value: RedelegationEntryAmino; +} +/** + * Redelegation contains the list of a particular delegator's redelegating bonds + * from a particular source validator to a particular destination validator. + */ +export interface Redelegation { + /** delegator_address is the bech32-encoded address of the delegator. */ + delegatorAddress: string; + /** validator_src_address is the validator redelegation source operator address. */ + validatorSrcAddress: string; + /** validator_dst_address is the validator redelegation destination operator address. */ + validatorDstAddress: string; + /** entries are the redelegation entries. */ + entries: RedelegationEntry[]; +} +export interface RedelegationProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.Redelegation"; + value: Uint8Array; +} +/** + * Redelegation contains the list of a particular delegator's redelegating bonds + * from a particular source validator to a particular destination validator. + */ +export interface RedelegationAmino { + /** delegator_address is the bech32-encoded address of the delegator. */ + delegator_address: string; + /** validator_src_address is the validator redelegation source operator address. */ + validator_src_address: string; + /** validator_dst_address is the validator redelegation destination operator address. */ + validator_dst_address: string; + /** entries are the redelegation entries. */ + entries: RedelegationEntryAmino[]; +} +export interface RedelegationAminoMsg { + type: "cosmos-sdk/Redelegation"; + value: RedelegationAmino; +} +/** Params defines the parameters for the x/staking module. */ +export interface Params { + /** unbonding_time is the time duration of unbonding. */ + unbondingTime: Duration; + /** max_validators is the maximum number of validators. */ + maxValidators: number; + /** max_entries is the max entries for either unbonding delegation or redelegation (per pair/trio). */ + maxEntries: number; + /** historical_entries is the number of historical entries to persist. */ + historicalEntries: number; + /** bond_denom defines the bondable coin denomination. */ + bondDenom: string; + /** min_commission_rate is the chain-wide minimum commission rate that a validator can charge their delegators */ + minCommissionRate: string; +} +export interface ParamsProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.Params"; + value: Uint8Array; +} +/** Params defines the parameters for the x/staking module. */ +export interface ParamsAmino { + /** unbonding_time is the time duration of unbonding. */ + unbonding_time: DurationAmino; + /** max_validators is the maximum number of validators. */ + max_validators: number; + /** max_entries is the max entries for either unbonding delegation or redelegation (per pair/trio). */ + max_entries: number; + /** historical_entries is the number of historical entries to persist. */ + historical_entries: number; + /** bond_denom defines the bondable coin denomination. */ + bond_denom: string; + /** min_commission_rate is the chain-wide minimum commission rate that a validator can charge their delegators */ + min_commission_rate: string; +} +export interface ParamsAminoMsg { + type: "cosmos-sdk/x/staking/Params"; + value: ParamsAmino; +} +/** + * DelegationResponse is equivalent to Delegation except that it contains a + * balance in addition to shares which is more suitable for client responses. + */ +export interface DelegationResponse { + delegation: Delegation; + balance: Coin; +} +export interface DelegationResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.DelegationResponse"; + value: Uint8Array; +} +/** + * DelegationResponse is equivalent to Delegation except that it contains a + * balance in addition to shares which is more suitable for client responses. + */ +export interface DelegationResponseAmino { + delegation: DelegationAmino; + balance: CoinAmino; +} +export interface DelegationResponseAminoMsg { + type: "cosmos-sdk/DelegationResponse"; + value: DelegationResponseAmino; +} +/** + * RedelegationEntryResponse is equivalent to a RedelegationEntry except that it + * contains a balance in addition to shares which is more suitable for client + * responses. + */ +export interface RedelegationEntryResponse { + redelegationEntry: RedelegationEntry; + balance: string; +} +export interface RedelegationEntryResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.RedelegationEntryResponse"; + value: Uint8Array; +} +/** + * RedelegationEntryResponse is equivalent to a RedelegationEntry except that it + * contains a balance in addition to shares which is more suitable for client + * responses. + */ +export interface RedelegationEntryResponseAmino { + redelegation_entry: RedelegationEntryAmino; + balance: string; +} +export interface RedelegationEntryResponseAminoMsg { + type: "cosmos-sdk/RedelegationEntryResponse"; + value: RedelegationEntryResponseAmino; +} +/** + * RedelegationResponse is equivalent to a Redelegation except that its entries + * contain a balance in addition to shares which is more suitable for client + * responses. + */ +export interface RedelegationResponse { + redelegation: Redelegation; + entries: RedelegationEntryResponse[]; +} +export interface RedelegationResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.RedelegationResponse"; + value: Uint8Array; +} +/** + * RedelegationResponse is equivalent to a Redelegation except that its entries + * contain a balance in addition to shares which is more suitable for client + * responses. + */ +export interface RedelegationResponseAmino { + redelegation: RedelegationAmino; + entries: RedelegationEntryResponseAmino[]; +} +export interface RedelegationResponseAminoMsg { + type: "cosmos-sdk/RedelegationResponse"; + value: RedelegationResponseAmino; +} +/** + * Pool is used for tracking bonded and not-bonded token supply of the bond + * denomination. + */ +export interface Pool { + notBondedTokens: string; + bondedTokens: string; +} +export interface PoolProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.Pool"; + value: Uint8Array; +} +/** + * Pool is used for tracking bonded and not-bonded token supply of the bond + * denomination. + */ +export interface PoolAmino { + not_bonded_tokens: string; + bonded_tokens: string; +} +export interface PoolAminoMsg { + type: "cosmos-sdk/Pool"; + value: PoolAmino; +} +/** + * ValidatorUpdates defines an array of abci.ValidatorUpdate objects. + * TODO: explore moving this to proto/cosmos/base to separate modules from tendermint dependence + */ +export interface ValidatorUpdates { + updates: ValidatorUpdate[]; +} +export interface ValidatorUpdatesProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.ValidatorUpdates"; + value: Uint8Array; +} +/** + * ValidatorUpdates defines an array of abci.ValidatorUpdate objects. + * TODO: explore moving this to proto/cosmos/base to separate modules from tendermint dependence + */ +export interface ValidatorUpdatesAmino { + updates: ValidatorUpdateAmino[]; +} +export interface ValidatorUpdatesAminoMsg { + type: "cosmos-sdk/ValidatorUpdates"; + value: ValidatorUpdatesAmino; +} +function createBaseHistoricalInfo(): HistoricalInfo { + return { + header: Header.fromPartial({}), + valset: [] + }; +} +export const HistoricalInfo = { + typeUrl: "/cosmos.staking.v1beta1.HistoricalInfo", + aminoType: "cosmos-sdk/HistoricalInfo", + is(o: any): o is HistoricalInfo { + return o && (o.$typeUrl === HistoricalInfo.typeUrl || Header.is(o.header) && Array.isArray(o.valset) && (!o.valset.length || Validator.is(o.valset[0]))); + }, + isAmino(o: any): o is HistoricalInfoAmino { + return o && (o.$typeUrl === HistoricalInfo.typeUrl || Header.isAmino(o.header) && Array.isArray(o.valset) && (!o.valset.length || Validator.isAmino(o.valset[0]))); + }, + encode(message: HistoricalInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.valset) { + Validator.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): HistoricalInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHistoricalInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.header = Header.decode(reader, reader.uint32()); + break; + case 2: + message.valset.push(Validator.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): HistoricalInfo { + const message = createBaseHistoricalInfo(); + message.header = object.header !== undefined && object.header !== null ? Header.fromPartial(object.header) : undefined; + message.valset = object.valset?.map(e => Validator.fromPartial(e)) || []; + return message; + }, + fromAmino(object: HistoricalInfoAmino): HistoricalInfo { + const message = createBaseHistoricalInfo(); + if (object.header !== undefined && object.header !== null) { + message.header = Header.fromAmino(object.header); + } + message.valset = object.valset?.map(e => Validator.fromAmino(e)) || []; + return message; + }, + toAmino(message: HistoricalInfo): HistoricalInfoAmino { + const obj: any = {}; + obj.header = message.header ? Header.toAmino(message.header) : Header.toAmino(Header.fromPartial({})); + if (message.valset) { + obj.valset = message.valset.map(e => e ? Validator.toAmino(e) : undefined); + } else { + obj.valset = message.valset; + } + return obj; + }, + fromAminoMsg(object: HistoricalInfoAminoMsg): HistoricalInfo { + return HistoricalInfo.fromAmino(object.value); + }, + toAminoMsg(message: HistoricalInfo): HistoricalInfoAminoMsg { + return { + type: "cosmos-sdk/HistoricalInfo", + value: HistoricalInfo.toAmino(message) + }; + }, + fromProtoMsg(message: HistoricalInfoProtoMsg): HistoricalInfo { + return HistoricalInfo.decode(message.value); + }, + toProto(message: HistoricalInfo): Uint8Array { + return HistoricalInfo.encode(message).finish(); + }, + toProtoMsg(message: HistoricalInfo): HistoricalInfoProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.HistoricalInfo", + value: HistoricalInfo.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(HistoricalInfo.typeUrl, HistoricalInfo); +GlobalDecoderRegistry.registerAminoProtoMapping(HistoricalInfo.aminoType, HistoricalInfo.typeUrl); +function createBaseCommissionRates(): CommissionRates { + return { + rate: "", + maxRate: "", + maxChangeRate: "" + }; +} +export const CommissionRates = { + typeUrl: "/cosmos.staking.v1beta1.CommissionRates", + aminoType: "cosmos-sdk/CommissionRates", + is(o: any): o is CommissionRates { + return o && (o.$typeUrl === CommissionRates.typeUrl || typeof o.rate === "string" && typeof o.maxRate === "string" && typeof o.maxChangeRate === "string"); + }, + isAmino(o: any): o is CommissionRatesAmino { + return o && (o.$typeUrl === CommissionRates.typeUrl || typeof o.rate === "string" && typeof o.max_rate === "string" && typeof o.max_change_rate === "string"); + }, + encode(message: CommissionRates, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.rate !== "") { + writer.uint32(10).string(message.rate); + } + if (message.maxRate !== "") { + writer.uint32(18).string(message.maxRate); + } + if (message.maxChangeRate !== "") { + writer.uint32(26).string(message.maxChangeRate); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): CommissionRates { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommissionRates(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.rate = reader.string(); + break; + case 2: + message.maxRate = reader.string(); + break; + case 3: + message.maxChangeRate = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): CommissionRates { + const message = createBaseCommissionRates(); + message.rate = object.rate ?? ""; + message.maxRate = object.maxRate ?? ""; + message.maxChangeRate = object.maxChangeRate ?? ""; + return message; + }, + fromAmino(object: CommissionRatesAmino): CommissionRates { + const message = createBaseCommissionRates(); + if (object.rate !== undefined && object.rate !== null) { + message.rate = object.rate; + } + if (object.max_rate !== undefined && object.max_rate !== null) { + message.maxRate = object.max_rate; + } + if (object.max_change_rate !== undefined && object.max_change_rate !== null) { + message.maxChangeRate = object.max_change_rate; + } + return message; + }, + toAmino(message: CommissionRates): CommissionRatesAmino { + const obj: any = {}; + obj.rate = message.rate ?? ""; + obj.max_rate = message.maxRate ?? ""; + obj.max_change_rate = message.maxChangeRate ?? ""; + return obj; + }, + fromAminoMsg(object: CommissionRatesAminoMsg): CommissionRates { + return CommissionRates.fromAmino(object.value); + }, + toAminoMsg(message: CommissionRates): CommissionRatesAminoMsg { + return { + type: "cosmos-sdk/CommissionRates", + value: CommissionRates.toAmino(message) + }; + }, + fromProtoMsg(message: CommissionRatesProtoMsg): CommissionRates { + return CommissionRates.decode(message.value); + }, + toProto(message: CommissionRates): Uint8Array { + return CommissionRates.encode(message).finish(); + }, + toProtoMsg(message: CommissionRates): CommissionRatesProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.CommissionRates", + value: CommissionRates.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(CommissionRates.typeUrl, CommissionRates); +GlobalDecoderRegistry.registerAminoProtoMapping(CommissionRates.aminoType, CommissionRates.typeUrl); +function createBaseCommission(): Commission { + return { + commissionRates: CommissionRates.fromPartial({}), + updateTime: new Date() + }; +} +export const Commission = { + typeUrl: "/cosmos.staking.v1beta1.Commission", + aminoType: "cosmos-sdk/Commission", + is(o: any): o is Commission { + return o && (o.$typeUrl === Commission.typeUrl || CommissionRates.is(o.commissionRates) && Timestamp.is(o.updateTime)); + }, + isAmino(o: any): o is CommissionAmino { + return o && (o.$typeUrl === Commission.typeUrl || CommissionRates.isAmino(o.commission_rates) && Timestamp.isAmino(o.update_time)); + }, + encode(message: Commission, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.commissionRates !== undefined) { + CommissionRates.encode(message.commissionRates, writer.uint32(10).fork()).ldelim(); + } + if (message.updateTime !== undefined) { + Timestamp.encode(toTimestamp(message.updateTime), writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Commission { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommission(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.commissionRates = CommissionRates.decode(reader, reader.uint32()); + break; + case 2: + message.updateTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Commission { + const message = createBaseCommission(); + message.commissionRates = object.commissionRates !== undefined && object.commissionRates !== null ? CommissionRates.fromPartial(object.commissionRates) : undefined; + message.updateTime = object.updateTime ?? undefined; + return message; + }, + fromAmino(object: CommissionAmino): Commission { + const message = createBaseCommission(); + if (object.commission_rates !== undefined && object.commission_rates !== null) { + message.commissionRates = CommissionRates.fromAmino(object.commission_rates); + } + if (object.update_time !== undefined && object.update_time !== null) { + message.updateTime = fromTimestamp(Timestamp.fromAmino(object.update_time)); + } + return message; + }, + toAmino(message: Commission): CommissionAmino { + const obj: any = {}; + obj.commission_rates = message.commissionRates ? CommissionRates.toAmino(message.commissionRates) : CommissionRates.toAmino(CommissionRates.fromPartial({})); + obj.update_time = message.updateTime ? Timestamp.toAmino(toTimestamp(message.updateTime)) : new Date(); + return obj; + }, + fromAminoMsg(object: CommissionAminoMsg): Commission { + return Commission.fromAmino(object.value); + }, + toAminoMsg(message: Commission): CommissionAminoMsg { + return { + type: "cosmos-sdk/Commission", + value: Commission.toAmino(message) + }; + }, + fromProtoMsg(message: CommissionProtoMsg): Commission { + return Commission.decode(message.value); + }, + toProto(message: Commission): Uint8Array { + return Commission.encode(message).finish(); + }, + toProtoMsg(message: Commission): CommissionProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.Commission", + value: Commission.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Commission.typeUrl, Commission); +GlobalDecoderRegistry.registerAminoProtoMapping(Commission.aminoType, Commission.typeUrl); +function createBaseDescription(): Description { + return { + moniker: "", + identity: "", + website: "", + securityContact: "", + details: "" + }; +} +export const Description = { + typeUrl: "/cosmos.staking.v1beta1.Description", + aminoType: "cosmos-sdk/Description", + is(o: any): o is Description { + return o && (o.$typeUrl === Description.typeUrl || typeof o.moniker === "string" && typeof o.identity === "string" && typeof o.website === "string" && typeof o.securityContact === "string" && typeof o.details === "string"); + }, + isAmino(o: any): o is DescriptionAmino { + return o && (o.$typeUrl === Description.typeUrl || typeof o.moniker === "string" && typeof o.identity === "string" && typeof o.website === "string" && typeof o.security_contact === "string" && typeof o.details === "string"); + }, + encode(message: Description, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.moniker !== "") { + writer.uint32(10).string(message.moniker); + } + if (message.identity !== "") { + writer.uint32(18).string(message.identity); + } + if (message.website !== "") { + writer.uint32(26).string(message.website); + } + if (message.securityContact !== "") { + writer.uint32(34).string(message.securityContact); + } + if (message.details !== "") { + writer.uint32(42).string(message.details); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Description { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDescription(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.moniker = reader.string(); + break; + case 2: + message.identity = reader.string(); + break; + case 3: + message.website = reader.string(); + break; + case 4: + message.securityContact = reader.string(); + break; + case 5: + message.details = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Description { + const message = createBaseDescription(); + message.moniker = object.moniker ?? ""; + message.identity = object.identity ?? ""; + message.website = object.website ?? ""; + message.securityContact = object.securityContact ?? ""; + message.details = object.details ?? ""; + return message; + }, + fromAmino(object: DescriptionAmino): Description { + const message = createBaseDescription(); + if (object.moniker !== undefined && object.moniker !== null) { + message.moniker = object.moniker; + } + if (object.identity !== undefined && object.identity !== null) { + message.identity = object.identity; + } + if (object.website !== undefined && object.website !== null) { + message.website = object.website; + } + if (object.security_contact !== undefined && object.security_contact !== null) { + message.securityContact = object.security_contact; + } + if (object.details !== undefined && object.details !== null) { + message.details = object.details; + } + return message; + }, + toAmino(message: Description): DescriptionAmino { + const obj: any = {}; + obj.moniker = message.moniker === "" ? undefined : message.moniker; + obj.identity = message.identity === "" ? undefined : message.identity; + obj.website = message.website === "" ? undefined : message.website; + obj.security_contact = message.securityContact === "" ? undefined : message.securityContact; + obj.details = message.details === "" ? undefined : message.details; + return obj; + }, + fromAminoMsg(object: DescriptionAminoMsg): Description { + return Description.fromAmino(object.value); + }, + toAminoMsg(message: Description): DescriptionAminoMsg { + return { + type: "cosmos-sdk/Description", + value: Description.toAmino(message) + }; + }, + fromProtoMsg(message: DescriptionProtoMsg): Description { + return Description.decode(message.value); + }, + toProto(message: Description): Uint8Array { + return Description.encode(message).finish(); + }, + toProtoMsg(message: Description): DescriptionProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.Description", + value: Description.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Description.typeUrl, Description); +GlobalDecoderRegistry.registerAminoProtoMapping(Description.aminoType, Description.typeUrl); +function createBaseValidator(): Validator { + return { + operatorAddress: "", + consensusPubkey: undefined, + jailed: false, + status: 0, + tokens: "", + delegatorShares: "", + description: Description.fromPartial({}), + unbondingHeight: BigInt(0), + unbondingTime: new Date(), + commission: Commission.fromPartial({}), + minSelfDelegation: "", + unbondingOnHoldRefCount: BigInt(0), + unbondingIds: [] + }; +} +export const Validator = { + typeUrl: "/cosmos.staking.v1beta1.Validator", + aminoType: "cosmos-sdk/Validator", + is(o: any): o is Validator { + return o && (o.$typeUrl === Validator.typeUrl || typeof o.operatorAddress === "string" && typeof o.jailed === "boolean" && isSet(o.status) && typeof o.tokens === "string" && typeof o.delegatorShares === "string" && Description.is(o.description) && typeof o.unbondingHeight === "bigint" && Timestamp.is(o.unbondingTime) && Commission.is(o.commission) && typeof o.minSelfDelegation === "string" && typeof o.unbondingOnHoldRefCount === "bigint" && Array.isArray(o.unbondingIds) && (!o.unbondingIds.length || typeof o.unbondingIds[0] === "bigint")); + }, + isAmino(o: any): o is ValidatorAmino { + return o && (o.$typeUrl === Validator.typeUrl || typeof o.operator_address === "string" && typeof o.jailed === "boolean" && isSet(o.status) && typeof o.tokens === "string" && typeof o.delegator_shares === "string" && Description.isAmino(o.description) && typeof o.unbonding_height === "bigint" && Timestamp.isAmino(o.unbonding_time) && Commission.isAmino(o.commission) && typeof o.min_self_delegation === "string" && typeof o.unbonding_on_hold_ref_count === "bigint" && Array.isArray(o.unbonding_ids) && (!o.unbonding_ids.length || typeof o.unbonding_ids[0] === "bigint")); + }, + encode(message: Validator, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.operatorAddress !== "") { + writer.uint32(10).string(message.operatorAddress); + } + if (message.consensusPubkey !== undefined) { + Any.encode(GlobalDecoderRegistry.wrapAny(message.consensusPubkey), writer.uint32(18).fork()).ldelim(); + } + if (message.jailed === true) { + writer.uint32(24).bool(message.jailed); + } + if (message.status !== 0) { + writer.uint32(32).int32(message.status); + } + if (message.tokens !== "") { + writer.uint32(42).string(message.tokens); + } + if (message.delegatorShares !== "") { + writer.uint32(50).string(message.delegatorShares); + } + if (message.description !== undefined) { + Description.encode(message.description, writer.uint32(58).fork()).ldelim(); + } + if (message.unbondingHeight !== BigInt(0)) { + writer.uint32(64).int64(message.unbondingHeight); + } + if (message.unbondingTime !== undefined) { + Timestamp.encode(toTimestamp(message.unbondingTime), writer.uint32(74).fork()).ldelim(); + } + if (message.commission !== undefined) { + Commission.encode(message.commission, writer.uint32(82).fork()).ldelim(); + } + if (message.minSelfDelegation !== "") { + writer.uint32(90).string(message.minSelfDelegation); + } + if (message.unbondingOnHoldRefCount !== BigInt(0)) { + writer.uint32(96).int64(message.unbondingOnHoldRefCount); + } + writer.uint32(106).fork(); + for (const v of message.unbondingIds) { + writer.uint64(v); + } + writer.ldelim(); + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Validator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.operatorAddress = reader.string(); + break; + case 2: + message.consensusPubkey = GlobalDecoderRegistry.unwrapAny(reader); + break; + case 3: + message.jailed = reader.bool(); + break; + case 4: + message.status = (reader.int32() as any); + break; + case 5: + message.tokens = reader.string(); + break; + case 6: + message.delegatorShares = reader.string(); + break; + case 7: + message.description = Description.decode(reader, reader.uint32()); + break; + case 8: + message.unbondingHeight = reader.int64(); + break; + case 9: + message.unbondingTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 10: + message.commission = Commission.decode(reader, reader.uint32()); + break; + case 11: + message.minSelfDelegation = reader.string(); + break; + case 12: + message.unbondingOnHoldRefCount = reader.int64(); + break; + case 13: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.unbondingIds.push(reader.uint64()); + } + } else { + message.unbondingIds.push(reader.uint64()); + } + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Validator { + const message = createBaseValidator(); + message.operatorAddress = object.operatorAddress ?? ""; + message.consensusPubkey = object.consensusPubkey !== undefined && object.consensusPubkey !== null ? GlobalDecoderRegistry.fromPartial(object.consensusPubkey) : undefined; + message.jailed = object.jailed ?? false; + message.status = object.status ?? 0; + message.tokens = object.tokens ?? ""; + message.delegatorShares = object.delegatorShares ?? ""; + message.description = object.description !== undefined && object.description !== null ? Description.fromPartial(object.description) : undefined; + message.unbondingHeight = object.unbondingHeight !== undefined && object.unbondingHeight !== null ? BigInt(object.unbondingHeight.toString()) : BigInt(0); + message.unbondingTime = object.unbondingTime ?? undefined; + message.commission = object.commission !== undefined && object.commission !== null ? Commission.fromPartial(object.commission) : undefined; + message.minSelfDelegation = object.minSelfDelegation ?? ""; + message.unbondingOnHoldRefCount = object.unbondingOnHoldRefCount !== undefined && object.unbondingOnHoldRefCount !== null ? BigInt(object.unbondingOnHoldRefCount.toString()) : BigInt(0); + message.unbondingIds = object.unbondingIds?.map(e => BigInt(e.toString())) || []; + return message; + }, + fromAmino(object: ValidatorAmino): Validator { + const message = createBaseValidator(); + if (object.operator_address !== undefined && object.operator_address !== null) { + message.operatorAddress = object.operator_address; + } + if (object.consensus_pubkey !== undefined && object.consensus_pubkey !== null) { + message.consensusPubkey = encodePubkey(object.consensus_pubkey); + } + if (object.jailed !== undefined && object.jailed !== null) { + message.jailed = object.jailed; + } + if (object.status !== undefined && object.status !== null) { + message.status = object.status; + } + if (object.tokens !== undefined && object.tokens !== null) { + message.tokens = object.tokens; + } + if (object.delegator_shares !== undefined && object.delegator_shares !== null) { + message.delegatorShares = object.delegator_shares; + } + if (object.description !== undefined && object.description !== null) { + message.description = Description.fromAmino(object.description); + } + if (object.unbonding_height !== undefined && object.unbonding_height !== null) { + message.unbondingHeight = BigInt(object.unbonding_height); + } + if (object.unbonding_time !== undefined && object.unbonding_time !== null) { + message.unbondingTime = fromTimestamp(Timestamp.fromAmino(object.unbonding_time)); + } + if (object.commission !== undefined && object.commission !== null) { + message.commission = Commission.fromAmino(object.commission); + } + if (object.min_self_delegation !== undefined && object.min_self_delegation !== null) { + message.minSelfDelegation = object.min_self_delegation; + } + if (object.unbonding_on_hold_ref_count !== undefined && object.unbonding_on_hold_ref_count !== null) { + message.unbondingOnHoldRefCount = BigInt(object.unbonding_on_hold_ref_count); + } + message.unbondingIds = object.unbonding_ids?.map(e => BigInt(e)) || []; + return message; + }, + toAmino(message: Validator): ValidatorAmino { + const obj: any = {}; + obj.operator_address = message.operatorAddress === "" ? undefined : message.operatorAddress; + obj.consensus_pubkey = message.consensusPubkey ? decodePubkey(message.consensusPubkey) : undefined; + obj.jailed = message.jailed === false ? undefined : message.jailed; + obj.status = message.status === 0 ? undefined : message.status; + obj.tokens = message.tokens === "" ? undefined : message.tokens; + obj.delegator_shares = message.delegatorShares === "" ? undefined : message.delegatorShares; + obj.description = message.description ? Description.toAmino(message.description) : Description.toAmino(Description.fromPartial({})); + obj.unbonding_height = message.unbondingHeight !== BigInt(0) ? message.unbondingHeight?.toString() : undefined; + obj.unbonding_time = message.unbondingTime ? Timestamp.toAmino(toTimestamp(message.unbondingTime)) : new Date(); + obj.commission = message.commission ? Commission.toAmino(message.commission) : Commission.toAmino(Commission.fromPartial({})); + obj.min_self_delegation = message.minSelfDelegation === "" ? undefined : message.minSelfDelegation; + obj.unbonding_on_hold_ref_count = message.unbondingOnHoldRefCount !== BigInt(0) ? message.unbondingOnHoldRefCount?.toString() : undefined; + if (message.unbondingIds) { + obj.unbonding_ids = message.unbondingIds.map(e => e.toString()); + } else { + obj.unbonding_ids = message.unbondingIds; + } + return obj; + }, + fromAminoMsg(object: ValidatorAminoMsg): Validator { + return Validator.fromAmino(object.value); + }, + toAminoMsg(message: Validator): ValidatorAminoMsg { + return { + type: "cosmos-sdk/Validator", + value: Validator.toAmino(message) + }; + }, + fromProtoMsg(message: ValidatorProtoMsg): Validator { + return Validator.decode(message.value); + }, + toProto(message: Validator): Uint8Array { + return Validator.encode(message).finish(); + }, + toProtoMsg(message: Validator): ValidatorProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.Validator", + value: Validator.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Validator.typeUrl, Validator); +GlobalDecoderRegistry.registerAminoProtoMapping(Validator.aminoType, Validator.typeUrl); +function createBaseValAddresses(): ValAddresses { + return { + addresses: [] + }; +} +export const ValAddresses = { + typeUrl: "/cosmos.staking.v1beta1.ValAddresses", + aminoType: "cosmos-sdk/ValAddresses", + is(o: any): o is ValAddresses { + return o && (o.$typeUrl === ValAddresses.typeUrl || Array.isArray(o.addresses) && (!o.addresses.length || typeof o.addresses[0] === "string")); + }, + isAmino(o: any): o is ValAddressesAmino { + return o && (o.$typeUrl === ValAddresses.typeUrl || Array.isArray(o.addresses) && (!o.addresses.length || typeof o.addresses[0] === "string")); + }, + encode(message: ValAddresses, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.addresses) { + writer.uint32(10).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ValAddresses { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValAddresses(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.addresses.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ValAddresses { + const message = createBaseValAddresses(); + message.addresses = object.addresses?.map(e => e) || []; + return message; + }, + fromAmino(object: ValAddressesAmino): ValAddresses { + const message = createBaseValAddresses(); + message.addresses = object.addresses?.map(e => e) || []; + return message; + }, + toAmino(message: ValAddresses): ValAddressesAmino { + const obj: any = {}; + if (message.addresses) { + obj.addresses = message.addresses.map(e => e); + } else { + obj.addresses = message.addresses; + } + return obj; + }, + fromAminoMsg(object: ValAddressesAminoMsg): ValAddresses { + return ValAddresses.fromAmino(object.value); + }, + toAminoMsg(message: ValAddresses): ValAddressesAminoMsg { + return { + type: "cosmos-sdk/ValAddresses", + value: ValAddresses.toAmino(message) + }; + }, + fromProtoMsg(message: ValAddressesProtoMsg): ValAddresses { + return ValAddresses.decode(message.value); + }, + toProto(message: ValAddresses): Uint8Array { + return ValAddresses.encode(message).finish(); + }, + toProtoMsg(message: ValAddresses): ValAddressesProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.ValAddresses", + value: ValAddresses.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ValAddresses.typeUrl, ValAddresses); +GlobalDecoderRegistry.registerAminoProtoMapping(ValAddresses.aminoType, ValAddresses.typeUrl); +function createBaseDVPair(): DVPair { + return { + delegatorAddress: "", + validatorAddress: "" + }; +} +export const DVPair = { + typeUrl: "/cosmos.staking.v1beta1.DVPair", + aminoType: "cosmos-sdk/DVPair", + is(o: any): o is DVPair { + return o && (o.$typeUrl === DVPair.typeUrl || typeof o.delegatorAddress === "string" && typeof o.validatorAddress === "string"); + }, + isAmino(o: any): o is DVPairAmino { + return o && (o.$typeUrl === DVPair.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string"); + }, + encode(message: DVPair, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DVPair { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDVPair(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddress = reader.string(); + break; + case 2: + message.validatorAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): DVPair { + const message = createBaseDVPair(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + return message; + }, + fromAmino(object: DVPairAmino): DVPair { + const message = createBaseDVPair(); + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + return message; + }, + toAmino(message: DVPair): DVPairAmino { + const obj: any = {}; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + return obj; + }, + fromAminoMsg(object: DVPairAminoMsg): DVPair { + return DVPair.fromAmino(object.value); + }, + toAminoMsg(message: DVPair): DVPairAminoMsg { + return { + type: "cosmos-sdk/DVPair", + value: DVPair.toAmino(message) + }; + }, + fromProtoMsg(message: DVPairProtoMsg): DVPair { + return DVPair.decode(message.value); + }, + toProto(message: DVPair): Uint8Array { + return DVPair.encode(message).finish(); + }, + toProtoMsg(message: DVPair): DVPairProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.DVPair", + value: DVPair.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(DVPair.typeUrl, DVPair); +GlobalDecoderRegistry.registerAminoProtoMapping(DVPair.aminoType, DVPair.typeUrl); +function createBaseDVPairs(): DVPairs { + return { + pairs: [] + }; +} +export const DVPairs = { + typeUrl: "/cosmos.staking.v1beta1.DVPairs", + aminoType: "cosmos-sdk/DVPairs", + is(o: any): o is DVPairs { + return o && (o.$typeUrl === DVPairs.typeUrl || Array.isArray(o.pairs) && (!o.pairs.length || DVPair.is(o.pairs[0]))); + }, + isAmino(o: any): o is DVPairsAmino { + return o && (o.$typeUrl === DVPairs.typeUrl || Array.isArray(o.pairs) && (!o.pairs.length || DVPair.isAmino(o.pairs[0]))); + }, + encode(message: DVPairs, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.pairs) { + DVPair.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DVPairs { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDVPairs(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pairs.push(DVPair.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): DVPairs { + const message = createBaseDVPairs(); + message.pairs = object.pairs?.map(e => DVPair.fromPartial(e)) || []; + return message; + }, + fromAmino(object: DVPairsAmino): DVPairs { + const message = createBaseDVPairs(); + message.pairs = object.pairs?.map(e => DVPair.fromAmino(e)) || []; + return message; + }, + toAmino(message: DVPairs): DVPairsAmino { + const obj: any = {}; + if (message.pairs) { + obj.pairs = message.pairs.map(e => e ? DVPair.toAmino(e) : undefined); + } else { + obj.pairs = message.pairs; + } + return obj; + }, + fromAminoMsg(object: DVPairsAminoMsg): DVPairs { + return DVPairs.fromAmino(object.value); + }, + toAminoMsg(message: DVPairs): DVPairsAminoMsg { + return { + type: "cosmos-sdk/DVPairs", + value: DVPairs.toAmino(message) + }; + }, + fromProtoMsg(message: DVPairsProtoMsg): DVPairs { + return DVPairs.decode(message.value); + }, + toProto(message: DVPairs): Uint8Array { + return DVPairs.encode(message).finish(); + }, + toProtoMsg(message: DVPairs): DVPairsProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.DVPairs", + value: DVPairs.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(DVPairs.typeUrl, DVPairs); +GlobalDecoderRegistry.registerAminoProtoMapping(DVPairs.aminoType, DVPairs.typeUrl); +function createBaseDVVTriplet(): DVVTriplet { + return { + delegatorAddress: "", + validatorSrcAddress: "", + validatorDstAddress: "" + }; +} +export const DVVTriplet = { + typeUrl: "/cosmos.staking.v1beta1.DVVTriplet", + aminoType: "cosmos-sdk/DVVTriplet", + is(o: any): o is DVVTriplet { + return o && (o.$typeUrl === DVVTriplet.typeUrl || typeof o.delegatorAddress === "string" && typeof o.validatorSrcAddress === "string" && typeof o.validatorDstAddress === "string"); + }, + isAmino(o: any): o is DVVTripletAmino { + return o && (o.$typeUrl === DVVTriplet.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_src_address === "string" && typeof o.validator_dst_address === "string"); + }, + encode(message: DVVTriplet, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorSrcAddress !== "") { + writer.uint32(18).string(message.validatorSrcAddress); + } + if (message.validatorDstAddress !== "") { + writer.uint32(26).string(message.validatorDstAddress); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DVVTriplet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDVVTriplet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddress = reader.string(); + break; + case 2: + message.validatorSrcAddress = reader.string(); + break; + case 3: + message.validatorDstAddress = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): DVVTriplet { + const message = createBaseDVVTriplet(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorSrcAddress = object.validatorSrcAddress ?? ""; + message.validatorDstAddress = object.validatorDstAddress ?? ""; + return message; + }, + fromAmino(object: DVVTripletAmino): DVVTriplet { + const message = createBaseDVVTriplet(); + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + if (object.validator_src_address !== undefined && object.validator_src_address !== null) { + message.validatorSrcAddress = object.validator_src_address; + } + if (object.validator_dst_address !== undefined && object.validator_dst_address !== null) { + message.validatorDstAddress = object.validator_dst_address; + } + return message; + }, + toAmino(message: DVVTriplet): DVVTripletAmino { + const obj: any = {}; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_src_address = message.validatorSrcAddress === "" ? undefined : message.validatorSrcAddress; + obj.validator_dst_address = message.validatorDstAddress === "" ? undefined : message.validatorDstAddress; + return obj; + }, + fromAminoMsg(object: DVVTripletAminoMsg): DVVTriplet { + return DVVTriplet.fromAmino(object.value); + }, + toAminoMsg(message: DVVTriplet): DVVTripletAminoMsg { + return { + type: "cosmos-sdk/DVVTriplet", + value: DVVTriplet.toAmino(message) + }; + }, + fromProtoMsg(message: DVVTripletProtoMsg): DVVTriplet { + return DVVTriplet.decode(message.value); + }, + toProto(message: DVVTriplet): Uint8Array { + return DVVTriplet.encode(message).finish(); + }, + toProtoMsg(message: DVVTriplet): DVVTripletProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.DVVTriplet", + value: DVVTriplet.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(DVVTriplet.typeUrl, DVVTriplet); +GlobalDecoderRegistry.registerAminoProtoMapping(DVVTriplet.aminoType, DVVTriplet.typeUrl); +function createBaseDVVTriplets(): DVVTriplets { + return { + triplets: [] + }; +} +export const DVVTriplets = { + typeUrl: "/cosmos.staking.v1beta1.DVVTriplets", + aminoType: "cosmos-sdk/DVVTriplets", + is(o: any): o is DVVTriplets { + return o && (o.$typeUrl === DVVTriplets.typeUrl || Array.isArray(o.triplets) && (!o.triplets.length || DVVTriplet.is(o.triplets[0]))); + }, + isAmino(o: any): o is DVVTripletsAmino { + return o && (o.$typeUrl === DVVTriplets.typeUrl || Array.isArray(o.triplets) && (!o.triplets.length || DVVTriplet.isAmino(o.triplets[0]))); + }, + encode(message: DVVTriplets, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.triplets) { + DVVTriplet.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DVVTriplets { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDVVTriplets(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.triplets.push(DVVTriplet.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): DVVTriplets { + const message = createBaseDVVTriplets(); + message.triplets = object.triplets?.map(e => DVVTriplet.fromPartial(e)) || []; + return message; + }, + fromAmino(object: DVVTripletsAmino): DVVTriplets { + const message = createBaseDVVTriplets(); + message.triplets = object.triplets?.map(e => DVVTriplet.fromAmino(e)) || []; + return message; + }, + toAmino(message: DVVTriplets): DVVTripletsAmino { + const obj: any = {}; + if (message.triplets) { + obj.triplets = message.triplets.map(e => e ? DVVTriplet.toAmino(e) : undefined); + } else { + obj.triplets = message.triplets; + } + return obj; + }, + fromAminoMsg(object: DVVTripletsAminoMsg): DVVTriplets { + return DVVTriplets.fromAmino(object.value); + }, + toAminoMsg(message: DVVTriplets): DVVTripletsAminoMsg { + return { + type: "cosmos-sdk/DVVTriplets", + value: DVVTriplets.toAmino(message) + }; + }, + fromProtoMsg(message: DVVTripletsProtoMsg): DVVTriplets { + return DVVTriplets.decode(message.value); + }, + toProto(message: DVVTriplets): Uint8Array { + return DVVTriplets.encode(message).finish(); + }, + toProtoMsg(message: DVVTriplets): DVVTripletsProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.DVVTriplets", + value: DVVTriplets.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(DVVTriplets.typeUrl, DVVTriplets); +GlobalDecoderRegistry.registerAminoProtoMapping(DVVTriplets.aminoType, DVVTriplets.typeUrl); +function createBaseDelegation(): Delegation { + return { + delegatorAddress: "", + validatorAddress: "", + shares: "" + }; +} +export const Delegation = { + typeUrl: "/cosmos.staking.v1beta1.Delegation", + aminoType: "cosmos-sdk/Delegation", + is(o: any): o is Delegation { + return o && (o.$typeUrl === Delegation.typeUrl || typeof o.delegatorAddress === "string" && typeof o.validatorAddress === "string" && typeof o.shares === "string"); + }, + isAmino(o: any): o is DelegationAmino { + return o && (o.$typeUrl === Delegation.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string" && typeof o.shares === "string"); + }, + encode(message: Delegation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.shares !== "") { + writer.uint32(26).string(message.shares); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Delegation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddress = reader.string(); + break; + case 2: + message.validatorAddress = reader.string(); + break; + case 3: + message.shares = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Delegation { + const message = createBaseDelegation(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.shares = object.shares ?? ""; + return message; + }, + fromAmino(object: DelegationAmino): Delegation { + const message = createBaseDelegation(); + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + if (object.shares !== undefined && object.shares !== null) { + message.shares = object.shares; + } + return message; + }, + toAmino(message: Delegation): DelegationAmino { + const obj: any = {}; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.shares = message.shares === "" ? undefined : message.shares; + return obj; + }, + fromAminoMsg(object: DelegationAminoMsg): Delegation { + return Delegation.fromAmino(object.value); + }, + toAminoMsg(message: Delegation): DelegationAminoMsg { + return { + type: "cosmos-sdk/Delegation", + value: Delegation.toAmino(message) + }; + }, + fromProtoMsg(message: DelegationProtoMsg): Delegation { + return Delegation.decode(message.value); + }, + toProto(message: Delegation): Uint8Array { + return Delegation.encode(message).finish(); + }, + toProtoMsg(message: Delegation): DelegationProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.Delegation", + value: Delegation.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Delegation.typeUrl, Delegation); +GlobalDecoderRegistry.registerAminoProtoMapping(Delegation.aminoType, Delegation.typeUrl); +function createBaseUnbondingDelegation(): UnbondingDelegation { + return { + delegatorAddress: "", + validatorAddress: "", + entries: [] + }; +} +export const UnbondingDelegation = { + typeUrl: "/cosmos.staking.v1beta1.UnbondingDelegation", + aminoType: "cosmos-sdk/UnbondingDelegation", + is(o: any): o is UnbondingDelegation { + return o && (o.$typeUrl === UnbondingDelegation.typeUrl || typeof o.delegatorAddress === "string" && typeof o.validatorAddress === "string" && Array.isArray(o.entries) && (!o.entries.length || UnbondingDelegationEntry.is(o.entries[0]))); + }, + isAmino(o: any): o is UnbondingDelegationAmino { + return o && (o.$typeUrl === UnbondingDelegation.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string" && Array.isArray(o.entries) && (!o.entries.length || UnbondingDelegationEntry.isAmino(o.entries[0]))); + }, + encode(message: UnbondingDelegation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + for (const v of message.entries) { + UnbondingDelegationEntry.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): UnbondingDelegation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUnbondingDelegation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddress = reader.string(); + break; + case 2: + message.validatorAddress = reader.string(); + break; + case 3: + message.entries.push(UnbondingDelegationEntry.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): UnbondingDelegation { + const message = createBaseUnbondingDelegation(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.entries = object.entries?.map(e => UnbondingDelegationEntry.fromPartial(e)) || []; + return message; + }, + fromAmino(object: UnbondingDelegationAmino): UnbondingDelegation { + const message = createBaseUnbondingDelegation(); + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + message.entries = object.entries?.map(e => UnbondingDelegationEntry.fromAmino(e)) || []; + return message; + }, + toAmino(message: UnbondingDelegation): UnbondingDelegationAmino { + const obj: any = {}; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + if (message.entries) { + obj.entries = message.entries.map(e => e ? UnbondingDelegationEntry.toAmino(e) : undefined); + } else { + obj.entries = message.entries; + } + return obj; + }, + fromAminoMsg(object: UnbondingDelegationAminoMsg): UnbondingDelegation { + return UnbondingDelegation.fromAmino(object.value); + }, + toAminoMsg(message: UnbondingDelegation): UnbondingDelegationAminoMsg { + return { + type: "cosmos-sdk/UnbondingDelegation", + value: UnbondingDelegation.toAmino(message) + }; + }, + fromProtoMsg(message: UnbondingDelegationProtoMsg): UnbondingDelegation { + return UnbondingDelegation.decode(message.value); + }, + toProto(message: UnbondingDelegation): Uint8Array { + return UnbondingDelegation.encode(message).finish(); + }, + toProtoMsg(message: UnbondingDelegation): UnbondingDelegationProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.UnbondingDelegation", + value: UnbondingDelegation.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(UnbondingDelegation.typeUrl, UnbondingDelegation); +GlobalDecoderRegistry.registerAminoProtoMapping(UnbondingDelegation.aminoType, UnbondingDelegation.typeUrl); +function createBaseUnbondingDelegationEntry(): UnbondingDelegationEntry { + return { + creationHeight: BigInt(0), + completionTime: new Date(), + initialBalance: "", + balance: "", + unbondingId: BigInt(0), + unbondingOnHoldRefCount: BigInt(0) + }; +} +export const UnbondingDelegationEntry = { + typeUrl: "/cosmos.staking.v1beta1.UnbondingDelegationEntry", + aminoType: "cosmos-sdk/UnbondingDelegationEntry", + is(o: any): o is UnbondingDelegationEntry { + return o && (o.$typeUrl === UnbondingDelegationEntry.typeUrl || typeof o.creationHeight === "bigint" && Timestamp.is(o.completionTime) && typeof o.initialBalance === "string" && typeof o.balance === "string" && typeof o.unbondingId === "bigint" && typeof o.unbondingOnHoldRefCount === "bigint"); + }, + isAmino(o: any): o is UnbondingDelegationEntryAmino { + return o && (o.$typeUrl === UnbondingDelegationEntry.typeUrl || typeof o.creation_height === "bigint" && Timestamp.isAmino(o.completion_time) && typeof o.initial_balance === "string" && typeof o.balance === "string" && typeof o.unbonding_id === "bigint" && typeof o.unbonding_on_hold_ref_count === "bigint"); + }, + encode(message: UnbondingDelegationEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.creationHeight !== BigInt(0)) { + writer.uint32(8).int64(message.creationHeight); + } + if (message.completionTime !== undefined) { + Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(18).fork()).ldelim(); + } + if (message.initialBalance !== "") { + writer.uint32(26).string(message.initialBalance); + } + if (message.balance !== "") { + writer.uint32(34).string(message.balance); + } + if (message.unbondingId !== BigInt(0)) { + writer.uint32(40).uint64(message.unbondingId); + } + if (message.unbondingOnHoldRefCount !== BigInt(0)) { + writer.uint32(48).int64(message.unbondingOnHoldRefCount); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): UnbondingDelegationEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUnbondingDelegationEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.creationHeight = reader.int64(); + break; + case 2: + message.completionTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 3: + message.initialBalance = reader.string(); + break; + case 4: + message.balance = reader.string(); + break; + case 5: + message.unbondingId = reader.uint64(); + break; + case 6: + message.unbondingOnHoldRefCount = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): UnbondingDelegationEntry { + const message = createBaseUnbondingDelegationEntry(); + message.creationHeight = object.creationHeight !== undefined && object.creationHeight !== null ? BigInt(object.creationHeight.toString()) : BigInt(0); + message.completionTime = object.completionTime ?? undefined; + message.initialBalance = object.initialBalance ?? ""; + message.balance = object.balance ?? ""; + message.unbondingId = object.unbondingId !== undefined && object.unbondingId !== null ? BigInt(object.unbondingId.toString()) : BigInt(0); + message.unbondingOnHoldRefCount = object.unbondingOnHoldRefCount !== undefined && object.unbondingOnHoldRefCount !== null ? BigInt(object.unbondingOnHoldRefCount.toString()) : BigInt(0); + return message; + }, + fromAmino(object: UnbondingDelegationEntryAmino): UnbondingDelegationEntry { + const message = createBaseUnbondingDelegationEntry(); + if (object.creation_height !== undefined && object.creation_height !== null) { + message.creationHeight = BigInt(object.creation_height); + } + if (object.completion_time !== undefined && object.completion_time !== null) { + message.completionTime = fromTimestamp(Timestamp.fromAmino(object.completion_time)); + } + if (object.initial_balance !== undefined && object.initial_balance !== null) { + message.initialBalance = object.initial_balance; + } + if (object.balance !== undefined && object.balance !== null) { + message.balance = object.balance; + } + if (object.unbonding_id !== undefined && object.unbonding_id !== null) { + message.unbondingId = BigInt(object.unbonding_id); + } + if (object.unbonding_on_hold_ref_count !== undefined && object.unbonding_on_hold_ref_count !== null) { + message.unbondingOnHoldRefCount = BigInt(object.unbonding_on_hold_ref_count); + } + return message; + }, + toAmino(message: UnbondingDelegationEntry): UnbondingDelegationEntryAmino { + const obj: any = {}; + obj.creation_height = message.creationHeight !== BigInt(0) ? message.creationHeight?.toString() : undefined; + obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : new Date(); + obj.initial_balance = message.initialBalance === "" ? undefined : message.initialBalance; + obj.balance = message.balance === "" ? undefined : message.balance; + obj.unbonding_id = message.unbondingId !== BigInt(0) ? message.unbondingId?.toString() : undefined; + obj.unbonding_on_hold_ref_count = message.unbondingOnHoldRefCount !== BigInt(0) ? message.unbondingOnHoldRefCount?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: UnbondingDelegationEntryAminoMsg): UnbondingDelegationEntry { + return UnbondingDelegationEntry.fromAmino(object.value); + }, + toAminoMsg(message: UnbondingDelegationEntry): UnbondingDelegationEntryAminoMsg { + return { + type: "cosmos-sdk/UnbondingDelegationEntry", + value: UnbondingDelegationEntry.toAmino(message) + }; + }, + fromProtoMsg(message: UnbondingDelegationEntryProtoMsg): UnbondingDelegationEntry { + return UnbondingDelegationEntry.decode(message.value); + }, + toProto(message: UnbondingDelegationEntry): Uint8Array { + return UnbondingDelegationEntry.encode(message).finish(); + }, + toProtoMsg(message: UnbondingDelegationEntry): UnbondingDelegationEntryProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.UnbondingDelegationEntry", + value: UnbondingDelegationEntry.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(UnbondingDelegationEntry.typeUrl, UnbondingDelegationEntry); +GlobalDecoderRegistry.registerAminoProtoMapping(UnbondingDelegationEntry.aminoType, UnbondingDelegationEntry.typeUrl); +function createBaseRedelegationEntry(): RedelegationEntry { + return { + creationHeight: BigInt(0), + completionTime: new Date(), + initialBalance: "", + sharesDst: "", + unbondingId: BigInt(0), + unbondingOnHoldRefCount: BigInt(0) + }; +} +export const RedelegationEntry = { + typeUrl: "/cosmos.staking.v1beta1.RedelegationEntry", + aminoType: "cosmos-sdk/RedelegationEntry", + is(o: any): o is RedelegationEntry { + return o && (o.$typeUrl === RedelegationEntry.typeUrl || typeof o.creationHeight === "bigint" && Timestamp.is(o.completionTime) && typeof o.initialBalance === "string" && typeof o.sharesDst === "string" && typeof o.unbondingId === "bigint" && typeof o.unbondingOnHoldRefCount === "bigint"); + }, + isAmino(o: any): o is RedelegationEntryAmino { + return o && (o.$typeUrl === RedelegationEntry.typeUrl || typeof o.creation_height === "bigint" && Timestamp.isAmino(o.completion_time) && typeof o.initial_balance === "string" && typeof o.shares_dst === "string" && typeof o.unbonding_id === "bigint" && typeof o.unbonding_on_hold_ref_count === "bigint"); + }, + encode(message: RedelegationEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.creationHeight !== BigInt(0)) { + writer.uint32(8).int64(message.creationHeight); + } + if (message.completionTime !== undefined) { + Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(18).fork()).ldelim(); + } + if (message.initialBalance !== "") { + writer.uint32(26).string(message.initialBalance); + } + if (message.sharesDst !== "") { + writer.uint32(34).string(message.sharesDst); + } + if (message.unbondingId !== BigInt(0)) { + writer.uint32(40).uint64(message.unbondingId); + } + if (message.unbondingOnHoldRefCount !== BigInt(0)) { + writer.uint32(48).int64(message.unbondingOnHoldRefCount); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RedelegationEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRedelegationEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.creationHeight = reader.int64(); + break; + case 2: + message.completionTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 3: + message.initialBalance = reader.string(); + break; + case 4: + message.sharesDst = reader.string(); + break; + case 5: + message.unbondingId = reader.uint64(); + break; + case 6: + message.unbondingOnHoldRefCount = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): RedelegationEntry { + const message = createBaseRedelegationEntry(); + message.creationHeight = object.creationHeight !== undefined && object.creationHeight !== null ? BigInt(object.creationHeight.toString()) : BigInt(0); + message.completionTime = object.completionTime ?? undefined; + message.initialBalance = object.initialBalance ?? ""; + message.sharesDst = object.sharesDst ?? ""; + message.unbondingId = object.unbondingId !== undefined && object.unbondingId !== null ? BigInt(object.unbondingId.toString()) : BigInt(0); + message.unbondingOnHoldRefCount = object.unbondingOnHoldRefCount !== undefined && object.unbondingOnHoldRefCount !== null ? BigInt(object.unbondingOnHoldRefCount.toString()) : BigInt(0); + return message; + }, + fromAmino(object: RedelegationEntryAmino): RedelegationEntry { + const message = createBaseRedelegationEntry(); + if (object.creation_height !== undefined && object.creation_height !== null) { + message.creationHeight = BigInt(object.creation_height); + } + if (object.completion_time !== undefined && object.completion_time !== null) { + message.completionTime = fromTimestamp(Timestamp.fromAmino(object.completion_time)); + } + if (object.initial_balance !== undefined && object.initial_balance !== null) { + message.initialBalance = object.initial_balance; + } + if (object.shares_dst !== undefined && object.shares_dst !== null) { + message.sharesDst = object.shares_dst; + } + if (object.unbonding_id !== undefined && object.unbonding_id !== null) { + message.unbondingId = BigInt(object.unbonding_id); + } + if (object.unbonding_on_hold_ref_count !== undefined && object.unbonding_on_hold_ref_count !== null) { + message.unbondingOnHoldRefCount = BigInt(object.unbonding_on_hold_ref_count); + } + return message; + }, + toAmino(message: RedelegationEntry): RedelegationEntryAmino { + const obj: any = {}; + obj.creation_height = message.creationHeight !== BigInt(0) ? message.creationHeight?.toString() : undefined; + obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : new Date(); + obj.initial_balance = message.initialBalance === "" ? undefined : message.initialBalance; + obj.shares_dst = message.sharesDst === "" ? undefined : message.sharesDst; + obj.unbonding_id = message.unbondingId !== BigInt(0) ? message.unbondingId?.toString() : undefined; + obj.unbonding_on_hold_ref_count = message.unbondingOnHoldRefCount !== BigInt(0) ? message.unbondingOnHoldRefCount?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: RedelegationEntryAminoMsg): RedelegationEntry { + return RedelegationEntry.fromAmino(object.value); + }, + toAminoMsg(message: RedelegationEntry): RedelegationEntryAminoMsg { + return { + type: "cosmos-sdk/RedelegationEntry", + value: RedelegationEntry.toAmino(message) + }; + }, + fromProtoMsg(message: RedelegationEntryProtoMsg): RedelegationEntry { + return RedelegationEntry.decode(message.value); + }, + toProto(message: RedelegationEntry): Uint8Array { + return RedelegationEntry.encode(message).finish(); + }, + toProtoMsg(message: RedelegationEntry): RedelegationEntryProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.RedelegationEntry", + value: RedelegationEntry.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(RedelegationEntry.typeUrl, RedelegationEntry); +GlobalDecoderRegistry.registerAminoProtoMapping(RedelegationEntry.aminoType, RedelegationEntry.typeUrl); +function createBaseRedelegation(): Redelegation { + return { + delegatorAddress: "", + validatorSrcAddress: "", + validatorDstAddress: "", + entries: [] + }; +} +export const Redelegation = { + typeUrl: "/cosmos.staking.v1beta1.Redelegation", + aminoType: "cosmos-sdk/Redelegation", + is(o: any): o is Redelegation { + return o && (o.$typeUrl === Redelegation.typeUrl || typeof o.delegatorAddress === "string" && typeof o.validatorSrcAddress === "string" && typeof o.validatorDstAddress === "string" && Array.isArray(o.entries) && (!o.entries.length || RedelegationEntry.is(o.entries[0]))); + }, + isAmino(o: any): o is RedelegationAmino { + return o && (o.$typeUrl === Redelegation.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_src_address === "string" && typeof o.validator_dst_address === "string" && Array.isArray(o.entries) && (!o.entries.length || RedelegationEntry.isAmino(o.entries[0]))); + }, + encode(message: Redelegation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorSrcAddress !== "") { + writer.uint32(18).string(message.validatorSrcAddress); + } + if (message.validatorDstAddress !== "") { + writer.uint32(26).string(message.validatorDstAddress); + } + for (const v of message.entries) { + RedelegationEntry.encode(v!, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Redelegation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRedelegation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddress = reader.string(); + break; + case 2: + message.validatorSrcAddress = reader.string(); + break; + case 3: + message.validatorDstAddress = reader.string(); + break; + case 4: + message.entries.push(RedelegationEntry.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Redelegation { + const message = createBaseRedelegation(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorSrcAddress = object.validatorSrcAddress ?? ""; + message.validatorDstAddress = object.validatorDstAddress ?? ""; + message.entries = object.entries?.map(e => RedelegationEntry.fromPartial(e)) || []; + return message; + }, + fromAmino(object: RedelegationAmino): Redelegation { + const message = createBaseRedelegation(); + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + if (object.validator_src_address !== undefined && object.validator_src_address !== null) { + message.validatorSrcAddress = object.validator_src_address; + } + if (object.validator_dst_address !== undefined && object.validator_dst_address !== null) { + message.validatorDstAddress = object.validator_dst_address; + } + message.entries = object.entries?.map(e => RedelegationEntry.fromAmino(e)) || []; + return message; + }, + toAmino(message: Redelegation): RedelegationAmino { + const obj: any = {}; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_src_address = message.validatorSrcAddress === "" ? undefined : message.validatorSrcAddress; + obj.validator_dst_address = message.validatorDstAddress === "" ? undefined : message.validatorDstAddress; + if (message.entries) { + obj.entries = message.entries.map(e => e ? RedelegationEntry.toAmino(e) : undefined); + } else { + obj.entries = message.entries; + } + return obj; + }, + fromAminoMsg(object: RedelegationAminoMsg): Redelegation { + return Redelegation.fromAmino(object.value); + }, + toAminoMsg(message: Redelegation): RedelegationAminoMsg { + return { + type: "cosmos-sdk/Redelegation", + value: Redelegation.toAmino(message) + }; + }, + fromProtoMsg(message: RedelegationProtoMsg): Redelegation { + return Redelegation.decode(message.value); + }, + toProto(message: Redelegation): Uint8Array { + return Redelegation.encode(message).finish(); + }, + toProtoMsg(message: Redelegation): RedelegationProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.Redelegation", + value: Redelegation.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Redelegation.typeUrl, Redelegation); +GlobalDecoderRegistry.registerAminoProtoMapping(Redelegation.aminoType, Redelegation.typeUrl); +function createBaseParams(): Params { + return { + unbondingTime: Duration.fromPartial({}), + maxValidators: 0, + maxEntries: 0, + historicalEntries: 0, + bondDenom: "", + minCommissionRate: "" + }; +} +export const Params = { + typeUrl: "/cosmos.staking.v1beta1.Params", + aminoType: "cosmos-sdk/x/staking/Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || Duration.is(o.unbondingTime) && typeof o.maxValidators === "number" && typeof o.maxEntries === "number" && typeof o.historicalEntries === "number" && typeof o.bondDenom === "string" && typeof o.minCommissionRate === "string"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || Duration.isAmino(o.unbonding_time) && typeof o.max_validators === "number" && typeof o.max_entries === "number" && typeof o.historical_entries === "number" && typeof o.bond_denom === "string" && typeof o.min_commission_rate === "string"); + }, + encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.unbondingTime !== undefined) { + Duration.encode(message.unbondingTime, writer.uint32(10).fork()).ldelim(); + } + if (message.maxValidators !== 0) { + writer.uint32(16).uint32(message.maxValidators); + } + if (message.maxEntries !== 0) { + writer.uint32(24).uint32(message.maxEntries); + } + if (message.historicalEntries !== 0) { + writer.uint32(32).uint32(message.historicalEntries); + } + if (message.bondDenom !== "") { + writer.uint32(42).string(message.bondDenom); + } + if (message.minCommissionRate !== "") { + writer.uint32(50).string(message.minCommissionRate); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.unbondingTime = Duration.decode(reader, reader.uint32()); + break; + case 2: + message.maxValidators = reader.uint32(); + break; + case 3: + message.maxEntries = reader.uint32(); + break; + case 4: + message.historicalEntries = reader.uint32(); + break; + case 5: + message.bondDenom = reader.string(); + break; + case 6: + message.minCommissionRate = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Params { + const message = createBaseParams(); + message.unbondingTime = object.unbondingTime !== undefined && object.unbondingTime !== null ? Duration.fromPartial(object.unbondingTime) : undefined; + message.maxValidators = object.maxValidators ?? 0; + message.maxEntries = object.maxEntries ?? 0; + message.historicalEntries = object.historicalEntries ?? 0; + message.bondDenom = object.bondDenom ?? ""; + message.minCommissionRate = object.minCommissionRate ?? ""; + return message; + }, + fromAmino(object: ParamsAmino): Params { + const message = createBaseParams(); + if (object.unbonding_time !== undefined && object.unbonding_time !== null) { + message.unbondingTime = Duration.fromAmino(object.unbonding_time); + } + if (object.max_validators !== undefined && object.max_validators !== null) { + message.maxValidators = object.max_validators; + } + if (object.max_entries !== undefined && object.max_entries !== null) { + message.maxEntries = object.max_entries; + } + if (object.historical_entries !== undefined && object.historical_entries !== null) { + message.historicalEntries = object.historical_entries; + } + if (object.bond_denom !== undefined && object.bond_denom !== null) { + message.bondDenom = object.bond_denom; + } + if (object.min_commission_rate !== undefined && object.min_commission_rate !== null) { + message.minCommissionRate = object.min_commission_rate; + } + return message; + }, + toAmino(message: Params): ParamsAmino { + const obj: any = {}; + obj.unbonding_time = message.unbondingTime ? Duration.toAmino(message.unbondingTime) : Duration.toAmino(Duration.fromPartial({})); + obj.max_validators = message.maxValidators === 0 ? undefined : message.maxValidators; + obj.max_entries = message.maxEntries === 0 ? undefined : message.maxEntries; + obj.historical_entries = message.historicalEntries === 0 ? undefined : message.historicalEntries; + obj.bond_denom = message.bondDenom === "" ? undefined : message.bondDenom; + obj.min_commission_rate = message.minCommissionRate ?? ""; + return obj; + }, + fromAminoMsg(object: ParamsAminoMsg): Params { + return Params.fromAmino(object.value); + }, + toAminoMsg(message: Params): ParamsAminoMsg { + return { + type: "cosmos-sdk/x/staking/Params", + value: Params.toAmino(message) + }; + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.Params", + value: Params.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Params.typeUrl, Params); +GlobalDecoderRegistry.registerAminoProtoMapping(Params.aminoType, Params.typeUrl); +function createBaseDelegationResponse(): DelegationResponse { + return { + delegation: Delegation.fromPartial({}), + balance: Coin.fromPartial({}) + }; +} +export const DelegationResponse = { + typeUrl: "/cosmos.staking.v1beta1.DelegationResponse", + aminoType: "cosmos-sdk/DelegationResponse", + is(o: any): o is DelegationResponse { + return o && (o.$typeUrl === DelegationResponse.typeUrl || Delegation.is(o.delegation) && Coin.is(o.balance)); + }, + isAmino(o: any): o is DelegationResponseAmino { + return o && (o.$typeUrl === DelegationResponse.typeUrl || Delegation.isAmino(o.delegation) && Coin.isAmino(o.balance)); + }, + encode(message: DelegationResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegation !== undefined) { + Delegation.encode(message.delegation, writer.uint32(10).fork()).ldelim(); + } + if (message.balance !== undefined) { + Coin.encode(message.balance, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegation = Delegation.decode(reader, reader.uint32()); + break; + case 2: + message.balance = Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): DelegationResponse { + const message = createBaseDelegationResponse(); + message.delegation = object.delegation !== undefined && object.delegation !== null ? Delegation.fromPartial(object.delegation) : undefined; + message.balance = object.balance !== undefined && object.balance !== null ? Coin.fromPartial(object.balance) : undefined; + return message; + }, + fromAmino(object: DelegationResponseAmino): DelegationResponse { + const message = createBaseDelegationResponse(); + if (object.delegation !== undefined && object.delegation !== null) { + message.delegation = Delegation.fromAmino(object.delegation); + } + if (object.balance !== undefined && object.balance !== null) { + message.balance = Coin.fromAmino(object.balance); + } + return message; + }, + toAmino(message: DelegationResponse): DelegationResponseAmino { + const obj: any = {}; + obj.delegation = message.delegation ? Delegation.toAmino(message.delegation) : Delegation.toAmino(Delegation.fromPartial({})); + obj.balance = message.balance ? Coin.toAmino(message.balance) : Coin.toAmino(Coin.fromPartial({})); + return obj; + }, + fromAminoMsg(object: DelegationResponseAminoMsg): DelegationResponse { + return DelegationResponse.fromAmino(object.value); + }, + toAminoMsg(message: DelegationResponse): DelegationResponseAminoMsg { + return { + type: "cosmos-sdk/DelegationResponse", + value: DelegationResponse.toAmino(message) + }; + }, + fromProtoMsg(message: DelegationResponseProtoMsg): DelegationResponse { + return DelegationResponse.decode(message.value); + }, + toProto(message: DelegationResponse): Uint8Array { + return DelegationResponse.encode(message).finish(); + }, + toProtoMsg(message: DelegationResponse): DelegationResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.DelegationResponse", + value: DelegationResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(DelegationResponse.typeUrl, DelegationResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(DelegationResponse.aminoType, DelegationResponse.typeUrl); +function createBaseRedelegationEntryResponse(): RedelegationEntryResponse { + return { + redelegationEntry: RedelegationEntry.fromPartial({}), + balance: "" + }; +} +export const RedelegationEntryResponse = { + typeUrl: "/cosmos.staking.v1beta1.RedelegationEntryResponse", + aminoType: "cosmos-sdk/RedelegationEntryResponse", + is(o: any): o is RedelegationEntryResponse { + return o && (o.$typeUrl === RedelegationEntryResponse.typeUrl || RedelegationEntry.is(o.redelegationEntry) && typeof o.balance === "string"); + }, + isAmino(o: any): o is RedelegationEntryResponseAmino { + return o && (o.$typeUrl === RedelegationEntryResponse.typeUrl || RedelegationEntry.isAmino(o.redelegation_entry) && typeof o.balance === "string"); + }, + encode(message: RedelegationEntryResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.redelegationEntry !== undefined) { + RedelegationEntry.encode(message.redelegationEntry, writer.uint32(10).fork()).ldelim(); + } + if (message.balance !== "") { + writer.uint32(34).string(message.balance); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RedelegationEntryResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRedelegationEntryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.redelegationEntry = RedelegationEntry.decode(reader, reader.uint32()); + break; + case 4: + message.balance = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): RedelegationEntryResponse { + const message = createBaseRedelegationEntryResponse(); + message.redelegationEntry = object.redelegationEntry !== undefined && object.redelegationEntry !== null ? RedelegationEntry.fromPartial(object.redelegationEntry) : undefined; + message.balance = object.balance ?? ""; + return message; + }, + fromAmino(object: RedelegationEntryResponseAmino): RedelegationEntryResponse { + const message = createBaseRedelegationEntryResponse(); + if (object.redelegation_entry !== undefined && object.redelegation_entry !== null) { + message.redelegationEntry = RedelegationEntry.fromAmino(object.redelegation_entry); + } + if (object.balance !== undefined && object.balance !== null) { + message.balance = object.balance; + } + return message; + }, + toAmino(message: RedelegationEntryResponse): RedelegationEntryResponseAmino { + const obj: any = {}; + obj.redelegation_entry = message.redelegationEntry ? RedelegationEntry.toAmino(message.redelegationEntry) : RedelegationEntry.toAmino(RedelegationEntry.fromPartial({})); + obj.balance = message.balance === "" ? undefined : message.balance; + return obj; + }, + fromAminoMsg(object: RedelegationEntryResponseAminoMsg): RedelegationEntryResponse { + return RedelegationEntryResponse.fromAmino(object.value); + }, + toAminoMsg(message: RedelegationEntryResponse): RedelegationEntryResponseAminoMsg { + return { + type: "cosmos-sdk/RedelegationEntryResponse", + value: RedelegationEntryResponse.toAmino(message) + }; + }, + fromProtoMsg(message: RedelegationEntryResponseProtoMsg): RedelegationEntryResponse { + return RedelegationEntryResponse.decode(message.value); + }, + toProto(message: RedelegationEntryResponse): Uint8Array { + return RedelegationEntryResponse.encode(message).finish(); + }, + toProtoMsg(message: RedelegationEntryResponse): RedelegationEntryResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.RedelegationEntryResponse", + value: RedelegationEntryResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(RedelegationEntryResponse.typeUrl, RedelegationEntryResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(RedelegationEntryResponse.aminoType, RedelegationEntryResponse.typeUrl); +function createBaseRedelegationResponse(): RedelegationResponse { + return { + redelegation: Redelegation.fromPartial({}), + entries: [] + }; +} +export const RedelegationResponse = { + typeUrl: "/cosmos.staking.v1beta1.RedelegationResponse", + aminoType: "cosmos-sdk/RedelegationResponse", + is(o: any): o is RedelegationResponse { + return o && (o.$typeUrl === RedelegationResponse.typeUrl || Redelegation.is(o.redelegation) && Array.isArray(o.entries) && (!o.entries.length || RedelegationEntryResponse.is(o.entries[0]))); + }, + isAmino(o: any): o is RedelegationResponseAmino { + return o && (o.$typeUrl === RedelegationResponse.typeUrl || Redelegation.isAmino(o.redelegation) && Array.isArray(o.entries) && (!o.entries.length || RedelegationEntryResponse.isAmino(o.entries[0]))); + }, + encode(message: RedelegationResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.redelegation !== undefined) { + Redelegation.encode(message.redelegation, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.entries) { + RedelegationEntryResponse.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RedelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRedelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.redelegation = Redelegation.decode(reader, reader.uint32()); + break; + case 2: + message.entries.push(RedelegationEntryResponse.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): RedelegationResponse { + const message = createBaseRedelegationResponse(); + message.redelegation = object.redelegation !== undefined && object.redelegation !== null ? Redelegation.fromPartial(object.redelegation) : undefined; + message.entries = object.entries?.map(e => RedelegationEntryResponse.fromPartial(e)) || []; + return message; + }, + fromAmino(object: RedelegationResponseAmino): RedelegationResponse { + const message = createBaseRedelegationResponse(); + if (object.redelegation !== undefined && object.redelegation !== null) { + message.redelegation = Redelegation.fromAmino(object.redelegation); + } + message.entries = object.entries?.map(e => RedelegationEntryResponse.fromAmino(e)) || []; + return message; + }, + toAmino(message: RedelegationResponse): RedelegationResponseAmino { + const obj: any = {}; + obj.redelegation = message.redelegation ? Redelegation.toAmino(message.redelegation) : Redelegation.toAmino(Redelegation.fromPartial({})); + if (message.entries) { + obj.entries = message.entries.map(e => e ? RedelegationEntryResponse.toAmino(e) : undefined); + } else { + obj.entries = message.entries; + } + return obj; + }, + fromAminoMsg(object: RedelegationResponseAminoMsg): RedelegationResponse { + return RedelegationResponse.fromAmino(object.value); + }, + toAminoMsg(message: RedelegationResponse): RedelegationResponseAminoMsg { + return { + type: "cosmos-sdk/RedelegationResponse", + value: RedelegationResponse.toAmino(message) + }; + }, + fromProtoMsg(message: RedelegationResponseProtoMsg): RedelegationResponse { + return RedelegationResponse.decode(message.value); + }, + toProto(message: RedelegationResponse): Uint8Array { + return RedelegationResponse.encode(message).finish(); + }, + toProtoMsg(message: RedelegationResponse): RedelegationResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.RedelegationResponse", + value: RedelegationResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(RedelegationResponse.typeUrl, RedelegationResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(RedelegationResponse.aminoType, RedelegationResponse.typeUrl); +function createBasePool(): Pool { + return { + notBondedTokens: "", + bondedTokens: "" + }; +} +export const Pool = { + typeUrl: "/cosmos.staking.v1beta1.Pool", + aminoType: "cosmos-sdk/Pool", + is(o: any): o is Pool { + return o && (o.$typeUrl === Pool.typeUrl || typeof o.notBondedTokens === "string" && typeof o.bondedTokens === "string"); + }, + isAmino(o: any): o is PoolAmino { + return o && (o.$typeUrl === Pool.typeUrl || typeof o.not_bonded_tokens === "string" && typeof o.bonded_tokens === "string"); + }, + encode(message: Pool, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.notBondedTokens !== "") { + writer.uint32(10).string(message.notBondedTokens); + } + if (message.bondedTokens !== "") { + writer.uint32(18).string(message.bondedTokens); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Pool { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePool(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.notBondedTokens = reader.string(); + break; + case 2: + message.bondedTokens = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Pool { + const message = createBasePool(); + message.notBondedTokens = object.notBondedTokens ?? ""; + message.bondedTokens = object.bondedTokens ?? ""; + return message; + }, + fromAmino(object: PoolAmino): Pool { + const message = createBasePool(); + if (object.not_bonded_tokens !== undefined && object.not_bonded_tokens !== null) { + message.notBondedTokens = object.not_bonded_tokens; + } + if (object.bonded_tokens !== undefined && object.bonded_tokens !== null) { + message.bondedTokens = object.bonded_tokens; + } + return message; + }, + toAmino(message: Pool): PoolAmino { + const obj: any = {}; + obj.not_bonded_tokens = message.notBondedTokens ?? ""; + obj.bonded_tokens = message.bondedTokens ?? ""; + return obj; + }, + fromAminoMsg(object: PoolAminoMsg): Pool { + return Pool.fromAmino(object.value); + }, + toAminoMsg(message: Pool): PoolAminoMsg { + return { + type: "cosmos-sdk/Pool", + value: Pool.toAmino(message) + }; + }, + fromProtoMsg(message: PoolProtoMsg): Pool { + return Pool.decode(message.value); + }, + toProto(message: Pool): Uint8Array { + return Pool.encode(message).finish(); + }, + toProtoMsg(message: Pool): PoolProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.Pool", + value: Pool.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Pool.typeUrl, Pool); +GlobalDecoderRegistry.registerAminoProtoMapping(Pool.aminoType, Pool.typeUrl); +function createBaseValidatorUpdates(): ValidatorUpdates { + return { + updates: [] + }; +} +export const ValidatorUpdates = { + typeUrl: "/cosmos.staking.v1beta1.ValidatorUpdates", + aminoType: "cosmos-sdk/ValidatorUpdates", + is(o: any): o is ValidatorUpdates { + return o && (o.$typeUrl === ValidatorUpdates.typeUrl || Array.isArray(o.updates) && (!o.updates.length || ValidatorUpdate.is(o.updates[0]))); + }, + isAmino(o: any): o is ValidatorUpdatesAmino { + return o && (o.$typeUrl === ValidatorUpdates.typeUrl || Array.isArray(o.updates) && (!o.updates.length || ValidatorUpdate.isAmino(o.updates[0]))); + }, + encode(message: ValidatorUpdates, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.updates) { + ValidatorUpdate.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorUpdates { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorUpdates(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.updates.push(ValidatorUpdate.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ValidatorUpdates { + const message = createBaseValidatorUpdates(); + message.updates = object.updates?.map(e => ValidatorUpdate.fromPartial(e)) || []; + return message; + }, + fromAmino(object: ValidatorUpdatesAmino): ValidatorUpdates { + const message = createBaseValidatorUpdates(); + message.updates = object.updates?.map(e => ValidatorUpdate.fromAmino(e)) || []; + return message; + }, + toAmino(message: ValidatorUpdates): ValidatorUpdatesAmino { + const obj: any = {}; + if (message.updates) { + obj.updates = message.updates.map(e => e ? ValidatorUpdate.toAmino(e) : undefined); + } else { + obj.updates = message.updates; + } + return obj; + }, + fromAminoMsg(object: ValidatorUpdatesAminoMsg): ValidatorUpdates { + return ValidatorUpdates.fromAmino(object.value); + }, + toAminoMsg(message: ValidatorUpdates): ValidatorUpdatesAminoMsg { + return { + type: "cosmos-sdk/ValidatorUpdates", + value: ValidatorUpdates.toAmino(message) + }; + }, + fromProtoMsg(message: ValidatorUpdatesProtoMsg): ValidatorUpdates { + return ValidatorUpdates.decode(message.value); + }, + toProto(message: ValidatorUpdates): Uint8Array { + return ValidatorUpdates.encode(message).finish(); + }, + toProtoMsg(message: ValidatorUpdates): ValidatorUpdatesProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.ValidatorUpdates", + value: ValidatorUpdates.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ValidatorUpdates.typeUrl, ValidatorUpdates); +GlobalDecoderRegistry.registerAminoProtoMapping(ValidatorUpdates.aminoType, ValidatorUpdates.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/staking/v1beta1/tx.rpc.func.ts b/libs/interchain-query/src/cosmos/staking/v1beta1/tx.rpc.func.ts new file mode 100644 index 00000000..78bf119c --- /dev/null +++ b/libs/interchain-query/src/cosmos/staking/v1beta1/tx.rpc.func.ts @@ -0,0 +1,67 @@ +import { buildTx, SigningClientResolver } from "../../../helper-func-types"; +import { buildUseMutation } from "../../../react-query"; +import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; +import { MsgCreateValidator, MsgEditValidator, MsgDelegate, MsgBeginRedelegate, MsgUndelegate, MsgCancelUnbondingDelegation, MsgUpdateParams } from "./tx"; +export const createCreateValidator = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgCreateValidator.typeUrl, + encoders: toEncoders(MsgCreateValidator), + converters: toConverters(MsgCreateValidator) +}); +export const useCreateValidator = buildUseMutation({ + builderMutationFn: createCreateValidator +}); +export const createEditValidator = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgEditValidator.typeUrl, + encoders: toEncoders(MsgEditValidator), + converters: toConverters(MsgEditValidator) +}); +export const useEditValidator = buildUseMutation({ + builderMutationFn: createEditValidator +}); +export const createDelegate = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgDelegate.typeUrl, + encoders: toEncoders(MsgDelegate), + converters: toConverters(MsgDelegate) +}); +export const useDelegate = buildUseMutation({ + builderMutationFn: createDelegate +}); +export const createBeginRedelegate = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgBeginRedelegate.typeUrl, + encoders: toEncoders(MsgBeginRedelegate), + converters: toConverters(MsgBeginRedelegate) +}); +export const useBeginRedelegate = buildUseMutation({ + builderMutationFn: createBeginRedelegate +}); +export const createUndelegate = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgUndelegate.typeUrl, + encoders: toEncoders(MsgUndelegate), + converters: toConverters(MsgUndelegate) +}); +export const useUndelegate = buildUseMutation({ + builderMutationFn: createUndelegate +}); +export const createCancelUnbondingDelegation = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgCancelUnbondingDelegation.typeUrl, + encoders: toEncoders(MsgCancelUnbondingDelegation), + converters: toConverters(MsgCancelUnbondingDelegation) +}); +export const useCancelUnbondingDelegation = buildUseMutation({ + builderMutationFn: createCancelUnbondingDelegation +}); +export const createUpdateParams = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgUpdateParams.typeUrl, + encoders: toEncoders(MsgUpdateParams), + converters: toConverters(MsgUpdateParams) +}); +export const useUpdateParams = buildUseMutation({ + builderMutationFn: createUpdateParams +}); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/staking/v1beta1/tx.ts b/libs/interchain-query/src/cosmos/staking/v1beta1/tx.ts new file mode 100644 index 00000000..ef9fba80 --- /dev/null +++ b/libs/interchain-query/src/cosmos/staking/v1beta1/tx.ts @@ -0,0 +1,1638 @@ +import { Description, DescriptionAmino, CommissionRates, CommissionRatesAmino, Params, ParamsAmino } from "./staking"; +import { Any, AnyProtoMsg, AnyAmino } from "../../../google/protobuf/any"; +import { Coin, CoinAmino } from "../../base/v1beta1/coin"; +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; +import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; +import { GlobalDecoderRegistry } from "../../../registry"; +/** MsgCreateValidator defines a SDK message for creating a new validator. */ +export interface MsgCreateValidator { + description: Description; + commission: CommissionRates; + minSelfDelegation: string; + /** + * Deprecated: Use of Delegator Address in MsgCreateValidator is deprecated. + * The validator address bytes and delegator address bytes refer to the same account while creating validator (defer + * only in bech32 notation). + */ + /** @deprecated */ + delegatorAddress: string; + validatorAddress: string; + pubkey?: Any | undefined; + value: Coin; +} +export interface MsgCreateValidatorProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidator"; + value: Uint8Array; +} +export type MsgCreateValidatorEncoded = Omit & { + pubkey?: AnyProtoMsg | undefined; +}; +/** MsgCreateValidator defines a SDK message for creating a new validator. */ +export interface MsgCreateValidatorAmino { + description: DescriptionAmino; + commission: CommissionRatesAmino; + min_self_delegation: string; + /** + * Deprecated: Use of Delegator Address in MsgCreateValidator is deprecated. + * The validator address bytes and delegator address bytes refer to the same account while creating validator (defer + * only in bech32 notation). + */ + /** @deprecated */ + delegator_address: string; + validator_address: string; + pubkey?: AnyAmino; + value: CoinAmino; +} +export interface MsgCreateValidatorAminoMsg { + type: "cosmos-sdk/MsgCreateValidator"; + value: MsgCreateValidatorAmino; +} +/** MsgCreateValidatorResponse defines the Msg/CreateValidator response type. */ +export interface MsgCreateValidatorResponse {} +export interface MsgCreateValidatorResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidatorResponse"; + value: Uint8Array; +} +/** MsgCreateValidatorResponse defines the Msg/CreateValidator response type. */ +export interface MsgCreateValidatorResponseAmino {} +export interface MsgCreateValidatorResponseAminoMsg { + type: "cosmos-sdk/MsgCreateValidatorResponse"; + value: MsgCreateValidatorResponseAmino; +} +/** MsgEditValidator defines a SDK message for editing an existing validator. */ +export interface MsgEditValidator { + description: Description; + validatorAddress: string; + /** + * We pass a reference to the new commission rate and min self delegation as + * it's not mandatory to update. If not updated, the deserialized rate will be + * zero with no way to distinguish if an update was intended. + * REF: #2373 + */ + commissionRate: string; + minSelfDelegation: string; +} +export interface MsgEditValidatorProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.MsgEditValidator"; + value: Uint8Array; +} +/** MsgEditValidator defines a SDK message for editing an existing validator. */ +export interface MsgEditValidatorAmino { + description: DescriptionAmino; + validator_address: string; + /** + * We pass a reference to the new commission rate and min self delegation as + * it's not mandatory to update. If not updated, the deserialized rate will be + * zero with no way to distinguish if an update was intended. + * REF: #2373 + */ + commission_rate: string; + min_self_delegation: string; +} +export interface MsgEditValidatorAminoMsg { + type: "cosmos-sdk/MsgEditValidator"; + value: MsgEditValidatorAmino; +} +/** MsgEditValidatorResponse defines the Msg/EditValidator response type. */ +export interface MsgEditValidatorResponse {} +export interface MsgEditValidatorResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.MsgEditValidatorResponse"; + value: Uint8Array; +} +/** MsgEditValidatorResponse defines the Msg/EditValidator response type. */ +export interface MsgEditValidatorResponseAmino {} +export interface MsgEditValidatorResponseAminoMsg { + type: "cosmos-sdk/MsgEditValidatorResponse"; + value: MsgEditValidatorResponseAmino; +} +/** + * MsgDelegate defines a SDK message for performing a delegation of coins + * from a delegator to a validator. + */ +export interface MsgDelegate { + delegatorAddress: string; + validatorAddress: string; + amount: Coin; +} +export interface MsgDelegateProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.MsgDelegate"; + value: Uint8Array; +} +/** + * MsgDelegate defines a SDK message for performing a delegation of coins + * from a delegator to a validator. + */ +export interface MsgDelegateAmino { + delegator_address: string; + validator_address: string; + amount: CoinAmino; +} +export interface MsgDelegateAminoMsg { + type: "cosmos-sdk/MsgDelegate"; + value: MsgDelegateAmino; +} +/** MsgDelegateResponse defines the Msg/Delegate response type. */ +export interface MsgDelegateResponse {} +export interface MsgDelegateResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.MsgDelegateResponse"; + value: Uint8Array; +} +/** MsgDelegateResponse defines the Msg/Delegate response type. */ +export interface MsgDelegateResponseAmino {} +export interface MsgDelegateResponseAminoMsg { + type: "cosmos-sdk/MsgDelegateResponse"; + value: MsgDelegateResponseAmino; +} +/** + * MsgBeginRedelegate defines a SDK message for performing a redelegation + * of coins from a delegator and source validator to a destination validator. + */ +export interface MsgBeginRedelegate { + delegatorAddress: string; + validatorSrcAddress: string; + validatorDstAddress: string; + amount: Coin; +} +export interface MsgBeginRedelegateProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegate"; + value: Uint8Array; +} +/** + * MsgBeginRedelegate defines a SDK message for performing a redelegation + * of coins from a delegator and source validator to a destination validator. + */ +export interface MsgBeginRedelegateAmino { + delegator_address: string; + validator_src_address: string; + validator_dst_address: string; + amount: CoinAmino; +} +export interface MsgBeginRedelegateAminoMsg { + type: "cosmos-sdk/MsgBeginRedelegate"; + value: MsgBeginRedelegateAmino; +} +/** MsgBeginRedelegateResponse defines the Msg/BeginRedelegate response type. */ +export interface MsgBeginRedelegateResponse { + completionTime: Date; +} +export interface MsgBeginRedelegateResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegateResponse"; + value: Uint8Array; +} +/** MsgBeginRedelegateResponse defines the Msg/BeginRedelegate response type. */ +export interface MsgBeginRedelegateResponseAmino { + completion_time: string; +} +export interface MsgBeginRedelegateResponseAminoMsg { + type: "cosmos-sdk/MsgBeginRedelegateResponse"; + value: MsgBeginRedelegateResponseAmino; +} +/** + * MsgUndelegate defines a SDK message for performing an undelegation from a + * delegate and a validator. + */ +export interface MsgUndelegate { + delegatorAddress: string; + validatorAddress: string; + amount: Coin; +} +export interface MsgUndelegateProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.MsgUndelegate"; + value: Uint8Array; +} +/** + * MsgUndelegate defines a SDK message for performing an undelegation from a + * delegate and a validator. + */ +export interface MsgUndelegateAmino { + delegator_address: string; + validator_address: string; + amount: CoinAmino; +} +export interface MsgUndelegateAminoMsg { + type: "cosmos-sdk/MsgUndelegate"; + value: MsgUndelegateAmino; +} +/** MsgUndelegateResponse defines the Msg/Undelegate response type. */ +export interface MsgUndelegateResponse { + completionTime: Date; + /** + * amount returns the amount of undelegated coins + * + * Since: cosmos-sdk 0.50 + */ + amount: Coin; +} +export interface MsgUndelegateResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.MsgUndelegateResponse"; + value: Uint8Array; +} +/** MsgUndelegateResponse defines the Msg/Undelegate response type. */ +export interface MsgUndelegateResponseAmino { + completion_time: string; + /** + * amount returns the amount of undelegated coins + * + * Since: cosmos-sdk 0.50 + */ + amount: CoinAmino; +} +export interface MsgUndelegateResponseAminoMsg { + type: "cosmos-sdk/MsgUndelegateResponse"; + value: MsgUndelegateResponseAmino; +} +/** + * MsgCancelUnbondingDelegation defines the SDK message for performing a cancel unbonding delegation for delegator + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCancelUnbondingDelegation { + delegatorAddress: string; + validatorAddress: string; + /** amount is always less than or equal to unbonding delegation entry balance */ + amount: Coin; + /** creation_height is the height which the unbonding took place. */ + creationHeight: bigint; +} +export interface MsgCancelUnbondingDelegationProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.MsgCancelUnbondingDelegation"; + value: Uint8Array; +} +/** + * MsgCancelUnbondingDelegation defines the SDK message for performing a cancel unbonding delegation for delegator + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCancelUnbondingDelegationAmino { + delegator_address: string; + validator_address: string; + /** amount is always less than or equal to unbonding delegation entry balance */ + amount: CoinAmino; + /** creation_height is the height which the unbonding took place. */ + creation_height: string; +} +export interface MsgCancelUnbondingDelegationAminoMsg { + type: "cosmos-sdk/MsgCancelUnbondingDelegation"; + value: MsgCancelUnbondingDelegationAmino; +} +/** + * MsgCancelUnbondingDelegationResponse + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCancelUnbondingDelegationResponse {} +export interface MsgCancelUnbondingDelegationResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.MsgCancelUnbondingDelegationResponse"; + value: Uint8Array; +} +/** + * MsgCancelUnbondingDelegationResponse + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCancelUnbondingDelegationResponseAmino {} +export interface MsgCancelUnbondingDelegationResponseAminoMsg { + type: "cosmos-sdk/MsgCancelUnbondingDelegationResponse"; + value: MsgCancelUnbondingDelegationResponseAmino; +} +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/staking parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params; +} +export interface MsgUpdateParamsProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.MsgUpdateParams"; + value: Uint8Array; +} +/** + * MsgUpdateParams is the Msg/UpdateParams request type. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsAmino { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the x/staking parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: ParamsAmino; +} +export interface MsgUpdateParamsAminoMsg { + type: "cosmos-sdk/x/staking/MsgUpdateParams"; + value: MsgUpdateParamsAmino; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponse {} +export interface MsgUpdateParamsResponseProtoMsg { + typeUrl: "/cosmos.staking.v1beta1.MsgUpdateParamsResponse"; + value: Uint8Array; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: cosmos-sdk 0.47 + */ +export interface MsgUpdateParamsResponseAmino {} +export interface MsgUpdateParamsResponseAminoMsg { + type: "cosmos-sdk/MsgUpdateParamsResponse"; + value: MsgUpdateParamsResponseAmino; +} +function createBaseMsgCreateValidator(): MsgCreateValidator { + return { + description: Description.fromPartial({}), + commission: CommissionRates.fromPartial({}), + minSelfDelegation: "", + delegatorAddress: "", + validatorAddress: "", + pubkey: undefined, + value: Coin.fromPartial({}) + }; +} +export const MsgCreateValidator = { + typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidator", + aminoType: "cosmos-sdk/MsgCreateValidator", + is(o: any): o is MsgCreateValidator { + return o && (o.$typeUrl === MsgCreateValidator.typeUrl || Description.is(o.description) && CommissionRates.is(o.commission) && typeof o.minSelfDelegation === "string" && typeof o.delegatorAddress === "string" && typeof o.validatorAddress === "string" && Coin.is(o.value)); + }, + isAmino(o: any): o is MsgCreateValidatorAmino { + return o && (o.$typeUrl === MsgCreateValidator.typeUrl || Description.isAmino(o.description) && CommissionRates.isAmino(o.commission) && typeof o.min_self_delegation === "string" && typeof o.delegator_address === "string" && typeof o.validator_address === "string" && Coin.isAmino(o.value)); + }, + encode(message: MsgCreateValidator, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.description !== undefined) { + Description.encode(message.description, writer.uint32(10).fork()).ldelim(); + } + if (message.commission !== undefined) { + CommissionRates.encode(message.commission, writer.uint32(18).fork()).ldelim(); + } + if (message.minSelfDelegation !== "") { + writer.uint32(26).string(message.minSelfDelegation); + } + if (message.delegatorAddress !== "") { + writer.uint32(34).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(42).string(message.validatorAddress); + } + if (message.pubkey !== undefined) { + Any.encode(GlobalDecoderRegistry.wrapAny(message.pubkey), writer.uint32(50).fork()).ldelim(); + } + if (message.value !== undefined) { + Coin.encode(message.value, writer.uint32(58).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.description = Description.decode(reader, reader.uint32()); + break; + case 2: + message.commission = CommissionRates.decode(reader, reader.uint32()); + break; + case 3: + message.minSelfDelegation = reader.string(); + break; + case 4: + message.delegatorAddress = reader.string(); + break; + case 5: + message.validatorAddress = reader.string(); + break; + case 6: + message.pubkey = GlobalDecoderRegistry.unwrapAny(reader); + break; + case 7: + message.value = Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgCreateValidator { + const message = createBaseMsgCreateValidator(); + message.description = object.description !== undefined && object.description !== null ? Description.fromPartial(object.description) : undefined; + message.commission = object.commission !== undefined && object.commission !== null ? CommissionRates.fromPartial(object.commission) : undefined; + message.minSelfDelegation = object.minSelfDelegation ?? ""; + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.pubkey = object.pubkey !== undefined && object.pubkey !== null ? GlobalDecoderRegistry.fromPartial(object.pubkey) : undefined; + message.value = object.value !== undefined && object.value !== null ? Coin.fromPartial(object.value) : undefined; + return message; + }, + fromAmino(object: MsgCreateValidatorAmino): MsgCreateValidator { + const message = createBaseMsgCreateValidator(); + if (object.description !== undefined && object.description !== null) { + message.description = Description.fromAmino(object.description); + } + if (object.commission !== undefined && object.commission !== null) { + message.commission = CommissionRates.fromAmino(object.commission); + } + if (object.min_self_delegation !== undefined && object.min_self_delegation !== null) { + message.minSelfDelegation = object.min_self_delegation; + } + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = encodePubkey(object.pubkey); + } + if (object.value !== undefined && object.value !== null) { + message.value = Coin.fromAmino(object.value); + } + return message; + }, + toAmino(message: MsgCreateValidator): MsgCreateValidatorAmino { + const obj: any = {}; + obj.description = message.description ? Description.toAmino(message.description) : Description.toAmino(Description.fromPartial({})); + obj.commission = message.commission ? CommissionRates.toAmino(message.commission) : CommissionRates.toAmino(CommissionRates.fromPartial({})); + obj.min_self_delegation = message.minSelfDelegation ?? ""; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; + obj.value = message.value ? Coin.toAmino(message.value) : Coin.toAmino(Coin.fromPartial({})); + return obj; + }, + fromAminoMsg(object: MsgCreateValidatorAminoMsg): MsgCreateValidator { + return MsgCreateValidator.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreateValidator): MsgCreateValidatorAminoMsg { + return { + type: "cosmos-sdk/MsgCreateValidator", + value: MsgCreateValidator.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreateValidatorProtoMsg): MsgCreateValidator { + return MsgCreateValidator.decode(message.value); + }, + toProto(message: MsgCreateValidator): Uint8Array { + return MsgCreateValidator.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateValidator): MsgCreateValidatorProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidator", + value: MsgCreateValidator.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgCreateValidator.typeUrl, MsgCreateValidator); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgCreateValidator.aminoType, MsgCreateValidator.typeUrl); +function createBaseMsgCreateValidatorResponse(): MsgCreateValidatorResponse { + return {}; +} +export const MsgCreateValidatorResponse = { + typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidatorResponse", + aminoType: "cosmos-sdk/MsgCreateValidatorResponse", + is(o: any): o is MsgCreateValidatorResponse { + return o && o.$typeUrl === MsgCreateValidatorResponse.typeUrl; + }, + isAmino(o: any): o is MsgCreateValidatorResponseAmino { + return o && o.$typeUrl === MsgCreateValidatorResponse.typeUrl; + }, + encode(_: MsgCreateValidatorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgCreateValidatorResponse { + const message = createBaseMsgCreateValidatorResponse(); + return message; + }, + fromAmino(_: MsgCreateValidatorResponseAmino): MsgCreateValidatorResponse { + const message = createBaseMsgCreateValidatorResponse(); + return message; + }, + toAmino(_: MsgCreateValidatorResponse): MsgCreateValidatorResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgCreateValidatorResponseAminoMsg): MsgCreateValidatorResponse { + return MsgCreateValidatorResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreateValidatorResponse): MsgCreateValidatorResponseAminoMsg { + return { + type: "cosmos-sdk/MsgCreateValidatorResponse", + value: MsgCreateValidatorResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreateValidatorResponseProtoMsg): MsgCreateValidatorResponse { + return MsgCreateValidatorResponse.decode(message.value); + }, + toProto(message: MsgCreateValidatorResponse): Uint8Array { + return MsgCreateValidatorResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateValidatorResponse): MsgCreateValidatorResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidatorResponse", + value: MsgCreateValidatorResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgCreateValidatorResponse.typeUrl, MsgCreateValidatorResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgCreateValidatorResponse.aminoType, MsgCreateValidatorResponse.typeUrl); +function createBaseMsgEditValidator(): MsgEditValidator { + return { + description: Description.fromPartial({}), + validatorAddress: "", + commissionRate: "", + minSelfDelegation: "" + }; +} +export const MsgEditValidator = { + typeUrl: "/cosmos.staking.v1beta1.MsgEditValidator", + aminoType: "cosmos-sdk/MsgEditValidator", + is(o: any): o is MsgEditValidator { + return o && (o.$typeUrl === MsgEditValidator.typeUrl || Description.is(o.description) && typeof o.validatorAddress === "string" && typeof o.commissionRate === "string" && typeof o.minSelfDelegation === "string"); + }, + isAmino(o: any): o is MsgEditValidatorAmino { + return o && (o.$typeUrl === MsgEditValidator.typeUrl || Description.isAmino(o.description) && typeof o.validator_address === "string" && typeof o.commission_rate === "string" && typeof o.min_self_delegation === "string"); + }, + encode(message: MsgEditValidator, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.description !== undefined) { + Description.encode(message.description, writer.uint32(10).fork()).ldelim(); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.commissionRate !== "") { + writer.uint32(26).string(message.commissionRate); + } + if (message.minSelfDelegation !== "") { + writer.uint32(34).string(message.minSelfDelegation); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgEditValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgEditValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.description = Description.decode(reader, reader.uint32()); + break; + case 2: + message.validatorAddress = reader.string(); + break; + case 3: + message.commissionRate = reader.string(); + break; + case 4: + message.minSelfDelegation = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgEditValidator { + const message = createBaseMsgEditValidator(); + message.description = object.description !== undefined && object.description !== null ? Description.fromPartial(object.description) : undefined; + message.validatorAddress = object.validatorAddress ?? ""; + message.commissionRate = object.commissionRate ?? ""; + message.minSelfDelegation = object.minSelfDelegation ?? ""; + return message; + }, + fromAmino(object: MsgEditValidatorAmino): MsgEditValidator { + const message = createBaseMsgEditValidator(); + if (object.description !== undefined && object.description !== null) { + message.description = Description.fromAmino(object.description); + } + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + if (object.commission_rate !== undefined && object.commission_rate !== null) { + message.commissionRate = object.commission_rate; + } + if (object.min_self_delegation !== undefined && object.min_self_delegation !== null) { + message.minSelfDelegation = object.min_self_delegation; + } + return message; + }, + toAmino(message: MsgEditValidator): MsgEditValidatorAmino { + const obj: any = {}; + obj.description = message.description ? Description.toAmino(message.description) : Description.toAmino(Description.fromPartial({})); + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.commission_rate = message.commissionRate === "" ? undefined : message.commissionRate; + obj.min_self_delegation = message.minSelfDelegation === "" ? undefined : message.minSelfDelegation; + return obj; + }, + fromAminoMsg(object: MsgEditValidatorAminoMsg): MsgEditValidator { + return MsgEditValidator.fromAmino(object.value); + }, + toAminoMsg(message: MsgEditValidator): MsgEditValidatorAminoMsg { + return { + type: "cosmos-sdk/MsgEditValidator", + value: MsgEditValidator.toAmino(message) + }; + }, + fromProtoMsg(message: MsgEditValidatorProtoMsg): MsgEditValidator { + return MsgEditValidator.decode(message.value); + }, + toProto(message: MsgEditValidator): Uint8Array { + return MsgEditValidator.encode(message).finish(); + }, + toProtoMsg(message: MsgEditValidator): MsgEditValidatorProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgEditValidator", + value: MsgEditValidator.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgEditValidator.typeUrl, MsgEditValidator); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgEditValidator.aminoType, MsgEditValidator.typeUrl); +function createBaseMsgEditValidatorResponse(): MsgEditValidatorResponse { + return {}; +} +export const MsgEditValidatorResponse = { + typeUrl: "/cosmos.staking.v1beta1.MsgEditValidatorResponse", + aminoType: "cosmos-sdk/MsgEditValidatorResponse", + is(o: any): o is MsgEditValidatorResponse { + return o && o.$typeUrl === MsgEditValidatorResponse.typeUrl; + }, + isAmino(o: any): o is MsgEditValidatorResponseAmino { + return o && o.$typeUrl === MsgEditValidatorResponse.typeUrl; + }, + encode(_: MsgEditValidatorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgEditValidatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgEditValidatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgEditValidatorResponse { + const message = createBaseMsgEditValidatorResponse(); + return message; + }, + fromAmino(_: MsgEditValidatorResponseAmino): MsgEditValidatorResponse { + const message = createBaseMsgEditValidatorResponse(); + return message; + }, + toAmino(_: MsgEditValidatorResponse): MsgEditValidatorResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgEditValidatorResponseAminoMsg): MsgEditValidatorResponse { + return MsgEditValidatorResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgEditValidatorResponse): MsgEditValidatorResponseAminoMsg { + return { + type: "cosmos-sdk/MsgEditValidatorResponse", + value: MsgEditValidatorResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgEditValidatorResponseProtoMsg): MsgEditValidatorResponse { + return MsgEditValidatorResponse.decode(message.value); + }, + toProto(message: MsgEditValidatorResponse): Uint8Array { + return MsgEditValidatorResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgEditValidatorResponse): MsgEditValidatorResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgEditValidatorResponse", + value: MsgEditValidatorResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgEditValidatorResponse.typeUrl, MsgEditValidatorResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgEditValidatorResponse.aminoType, MsgEditValidatorResponse.typeUrl); +function createBaseMsgDelegate(): MsgDelegate { + return { + delegatorAddress: "", + validatorAddress: "", + amount: Coin.fromPartial({}) + }; +} +export const MsgDelegate = { + typeUrl: "/cosmos.staking.v1beta1.MsgDelegate", + aminoType: "cosmos-sdk/MsgDelegate", + is(o: any): o is MsgDelegate { + return o && (o.$typeUrl === MsgDelegate.typeUrl || typeof o.delegatorAddress === "string" && typeof o.validatorAddress === "string" && Coin.is(o.amount)); + }, + isAmino(o: any): o is MsgDelegateAmino { + return o && (o.$typeUrl === MsgDelegate.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string" && Coin.isAmino(o.amount)); + }, + encode(message: MsgDelegate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgDelegate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDelegate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddress = reader.string(); + break; + case 2: + message.validatorAddress = reader.string(); + break; + case 3: + message.amount = Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgDelegate { + const message = createBaseMsgDelegate(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = object.amount !== undefined && object.amount !== null ? Coin.fromPartial(object.amount) : undefined; + return message; + }, + fromAmino(object: MsgDelegateAmino): MsgDelegate { + const message = createBaseMsgDelegate(); + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + if (object.amount !== undefined && object.amount !== null) { + message.amount = Coin.fromAmino(object.amount); + } + return message; + }, + toAmino(message: MsgDelegate): MsgDelegateAmino { + const obj: any = {}; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.amount = message.amount ? Coin.toAmino(message.amount) : Coin.toAmino(Coin.fromPartial({})); + return obj; + }, + fromAminoMsg(object: MsgDelegateAminoMsg): MsgDelegate { + return MsgDelegate.fromAmino(object.value); + }, + toAminoMsg(message: MsgDelegate): MsgDelegateAminoMsg { + return { + type: "cosmos-sdk/MsgDelegate", + value: MsgDelegate.toAmino(message) + }; + }, + fromProtoMsg(message: MsgDelegateProtoMsg): MsgDelegate { + return MsgDelegate.decode(message.value); + }, + toProto(message: MsgDelegate): Uint8Array { + return MsgDelegate.encode(message).finish(); + }, + toProtoMsg(message: MsgDelegate): MsgDelegateProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgDelegate", + value: MsgDelegate.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgDelegate.typeUrl, MsgDelegate); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgDelegate.aminoType, MsgDelegate.typeUrl); +function createBaseMsgDelegateResponse(): MsgDelegateResponse { + return {}; +} +export const MsgDelegateResponse = { + typeUrl: "/cosmos.staking.v1beta1.MsgDelegateResponse", + aminoType: "cosmos-sdk/MsgDelegateResponse", + is(o: any): o is MsgDelegateResponse { + return o && o.$typeUrl === MsgDelegateResponse.typeUrl; + }, + isAmino(o: any): o is MsgDelegateResponseAmino { + return o && o.$typeUrl === MsgDelegateResponse.typeUrl; + }, + encode(_: MsgDelegateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgDelegateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgDelegateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgDelegateResponse { + const message = createBaseMsgDelegateResponse(); + return message; + }, + fromAmino(_: MsgDelegateResponseAmino): MsgDelegateResponse { + const message = createBaseMsgDelegateResponse(); + return message; + }, + toAmino(_: MsgDelegateResponse): MsgDelegateResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgDelegateResponseAminoMsg): MsgDelegateResponse { + return MsgDelegateResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgDelegateResponse): MsgDelegateResponseAminoMsg { + return { + type: "cosmos-sdk/MsgDelegateResponse", + value: MsgDelegateResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgDelegateResponseProtoMsg): MsgDelegateResponse { + return MsgDelegateResponse.decode(message.value); + }, + toProto(message: MsgDelegateResponse): Uint8Array { + return MsgDelegateResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgDelegateResponse): MsgDelegateResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgDelegateResponse", + value: MsgDelegateResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgDelegateResponse.typeUrl, MsgDelegateResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgDelegateResponse.aminoType, MsgDelegateResponse.typeUrl); +function createBaseMsgBeginRedelegate(): MsgBeginRedelegate { + return { + delegatorAddress: "", + validatorSrcAddress: "", + validatorDstAddress: "", + amount: Coin.fromPartial({}) + }; +} +export const MsgBeginRedelegate = { + typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegate", + aminoType: "cosmos-sdk/MsgBeginRedelegate", + is(o: any): o is MsgBeginRedelegate { + return o && (o.$typeUrl === MsgBeginRedelegate.typeUrl || typeof o.delegatorAddress === "string" && typeof o.validatorSrcAddress === "string" && typeof o.validatorDstAddress === "string" && Coin.is(o.amount)); + }, + isAmino(o: any): o is MsgBeginRedelegateAmino { + return o && (o.$typeUrl === MsgBeginRedelegate.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_src_address === "string" && typeof o.validator_dst_address === "string" && Coin.isAmino(o.amount)); + }, + encode(message: MsgBeginRedelegate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorSrcAddress !== "") { + writer.uint32(18).string(message.validatorSrcAddress); + } + if (message.validatorDstAddress !== "") { + writer.uint32(26).string(message.validatorDstAddress); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgBeginRedelegate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgBeginRedelegate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddress = reader.string(); + break; + case 2: + message.validatorSrcAddress = reader.string(); + break; + case 3: + message.validatorDstAddress = reader.string(); + break; + case 4: + message.amount = Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgBeginRedelegate { + const message = createBaseMsgBeginRedelegate(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorSrcAddress = object.validatorSrcAddress ?? ""; + message.validatorDstAddress = object.validatorDstAddress ?? ""; + message.amount = object.amount !== undefined && object.amount !== null ? Coin.fromPartial(object.amount) : undefined; + return message; + }, + fromAmino(object: MsgBeginRedelegateAmino): MsgBeginRedelegate { + const message = createBaseMsgBeginRedelegate(); + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + if (object.validator_src_address !== undefined && object.validator_src_address !== null) { + message.validatorSrcAddress = object.validator_src_address; + } + if (object.validator_dst_address !== undefined && object.validator_dst_address !== null) { + message.validatorDstAddress = object.validator_dst_address; + } + if (object.amount !== undefined && object.amount !== null) { + message.amount = Coin.fromAmino(object.amount); + } + return message; + }, + toAmino(message: MsgBeginRedelegate): MsgBeginRedelegateAmino { + const obj: any = {}; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_src_address = message.validatorSrcAddress === "" ? undefined : message.validatorSrcAddress; + obj.validator_dst_address = message.validatorDstAddress === "" ? undefined : message.validatorDstAddress; + obj.amount = message.amount ? Coin.toAmino(message.amount) : Coin.toAmino(Coin.fromPartial({})); + return obj; + }, + fromAminoMsg(object: MsgBeginRedelegateAminoMsg): MsgBeginRedelegate { + return MsgBeginRedelegate.fromAmino(object.value); + }, + toAminoMsg(message: MsgBeginRedelegate): MsgBeginRedelegateAminoMsg { + return { + type: "cosmos-sdk/MsgBeginRedelegate", + value: MsgBeginRedelegate.toAmino(message) + }; + }, + fromProtoMsg(message: MsgBeginRedelegateProtoMsg): MsgBeginRedelegate { + return MsgBeginRedelegate.decode(message.value); + }, + toProto(message: MsgBeginRedelegate): Uint8Array { + return MsgBeginRedelegate.encode(message).finish(); + }, + toProtoMsg(message: MsgBeginRedelegate): MsgBeginRedelegateProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegate", + value: MsgBeginRedelegate.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgBeginRedelegate.typeUrl, MsgBeginRedelegate); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgBeginRedelegate.aminoType, MsgBeginRedelegate.typeUrl); +function createBaseMsgBeginRedelegateResponse(): MsgBeginRedelegateResponse { + return { + completionTime: new Date() + }; +} +export const MsgBeginRedelegateResponse = { + typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegateResponse", + aminoType: "cosmos-sdk/MsgBeginRedelegateResponse", + is(o: any): o is MsgBeginRedelegateResponse { + return o && (o.$typeUrl === MsgBeginRedelegateResponse.typeUrl || Timestamp.is(o.completionTime)); + }, + isAmino(o: any): o is MsgBeginRedelegateResponseAmino { + return o && (o.$typeUrl === MsgBeginRedelegateResponse.typeUrl || Timestamp.isAmino(o.completion_time)); + }, + encode(message: MsgBeginRedelegateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.completionTime !== undefined) { + Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgBeginRedelegateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgBeginRedelegateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.completionTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgBeginRedelegateResponse { + const message = createBaseMsgBeginRedelegateResponse(); + message.completionTime = object.completionTime ?? undefined; + return message; + }, + fromAmino(object: MsgBeginRedelegateResponseAmino): MsgBeginRedelegateResponse { + const message = createBaseMsgBeginRedelegateResponse(); + if (object.completion_time !== undefined && object.completion_time !== null) { + message.completionTime = fromTimestamp(Timestamp.fromAmino(object.completion_time)); + } + return message; + }, + toAmino(message: MsgBeginRedelegateResponse): MsgBeginRedelegateResponseAmino { + const obj: any = {}; + obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : new Date(); + return obj; + }, + fromAminoMsg(object: MsgBeginRedelegateResponseAminoMsg): MsgBeginRedelegateResponse { + return MsgBeginRedelegateResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgBeginRedelegateResponse): MsgBeginRedelegateResponseAminoMsg { + return { + type: "cosmos-sdk/MsgBeginRedelegateResponse", + value: MsgBeginRedelegateResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgBeginRedelegateResponseProtoMsg): MsgBeginRedelegateResponse { + return MsgBeginRedelegateResponse.decode(message.value); + }, + toProto(message: MsgBeginRedelegateResponse): Uint8Array { + return MsgBeginRedelegateResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgBeginRedelegateResponse): MsgBeginRedelegateResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegateResponse", + value: MsgBeginRedelegateResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgBeginRedelegateResponse.typeUrl, MsgBeginRedelegateResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgBeginRedelegateResponse.aminoType, MsgBeginRedelegateResponse.typeUrl); +function createBaseMsgUndelegate(): MsgUndelegate { + return { + delegatorAddress: "", + validatorAddress: "", + amount: Coin.fromPartial({}) + }; +} +export const MsgUndelegate = { + typeUrl: "/cosmos.staking.v1beta1.MsgUndelegate", + aminoType: "cosmos-sdk/MsgUndelegate", + is(o: any): o is MsgUndelegate { + return o && (o.$typeUrl === MsgUndelegate.typeUrl || typeof o.delegatorAddress === "string" && typeof o.validatorAddress === "string" && Coin.is(o.amount)); + }, + isAmino(o: any): o is MsgUndelegateAmino { + return o && (o.$typeUrl === MsgUndelegate.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string" && Coin.isAmino(o.amount)); + }, + encode(message: MsgUndelegate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUndelegate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUndelegate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddress = reader.string(); + break; + case 2: + message.validatorAddress = reader.string(); + break; + case 3: + message.amount = Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUndelegate { + const message = createBaseMsgUndelegate(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = object.amount !== undefined && object.amount !== null ? Coin.fromPartial(object.amount) : undefined; + return message; + }, + fromAmino(object: MsgUndelegateAmino): MsgUndelegate { + const message = createBaseMsgUndelegate(); + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + if (object.amount !== undefined && object.amount !== null) { + message.amount = Coin.fromAmino(object.amount); + } + return message; + }, + toAmino(message: MsgUndelegate): MsgUndelegateAmino { + const obj: any = {}; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.amount = message.amount ? Coin.toAmino(message.amount) : Coin.toAmino(Coin.fromPartial({})); + return obj; + }, + fromAminoMsg(object: MsgUndelegateAminoMsg): MsgUndelegate { + return MsgUndelegate.fromAmino(object.value); + }, + toAminoMsg(message: MsgUndelegate): MsgUndelegateAminoMsg { + return { + type: "cosmos-sdk/MsgUndelegate", + value: MsgUndelegate.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUndelegateProtoMsg): MsgUndelegate { + return MsgUndelegate.decode(message.value); + }, + toProto(message: MsgUndelegate): Uint8Array { + return MsgUndelegate.encode(message).finish(); + }, + toProtoMsg(message: MsgUndelegate): MsgUndelegateProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgUndelegate", + value: MsgUndelegate.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgUndelegate.typeUrl, MsgUndelegate); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgUndelegate.aminoType, MsgUndelegate.typeUrl); +function createBaseMsgUndelegateResponse(): MsgUndelegateResponse { + return { + completionTime: new Date(), + amount: Coin.fromPartial({}) + }; +} +export const MsgUndelegateResponse = { + typeUrl: "/cosmos.staking.v1beta1.MsgUndelegateResponse", + aminoType: "cosmos-sdk/MsgUndelegateResponse", + is(o: any): o is MsgUndelegateResponse { + return o && (o.$typeUrl === MsgUndelegateResponse.typeUrl || Timestamp.is(o.completionTime) && Coin.is(o.amount)); + }, + isAmino(o: any): o is MsgUndelegateResponseAmino { + return o && (o.$typeUrl === MsgUndelegateResponse.typeUrl || Timestamp.isAmino(o.completion_time) && Coin.isAmino(o.amount)); + }, + encode(message: MsgUndelegateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.completionTime !== undefined) { + Timestamp.encode(toTimestamp(message.completionTime), writer.uint32(10).fork()).ldelim(); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUndelegateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUndelegateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.completionTime = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 2: + message.amount = Coin.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUndelegateResponse { + const message = createBaseMsgUndelegateResponse(); + message.completionTime = object.completionTime ?? undefined; + message.amount = object.amount !== undefined && object.amount !== null ? Coin.fromPartial(object.amount) : undefined; + return message; + }, + fromAmino(object: MsgUndelegateResponseAmino): MsgUndelegateResponse { + const message = createBaseMsgUndelegateResponse(); + if (object.completion_time !== undefined && object.completion_time !== null) { + message.completionTime = fromTimestamp(Timestamp.fromAmino(object.completion_time)); + } + if (object.amount !== undefined && object.amount !== null) { + message.amount = Coin.fromAmino(object.amount); + } + return message; + }, + toAmino(message: MsgUndelegateResponse): MsgUndelegateResponseAmino { + const obj: any = {}; + obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : new Date(); + obj.amount = message.amount ? Coin.toAmino(message.amount) : Coin.toAmino(Coin.fromPartial({})); + return obj; + }, + fromAminoMsg(object: MsgUndelegateResponseAminoMsg): MsgUndelegateResponse { + return MsgUndelegateResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUndelegateResponse): MsgUndelegateResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUndelegateResponse", + value: MsgUndelegateResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUndelegateResponseProtoMsg): MsgUndelegateResponse { + return MsgUndelegateResponse.decode(message.value); + }, + toProto(message: MsgUndelegateResponse): Uint8Array { + return MsgUndelegateResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUndelegateResponse): MsgUndelegateResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgUndelegateResponse", + value: MsgUndelegateResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgUndelegateResponse.typeUrl, MsgUndelegateResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgUndelegateResponse.aminoType, MsgUndelegateResponse.typeUrl); +function createBaseMsgCancelUnbondingDelegation(): MsgCancelUnbondingDelegation { + return { + delegatorAddress: "", + validatorAddress: "", + amount: Coin.fromPartial({}), + creationHeight: BigInt(0) + }; +} +export const MsgCancelUnbondingDelegation = { + typeUrl: "/cosmos.staking.v1beta1.MsgCancelUnbondingDelegation", + aminoType: "cosmos-sdk/MsgCancelUnbondingDelegation", + is(o: any): o is MsgCancelUnbondingDelegation { + return o && (o.$typeUrl === MsgCancelUnbondingDelegation.typeUrl || typeof o.delegatorAddress === "string" && typeof o.validatorAddress === "string" && Coin.is(o.amount) && typeof o.creationHeight === "bigint"); + }, + isAmino(o: any): o is MsgCancelUnbondingDelegationAmino { + return o && (o.$typeUrl === MsgCancelUnbondingDelegation.typeUrl || typeof o.delegator_address === "string" && typeof o.validator_address === "string" && Coin.isAmino(o.amount) && typeof o.creation_height === "bigint"); + }, + encode(message: MsgCancelUnbondingDelegation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.delegatorAddress !== "") { + writer.uint32(10).string(message.delegatorAddress); + } + if (message.validatorAddress !== "") { + writer.uint32(18).string(message.validatorAddress); + } + if (message.amount !== undefined) { + Coin.encode(message.amount, writer.uint32(26).fork()).ldelim(); + } + if (message.creationHeight !== BigInt(0)) { + writer.uint32(32).int64(message.creationHeight); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelUnbondingDelegation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelUnbondingDelegation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.delegatorAddress = reader.string(); + break; + case 2: + message.validatorAddress = reader.string(); + break; + case 3: + message.amount = Coin.decode(reader, reader.uint32()); + break; + case 4: + message.creationHeight = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgCancelUnbondingDelegation { + const message = createBaseMsgCancelUnbondingDelegation(); + message.delegatorAddress = object.delegatorAddress ?? ""; + message.validatorAddress = object.validatorAddress ?? ""; + message.amount = object.amount !== undefined && object.amount !== null ? Coin.fromPartial(object.amount) : undefined; + message.creationHeight = object.creationHeight !== undefined && object.creationHeight !== null ? BigInt(object.creationHeight.toString()) : BigInt(0); + return message; + }, + fromAmino(object: MsgCancelUnbondingDelegationAmino): MsgCancelUnbondingDelegation { + const message = createBaseMsgCancelUnbondingDelegation(); + if (object.delegator_address !== undefined && object.delegator_address !== null) { + message.delegatorAddress = object.delegator_address; + } + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = object.validator_address; + } + if (object.amount !== undefined && object.amount !== null) { + message.amount = Coin.fromAmino(object.amount); + } + if (object.creation_height !== undefined && object.creation_height !== null) { + message.creationHeight = BigInt(object.creation_height); + } + return message; + }, + toAmino(message: MsgCancelUnbondingDelegation): MsgCancelUnbondingDelegationAmino { + const obj: any = {}; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.amount = message.amount ? Coin.toAmino(message.amount) : Coin.toAmino(Coin.fromPartial({})); + obj.creation_height = message.creationHeight !== BigInt(0) ? message.creationHeight?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: MsgCancelUnbondingDelegationAminoMsg): MsgCancelUnbondingDelegation { + return MsgCancelUnbondingDelegation.fromAmino(object.value); + }, + toAminoMsg(message: MsgCancelUnbondingDelegation): MsgCancelUnbondingDelegationAminoMsg { + return { + type: "cosmos-sdk/MsgCancelUnbondingDelegation", + value: MsgCancelUnbondingDelegation.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCancelUnbondingDelegationProtoMsg): MsgCancelUnbondingDelegation { + return MsgCancelUnbondingDelegation.decode(message.value); + }, + toProto(message: MsgCancelUnbondingDelegation): Uint8Array { + return MsgCancelUnbondingDelegation.encode(message).finish(); + }, + toProtoMsg(message: MsgCancelUnbondingDelegation): MsgCancelUnbondingDelegationProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgCancelUnbondingDelegation", + value: MsgCancelUnbondingDelegation.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgCancelUnbondingDelegation.typeUrl, MsgCancelUnbondingDelegation); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgCancelUnbondingDelegation.aminoType, MsgCancelUnbondingDelegation.typeUrl); +function createBaseMsgCancelUnbondingDelegationResponse(): MsgCancelUnbondingDelegationResponse { + return {}; +} +export const MsgCancelUnbondingDelegationResponse = { + typeUrl: "/cosmos.staking.v1beta1.MsgCancelUnbondingDelegationResponse", + aminoType: "cosmos-sdk/MsgCancelUnbondingDelegationResponse", + is(o: any): o is MsgCancelUnbondingDelegationResponse { + return o && o.$typeUrl === MsgCancelUnbondingDelegationResponse.typeUrl; + }, + isAmino(o: any): o is MsgCancelUnbondingDelegationResponseAmino { + return o && o.$typeUrl === MsgCancelUnbondingDelegationResponse.typeUrl; + }, + encode(_: MsgCancelUnbondingDelegationResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCancelUnbondingDelegationResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCancelUnbondingDelegationResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgCancelUnbondingDelegationResponse { + const message = createBaseMsgCancelUnbondingDelegationResponse(); + return message; + }, + fromAmino(_: MsgCancelUnbondingDelegationResponseAmino): MsgCancelUnbondingDelegationResponse { + const message = createBaseMsgCancelUnbondingDelegationResponse(); + return message; + }, + toAmino(_: MsgCancelUnbondingDelegationResponse): MsgCancelUnbondingDelegationResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgCancelUnbondingDelegationResponseAminoMsg): MsgCancelUnbondingDelegationResponse { + return MsgCancelUnbondingDelegationResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgCancelUnbondingDelegationResponse): MsgCancelUnbondingDelegationResponseAminoMsg { + return { + type: "cosmos-sdk/MsgCancelUnbondingDelegationResponse", + value: MsgCancelUnbondingDelegationResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCancelUnbondingDelegationResponseProtoMsg): MsgCancelUnbondingDelegationResponse { + return MsgCancelUnbondingDelegationResponse.decode(message.value); + }, + toProto(message: MsgCancelUnbondingDelegationResponse): Uint8Array { + return MsgCancelUnbondingDelegationResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgCancelUnbondingDelegationResponse): MsgCancelUnbondingDelegationResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgCancelUnbondingDelegationResponse", + value: MsgCancelUnbondingDelegationResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgCancelUnbondingDelegationResponse.typeUrl, MsgCancelUnbondingDelegationResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgCancelUnbondingDelegationResponse.aminoType, MsgCancelUnbondingDelegationResponse.typeUrl); +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { + authority: "", + params: Params.fromPartial({}) + }; +} +export const MsgUpdateParams = { + typeUrl: "/cosmos.staking.v1beta1.MsgUpdateParams", + aminoType: "cosmos-sdk/x/staking/MsgUpdateParams", + is(o: any): o is MsgUpdateParams { + return o && (o.$typeUrl === MsgUpdateParams.typeUrl || typeof o.authority === "string" && Params.is(o.params)); + }, + isAmino(o: any): o is MsgUpdateParamsAmino { + return o && (o.$typeUrl === MsgUpdateParams.typeUrl || typeof o.authority === "string" && Params.isAmino(o.params)); + }, + encode(message: MsgUpdateParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + message.authority = object.authority ?? ""; + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: MsgUpdateParamsAmino): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: MsgUpdateParams): MsgUpdateParamsAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsAminoMsg): MsgUpdateParams { + return MsgUpdateParams.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParams): MsgUpdateParamsAminoMsg { + return { + type: "cosmos-sdk/x/staking/MsgUpdateParams", + value: MsgUpdateParams.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsProtoMsg): MsgUpdateParams { + return MsgUpdateParams.decode(message.value); + }, + toProto(message: MsgUpdateParams): Uint8Array { + return MsgUpdateParams.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParams): MsgUpdateParamsProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgUpdateParams", + value: MsgUpdateParams.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgUpdateParams.typeUrl, MsgUpdateParams); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgUpdateParams.aminoType, MsgUpdateParams.typeUrl); +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} +export const MsgUpdateParamsResponse = { + typeUrl: "/cosmos.staking.v1beta1.MsgUpdateParamsResponse", + aminoType: "cosmos-sdk/MsgUpdateParamsResponse", + is(o: any): o is MsgUpdateParamsResponse { + return o && o.$typeUrl === MsgUpdateParamsResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateParamsResponseAmino { + return o && o.$typeUrl === MsgUpdateParamsResponse.typeUrl; + }, + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + fromAmino(_: MsgUpdateParamsResponseAmino): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + toAmino(_: MsgUpdateParamsResponse): MsgUpdateParamsResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsResponseAminoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsResponseProtoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.decode(message.value); + }, + toProto(message: MsgUpdateParamsResponse): Uint8Array { + return MsgUpdateParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseProtoMsg { + return { + typeUrl: "/cosmos.staking.v1beta1.MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgUpdateParamsResponse.typeUrl, MsgUpdateParamsResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgUpdateParamsResponse.aminoType, MsgUpdateParamsResponse.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/tx/signing/v1beta1/signing.ts b/libs/interchain-query/src/cosmos/tx/signing/v1beta1/signing.ts new file mode 100644 index 00000000..8c90655f --- /dev/null +++ b/libs/interchain-query/src/cosmos/tx/signing/v1beta1/signing.ts @@ -0,0 +1,688 @@ +import { CompactBitArray, CompactBitArrayAmino } from "../../../crypto/multisig/v1beta1/multisig"; +import { Any, AnyAmino } from "../../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { GlobalDecoderRegistry } from "../../../../registry"; +/** + * SignMode represents a signing mode with its own security guarantees. + * + * This enum should be considered a registry of all known sign modes + * in the Cosmos ecosystem. Apps are not expected to support all known + * sign modes. Apps that would like to support custom sign modes are + * encouraged to open a small PR against this file to add a new case + * to this SignMode enum describing their sign mode so that different + * apps have a consistent version of this enum. + */ +export enum SignMode { + /** + * SIGN_MODE_UNSPECIFIED - SIGN_MODE_UNSPECIFIED specifies an unknown signing mode and will be + * rejected. + */ + SIGN_MODE_UNSPECIFIED = 0, + /** + * SIGN_MODE_DIRECT - SIGN_MODE_DIRECT specifies a signing mode which uses SignDoc and is + * verified with raw bytes from Tx. + */ + SIGN_MODE_DIRECT = 1, + /** + * SIGN_MODE_TEXTUAL - SIGN_MODE_TEXTUAL is a future signing mode that will verify some + * human-readable textual representation on top of the binary representation + * from SIGN_MODE_DIRECT. + * + * Since: cosmos-sdk 0.50 + */ + SIGN_MODE_TEXTUAL = 2, + /** + * SIGN_MODE_DIRECT_AUX - SIGN_MODE_DIRECT_AUX specifies a signing mode which uses + * SignDocDirectAux. As opposed to SIGN_MODE_DIRECT, this sign mode does not + * require signers signing over other signers' `signer_info`. + * + * Since: cosmos-sdk 0.46 + */ + SIGN_MODE_DIRECT_AUX = 3, + /** + * SIGN_MODE_LEGACY_AMINO_JSON - SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses + * Amino JSON and will be removed in the future. + */ + SIGN_MODE_LEGACY_AMINO_JSON = 127, + /** + * SIGN_MODE_EIP_191 - SIGN_MODE_EIP_191 specifies the sign mode for EIP 191 signing on the Cosmos + * SDK. Ref: https://eips.ethereum.org/EIPS/eip-191 + * + * Currently, SIGN_MODE_EIP_191 is registered as a SignMode enum variant, + * but is not implemented on the SDK by default. To enable EIP-191, you need + * to pass a custom `TxConfig` that has an implementation of + * `SignModeHandler` for EIP-191. The SDK may decide to fully support + * EIP-191 in the future. + * + * Since: cosmos-sdk 0.45.2 + */ + SIGN_MODE_EIP_191 = 191, + UNRECOGNIZED = -1, +} +export const SignModeAmino = SignMode; +export function signModeFromJSON(object: any): SignMode { + switch (object) { + case 0: + case "SIGN_MODE_UNSPECIFIED": + return SignMode.SIGN_MODE_UNSPECIFIED; + case 1: + case "SIGN_MODE_DIRECT": + return SignMode.SIGN_MODE_DIRECT; + case 2: + case "SIGN_MODE_TEXTUAL": + return SignMode.SIGN_MODE_TEXTUAL; + case 3: + case "SIGN_MODE_DIRECT_AUX": + return SignMode.SIGN_MODE_DIRECT_AUX; + case 127: + case "SIGN_MODE_LEGACY_AMINO_JSON": + return SignMode.SIGN_MODE_LEGACY_AMINO_JSON; + case 191: + case "SIGN_MODE_EIP_191": + return SignMode.SIGN_MODE_EIP_191; + case -1: + case "UNRECOGNIZED": + default: + return SignMode.UNRECOGNIZED; + } +} +export function signModeToJSON(object: SignMode): string { + switch (object) { + case SignMode.SIGN_MODE_UNSPECIFIED: + return "SIGN_MODE_UNSPECIFIED"; + case SignMode.SIGN_MODE_DIRECT: + return "SIGN_MODE_DIRECT"; + case SignMode.SIGN_MODE_TEXTUAL: + return "SIGN_MODE_TEXTUAL"; + case SignMode.SIGN_MODE_DIRECT_AUX: + return "SIGN_MODE_DIRECT_AUX"; + case SignMode.SIGN_MODE_LEGACY_AMINO_JSON: + return "SIGN_MODE_LEGACY_AMINO_JSON"; + case SignMode.SIGN_MODE_EIP_191: + return "SIGN_MODE_EIP_191"; + case SignMode.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** SignatureDescriptors wraps multiple SignatureDescriptor's. */ +export interface SignatureDescriptors { + /** signatures are the signature descriptors */ + signatures: SignatureDescriptor[]; +} +export interface SignatureDescriptorsProtoMsg { + typeUrl: "/cosmos.tx.signing.v1beta1.SignatureDescriptors"; + value: Uint8Array; +} +/** SignatureDescriptors wraps multiple SignatureDescriptor's. */ +export interface SignatureDescriptorsAmino { + /** signatures are the signature descriptors */ + signatures: SignatureDescriptorAmino[]; +} +export interface SignatureDescriptorsAminoMsg { + type: "cosmos-sdk/SignatureDescriptors"; + value: SignatureDescriptorsAmino; +} +/** + * SignatureDescriptor is a convenience type which represents the full data for + * a signature including the public key of the signer, signing modes and the + * signature itself. It is primarily used for coordinating signatures between + * clients. + */ +export interface SignatureDescriptor { + /** public_key is the public key of the signer */ + publicKey?: Any; + data?: SignatureDescriptor_Data; + /** + * sequence is the sequence of the account, which describes the + * number of committed transactions signed by a given address. It is used to prevent + * replay attacks. + */ + sequence: bigint; +} +export interface SignatureDescriptorProtoMsg { + typeUrl: "/cosmos.tx.signing.v1beta1.SignatureDescriptor"; + value: Uint8Array; +} +/** + * SignatureDescriptor is a convenience type which represents the full data for + * a signature including the public key of the signer, signing modes and the + * signature itself. It is primarily used for coordinating signatures between + * clients. + */ +export interface SignatureDescriptorAmino { + /** public_key is the public key of the signer */ + public_key?: AnyAmino; + data?: SignatureDescriptor_DataAmino; + /** + * sequence is the sequence of the account, which describes the + * number of committed transactions signed by a given address. It is used to prevent + * replay attacks. + */ + sequence: string; +} +export interface SignatureDescriptorAminoMsg { + type: "cosmos-sdk/SignatureDescriptor"; + value: SignatureDescriptorAmino; +} +/** Data represents signature data */ +export interface SignatureDescriptor_Data { + /** single represents a single signer */ + single?: SignatureDescriptor_Data_Single; + /** multi represents a multisig signer */ + multi?: SignatureDescriptor_Data_Multi; +} +export interface SignatureDescriptor_DataProtoMsg { + typeUrl: "/cosmos.tx.signing.v1beta1.Data"; + value: Uint8Array; +} +/** Data represents signature data */ +export interface SignatureDescriptor_DataAmino { + /** single represents a single signer */ + single?: SignatureDescriptor_Data_SingleAmino; + /** multi represents a multisig signer */ + multi?: SignatureDescriptor_Data_MultiAmino; +} +export interface SignatureDescriptor_DataAminoMsg { + type: "cosmos-sdk/Data"; + value: SignatureDescriptor_DataAmino; +} +/** Single is the signature data for a single signer */ +export interface SignatureDescriptor_Data_Single { + /** mode is the signing mode of the single signer */ + mode: SignMode; + /** signature is the raw signature bytes */ + signature: Uint8Array; +} +export interface SignatureDescriptor_Data_SingleProtoMsg { + typeUrl: "/cosmos.tx.signing.v1beta1.Single"; + value: Uint8Array; +} +/** Single is the signature data for a single signer */ +export interface SignatureDescriptor_Data_SingleAmino { + /** mode is the signing mode of the single signer */ + mode: SignMode; + /** signature is the raw signature bytes */ + signature: string; +} +export interface SignatureDescriptor_Data_SingleAminoMsg { + type: "cosmos-sdk/Single"; + value: SignatureDescriptor_Data_SingleAmino; +} +/** Multi is the signature data for a multisig public key */ +export interface SignatureDescriptor_Data_Multi { + /** bitarray specifies which keys within the multisig are signing */ + bitarray?: CompactBitArray; + /** signatures is the signatures of the multi-signature */ + signatures: SignatureDescriptor_Data[]; +} +export interface SignatureDescriptor_Data_MultiProtoMsg { + typeUrl: "/cosmos.tx.signing.v1beta1.Multi"; + value: Uint8Array; +} +/** Multi is the signature data for a multisig public key */ +export interface SignatureDescriptor_Data_MultiAmino { + /** bitarray specifies which keys within the multisig are signing */ + bitarray?: CompactBitArrayAmino; + /** signatures is the signatures of the multi-signature */ + signatures: SignatureDescriptor_DataAmino[]; +} +export interface SignatureDescriptor_Data_MultiAminoMsg { + type: "cosmos-sdk/Multi"; + value: SignatureDescriptor_Data_MultiAmino; +} +function createBaseSignatureDescriptors(): SignatureDescriptors { + return { + signatures: [] + }; +} +export const SignatureDescriptors = { + typeUrl: "/cosmos.tx.signing.v1beta1.SignatureDescriptors", + aminoType: "cosmos-sdk/SignatureDescriptors", + is(o: any): o is SignatureDescriptors { + return o && (o.$typeUrl === SignatureDescriptors.typeUrl || Array.isArray(o.signatures) && (!o.signatures.length || SignatureDescriptor.is(o.signatures[0]))); + }, + isAmino(o: any): o is SignatureDescriptorsAmino { + return o && (o.$typeUrl === SignatureDescriptors.typeUrl || Array.isArray(o.signatures) && (!o.signatures.length || SignatureDescriptor.isAmino(o.signatures[0]))); + }, + encode(message: SignatureDescriptors, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.signatures) { + SignatureDescriptor.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptors { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptors(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signatures.push(SignatureDescriptor.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SignatureDescriptors { + const message = createBaseSignatureDescriptors(); + message.signatures = object.signatures?.map(e => SignatureDescriptor.fromPartial(e)) || []; + return message; + }, + fromAmino(object: SignatureDescriptorsAmino): SignatureDescriptors { + const message = createBaseSignatureDescriptors(); + message.signatures = object.signatures?.map(e => SignatureDescriptor.fromAmino(e)) || []; + return message; + }, + toAmino(message: SignatureDescriptors): SignatureDescriptorsAmino { + const obj: any = {}; + if (message.signatures) { + obj.signatures = message.signatures.map(e => e ? SignatureDescriptor.toAmino(e) : undefined); + } else { + obj.signatures = message.signatures; + } + return obj; + }, + fromAminoMsg(object: SignatureDescriptorsAminoMsg): SignatureDescriptors { + return SignatureDescriptors.fromAmino(object.value); + }, + toAminoMsg(message: SignatureDescriptors): SignatureDescriptorsAminoMsg { + return { + type: "cosmos-sdk/SignatureDescriptors", + value: SignatureDescriptors.toAmino(message) + }; + }, + fromProtoMsg(message: SignatureDescriptorsProtoMsg): SignatureDescriptors { + return SignatureDescriptors.decode(message.value); + }, + toProto(message: SignatureDescriptors): Uint8Array { + return SignatureDescriptors.encode(message).finish(); + }, + toProtoMsg(message: SignatureDescriptors): SignatureDescriptorsProtoMsg { + return { + typeUrl: "/cosmos.tx.signing.v1beta1.SignatureDescriptors", + value: SignatureDescriptors.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(SignatureDescriptors.typeUrl, SignatureDescriptors); +GlobalDecoderRegistry.registerAminoProtoMapping(SignatureDescriptors.aminoType, SignatureDescriptors.typeUrl); +function createBaseSignatureDescriptor(): SignatureDescriptor { + return { + publicKey: undefined, + data: undefined, + sequence: BigInt(0) + }; +} +export const SignatureDescriptor = { + typeUrl: "/cosmos.tx.signing.v1beta1.SignatureDescriptor", + aminoType: "cosmos-sdk/SignatureDescriptor", + is(o: any): o is SignatureDescriptor { + return o && (o.$typeUrl === SignatureDescriptor.typeUrl || typeof o.sequence === "bigint"); + }, + isAmino(o: any): o is SignatureDescriptorAmino { + return o && (o.$typeUrl === SignatureDescriptor.typeUrl || typeof o.sequence === "bigint"); + }, + encode(message: SignatureDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.publicKey !== undefined) { + Any.encode(message.publicKey, writer.uint32(10).fork()).ldelim(); + } + if (message.data !== undefined) { + SignatureDescriptor_Data.encode(message.data, writer.uint32(18).fork()).ldelim(); + } + if (message.sequence !== BigInt(0)) { + writer.uint32(24).uint64(message.sequence); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.publicKey = Any.decode(reader, reader.uint32()); + break; + case 2: + message.data = SignatureDescriptor_Data.decode(reader, reader.uint32()); + break; + case 3: + message.sequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SignatureDescriptor { + const message = createBaseSignatureDescriptor(); + message.publicKey = object.publicKey !== undefined && object.publicKey !== null ? Any.fromPartial(object.publicKey) : undefined; + message.data = object.data !== undefined && object.data !== null ? SignatureDescriptor_Data.fromPartial(object.data) : undefined; + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + return message; + }, + fromAmino(object: SignatureDescriptorAmino): SignatureDescriptor { + const message = createBaseSignatureDescriptor(); + if (object.public_key !== undefined && object.public_key !== null) { + message.publicKey = Any.fromAmino(object.public_key); + } + if (object.data !== undefined && object.data !== null) { + message.data = SignatureDescriptor_Data.fromAmino(object.data); + } + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + return message; + }, + toAmino(message: SignatureDescriptor): SignatureDescriptorAmino { + const obj: any = {}; + obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; + obj.data = message.data ? SignatureDescriptor_Data.toAmino(message.data) : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: SignatureDescriptorAminoMsg): SignatureDescriptor { + return SignatureDescriptor.fromAmino(object.value); + }, + toAminoMsg(message: SignatureDescriptor): SignatureDescriptorAminoMsg { + return { + type: "cosmos-sdk/SignatureDescriptor", + value: SignatureDescriptor.toAmino(message) + }; + }, + fromProtoMsg(message: SignatureDescriptorProtoMsg): SignatureDescriptor { + return SignatureDescriptor.decode(message.value); + }, + toProto(message: SignatureDescriptor): Uint8Array { + return SignatureDescriptor.encode(message).finish(); + }, + toProtoMsg(message: SignatureDescriptor): SignatureDescriptorProtoMsg { + return { + typeUrl: "/cosmos.tx.signing.v1beta1.SignatureDescriptor", + value: SignatureDescriptor.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(SignatureDescriptor.typeUrl, SignatureDescriptor); +GlobalDecoderRegistry.registerAminoProtoMapping(SignatureDescriptor.aminoType, SignatureDescriptor.typeUrl); +function createBaseSignatureDescriptor_Data(): SignatureDescriptor_Data { + return { + single: undefined, + multi: undefined + }; +} +export const SignatureDescriptor_Data = { + typeUrl: "/cosmos.tx.signing.v1beta1.Data", + aminoType: "cosmos-sdk/Data", + is(o: any): o is SignatureDescriptor_Data { + return o && o.$typeUrl === SignatureDescriptor_Data.typeUrl; + }, + isAmino(o: any): o is SignatureDescriptor_DataAmino { + return o && o.$typeUrl === SignatureDescriptor_Data.typeUrl; + }, + encode(message: SignatureDescriptor_Data, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.single !== undefined) { + SignatureDescriptor_Data_Single.encode(message.single, writer.uint32(10).fork()).ldelim(); + } + if (message.multi !== undefined) { + SignatureDescriptor_Data_Multi.encode(message.multi, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptor_Data { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptor_Data(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.single = SignatureDescriptor_Data_Single.decode(reader, reader.uint32()); + break; + case 2: + message.multi = SignatureDescriptor_Data_Multi.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SignatureDescriptor_Data { + const message = createBaseSignatureDescriptor_Data(); + message.single = object.single !== undefined && object.single !== null ? SignatureDescriptor_Data_Single.fromPartial(object.single) : undefined; + message.multi = object.multi !== undefined && object.multi !== null ? SignatureDescriptor_Data_Multi.fromPartial(object.multi) : undefined; + return message; + }, + fromAmino(object: SignatureDescriptor_DataAmino): SignatureDescriptor_Data { + const message = createBaseSignatureDescriptor_Data(); + if (object.single !== undefined && object.single !== null) { + message.single = SignatureDescriptor_Data_Single.fromAmino(object.single); + } + if (object.multi !== undefined && object.multi !== null) { + message.multi = SignatureDescriptor_Data_Multi.fromAmino(object.multi); + } + return message; + }, + toAmino(message: SignatureDescriptor_Data): SignatureDescriptor_DataAmino { + const obj: any = {}; + obj.single = message.single ? SignatureDescriptor_Data_Single.toAmino(message.single) : undefined; + obj.multi = message.multi ? SignatureDescriptor_Data_Multi.toAmino(message.multi) : undefined; + return obj; + }, + fromAminoMsg(object: SignatureDescriptor_DataAminoMsg): SignatureDescriptor_Data { + return SignatureDescriptor_Data.fromAmino(object.value); + }, + toAminoMsg(message: SignatureDescriptor_Data): SignatureDescriptor_DataAminoMsg { + return { + type: "cosmos-sdk/Data", + value: SignatureDescriptor_Data.toAmino(message) + }; + }, + fromProtoMsg(message: SignatureDescriptor_DataProtoMsg): SignatureDescriptor_Data { + return SignatureDescriptor_Data.decode(message.value); + }, + toProto(message: SignatureDescriptor_Data): Uint8Array { + return SignatureDescriptor_Data.encode(message).finish(); + }, + toProtoMsg(message: SignatureDescriptor_Data): SignatureDescriptor_DataProtoMsg { + return { + typeUrl: "/cosmos.tx.signing.v1beta1.Data", + value: SignatureDescriptor_Data.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(SignatureDescriptor_Data.typeUrl, SignatureDescriptor_Data); +GlobalDecoderRegistry.registerAminoProtoMapping(SignatureDescriptor_Data.aminoType, SignatureDescriptor_Data.typeUrl); +function createBaseSignatureDescriptor_Data_Single(): SignatureDescriptor_Data_Single { + return { + mode: 0, + signature: new Uint8Array() + }; +} +export const SignatureDescriptor_Data_Single = { + typeUrl: "/cosmos.tx.signing.v1beta1.Single", + aminoType: "cosmos-sdk/Single", + is(o: any): o is SignatureDescriptor_Data_Single { + return o && (o.$typeUrl === SignatureDescriptor_Data_Single.typeUrl || isSet(o.mode) && (o.signature instanceof Uint8Array || typeof o.signature === "string")); + }, + isAmino(o: any): o is SignatureDescriptor_Data_SingleAmino { + return o && (o.$typeUrl === SignatureDescriptor_Data_Single.typeUrl || isSet(o.mode) && (o.signature instanceof Uint8Array || typeof o.signature === "string")); + }, + encode(message: SignatureDescriptor_Data_Single, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.mode !== 0) { + writer.uint32(8).int32(message.mode); + } + if (message.signature.length !== 0) { + writer.uint32(18).bytes(message.signature); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptor_Data_Single { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptor_Data_Single(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.mode = (reader.int32() as any); + break; + case 2: + message.signature = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SignatureDescriptor_Data_Single { + const message = createBaseSignatureDescriptor_Data_Single(); + message.mode = object.mode ?? 0; + message.signature = object.signature ?? new Uint8Array(); + return message; + }, + fromAmino(object: SignatureDescriptor_Data_SingleAmino): SignatureDescriptor_Data_Single { + const message = createBaseSignatureDescriptor_Data_Single(); + if (object.mode !== undefined && object.mode !== null) { + message.mode = object.mode; + } + if (object.signature !== undefined && object.signature !== null) { + message.signature = bytesFromBase64(object.signature); + } + return message; + }, + toAmino(message: SignatureDescriptor_Data_Single): SignatureDescriptor_Data_SingleAmino { + const obj: any = {}; + obj.mode = message.mode === 0 ? undefined : message.mode; + obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; + return obj; + }, + fromAminoMsg(object: SignatureDescriptor_Data_SingleAminoMsg): SignatureDescriptor_Data_Single { + return SignatureDescriptor_Data_Single.fromAmino(object.value); + }, + toAminoMsg(message: SignatureDescriptor_Data_Single): SignatureDescriptor_Data_SingleAminoMsg { + return { + type: "cosmos-sdk/Single", + value: SignatureDescriptor_Data_Single.toAmino(message) + }; + }, + fromProtoMsg(message: SignatureDescriptor_Data_SingleProtoMsg): SignatureDescriptor_Data_Single { + return SignatureDescriptor_Data_Single.decode(message.value); + }, + toProto(message: SignatureDescriptor_Data_Single): Uint8Array { + return SignatureDescriptor_Data_Single.encode(message).finish(); + }, + toProtoMsg(message: SignatureDescriptor_Data_Single): SignatureDescriptor_Data_SingleProtoMsg { + return { + typeUrl: "/cosmos.tx.signing.v1beta1.Single", + value: SignatureDescriptor_Data_Single.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(SignatureDescriptor_Data_Single.typeUrl, SignatureDescriptor_Data_Single); +GlobalDecoderRegistry.registerAminoProtoMapping(SignatureDescriptor_Data_Single.aminoType, SignatureDescriptor_Data_Single.typeUrl); +function createBaseSignatureDescriptor_Data_Multi(): SignatureDescriptor_Data_Multi { + return { + bitarray: undefined, + signatures: [] + }; +} +export const SignatureDescriptor_Data_Multi = { + typeUrl: "/cosmos.tx.signing.v1beta1.Multi", + aminoType: "cosmos-sdk/Multi", + is(o: any): o is SignatureDescriptor_Data_Multi { + return o && (o.$typeUrl === SignatureDescriptor_Data_Multi.typeUrl || Array.isArray(o.signatures) && (!o.signatures.length || SignatureDescriptor_Data.is(o.signatures[0]))); + }, + isAmino(o: any): o is SignatureDescriptor_Data_MultiAmino { + return o && (o.$typeUrl === SignatureDescriptor_Data_Multi.typeUrl || Array.isArray(o.signatures) && (!o.signatures.length || SignatureDescriptor_Data.isAmino(o.signatures[0]))); + }, + encode(message: SignatureDescriptor_Data_Multi, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.bitarray !== undefined) { + CompactBitArray.encode(message.bitarray, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.signatures) { + SignatureDescriptor_Data.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SignatureDescriptor_Data_Multi { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignatureDescriptor_Data_Multi(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bitarray = CompactBitArray.decode(reader, reader.uint32()); + break; + case 2: + message.signatures.push(SignatureDescriptor_Data.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SignatureDescriptor_Data_Multi { + const message = createBaseSignatureDescriptor_Data_Multi(); + message.bitarray = object.bitarray !== undefined && object.bitarray !== null ? CompactBitArray.fromPartial(object.bitarray) : undefined; + message.signatures = object.signatures?.map(e => SignatureDescriptor_Data.fromPartial(e)) || []; + return message; + }, + fromAmino(object: SignatureDescriptor_Data_MultiAmino): SignatureDescriptor_Data_Multi { + const message = createBaseSignatureDescriptor_Data_Multi(); + if (object.bitarray !== undefined && object.bitarray !== null) { + message.bitarray = CompactBitArray.fromAmino(object.bitarray); + } + message.signatures = object.signatures?.map(e => SignatureDescriptor_Data.fromAmino(e)) || []; + return message; + }, + toAmino(message: SignatureDescriptor_Data_Multi): SignatureDescriptor_Data_MultiAmino { + const obj: any = {}; + obj.bitarray = message.bitarray ? CompactBitArray.toAmino(message.bitarray) : undefined; + if (message.signatures) { + obj.signatures = message.signatures.map(e => e ? SignatureDescriptor_Data.toAmino(e) : undefined); + } else { + obj.signatures = message.signatures; + } + return obj; + }, + fromAminoMsg(object: SignatureDescriptor_Data_MultiAminoMsg): SignatureDescriptor_Data_Multi { + return SignatureDescriptor_Data_Multi.fromAmino(object.value); + }, + toAminoMsg(message: SignatureDescriptor_Data_Multi): SignatureDescriptor_Data_MultiAminoMsg { + return { + type: "cosmos-sdk/Multi", + value: SignatureDescriptor_Data_Multi.toAmino(message) + }; + }, + fromProtoMsg(message: SignatureDescriptor_Data_MultiProtoMsg): SignatureDescriptor_Data_Multi { + return SignatureDescriptor_Data_Multi.decode(message.value); + }, + toProto(message: SignatureDescriptor_Data_Multi): Uint8Array { + return SignatureDescriptor_Data_Multi.encode(message).finish(); + }, + toProtoMsg(message: SignatureDescriptor_Data_Multi): SignatureDescriptor_Data_MultiProtoMsg { + return { + typeUrl: "/cosmos.tx.signing.v1beta1.Multi", + value: SignatureDescriptor_Data_Multi.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(SignatureDescriptor_Data_Multi.typeUrl, SignatureDescriptor_Data_Multi); +GlobalDecoderRegistry.registerAminoProtoMapping(SignatureDescriptor_Data_Multi.aminoType, SignatureDescriptor_Data_Multi.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/tx/v1beta1/service.rpc.func.ts b/libs/interchain-query/src/cosmos/tx/v1beta1/service.rpc.func.ts new file mode 100644 index 00000000..4fb651f5 --- /dev/null +++ b/libs/interchain-query/src/cosmos/tx/v1beta1/service.rpc.func.ts @@ -0,0 +1,102 @@ +import { RpcResolver, buildQuery } from "../../../helper-func-types"; +import { buildUseQuery } from "../../../react-query"; +import { SimulateRequest, SimulateResponse, GetTxRequest, GetTxResponse, BroadcastTxRequest, BroadcastTxResponse, GetTxsEventRequest, GetTxsEventResponse, GetBlockWithTxsRequest, GetBlockWithTxsResponse, TxDecodeRequest, TxDecodeResponse, TxEncodeRequest, TxEncodeResponse, TxEncodeAminoRequest, TxEncodeAminoResponse, TxDecodeAminoRequest, TxDecodeAminoResponse } from "./service"; +export const createGetSimulate = (clientResolver?: RpcResolver) => buildQuery({ + encode: SimulateRequest.encode, + decode: SimulateResponse.decode, + service: "cosmos.tx.v1beta1.Service", + method: "Simulate", + clientResolver +}); +export const useGetSimulate = buildUseQuery({ + builderQueryFn: createGetSimulate, + queryKeyPrefix: "SimulateQuery" +}); +export const createGetGetTx = (clientResolver?: RpcResolver) => buildQuery({ + encode: GetTxRequest.encode, + decode: GetTxResponse.decode, + service: "cosmos.tx.v1beta1.Service", + method: "GetTx", + clientResolver +}); +export const useGetGetTx = buildUseQuery({ + builderQueryFn: createGetGetTx, + queryKeyPrefix: "GetTxQuery" +}); +export const createGetBroadcastTx = (clientResolver?: RpcResolver) => buildQuery({ + encode: BroadcastTxRequest.encode, + decode: BroadcastTxResponse.decode, + service: "cosmos.tx.v1beta1.Service", + method: "BroadcastTx", + clientResolver +}); +export const useGetBroadcastTx = buildUseQuery({ + builderQueryFn: createGetBroadcastTx, + queryKeyPrefix: "BroadcastTxQuery" +}); +export const createGetGetTxsEvent = (clientResolver?: RpcResolver) => buildQuery({ + encode: GetTxsEventRequest.encode, + decode: GetTxsEventResponse.decode, + service: "cosmos.tx.v1beta1.Service", + method: "GetTxsEvent", + clientResolver +}); +export const useGetGetTxsEvent = buildUseQuery({ + builderQueryFn: createGetGetTxsEvent, + queryKeyPrefix: "GetTxsEventQuery" +}); +export const createGetGetBlockWithTxs = (clientResolver?: RpcResolver) => buildQuery({ + encode: GetBlockWithTxsRequest.encode, + decode: GetBlockWithTxsResponse.decode, + service: "cosmos.tx.v1beta1.Service", + method: "GetBlockWithTxs", + clientResolver +}); +export const useGetGetBlockWithTxs = buildUseQuery({ + builderQueryFn: createGetGetBlockWithTxs, + queryKeyPrefix: "GetBlockWithTxsQuery" +}); +export const createGetTxDecode = (clientResolver?: RpcResolver) => buildQuery({ + encode: TxDecodeRequest.encode, + decode: TxDecodeResponse.decode, + service: "cosmos.tx.v1beta1.Service", + method: "TxDecode", + clientResolver +}); +export const useGetTxDecode = buildUseQuery({ + builderQueryFn: createGetTxDecode, + queryKeyPrefix: "TxDecodeQuery" +}); +export const createGetTxEncode = (clientResolver?: RpcResolver) => buildQuery({ + encode: TxEncodeRequest.encode, + decode: TxEncodeResponse.decode, + service: "cosmos.tx.v1beta1.Service", + method: "TxEncode", + clientResolver +}); +export const useGetTxEncode = buildUseQuery({ + builderQueryFn: createGetTxEncode, + queryKeyPrefix: "TxEncodeQuery" +}); +export const createGetTxEncodeAmino = (clientResolver?: RpcResolver) => buildQuery({ + encode: TxEncodeAminoRequest.encode, + decode: TxEncodeAminoResponse.decode, + service: "cosmos.tx.v1beta1.Service", + method: "TxEncodeAmino", + clientResolver +}); +export const useGetTxEncodeAmino = buildUseQuery({ + builderQueryFn: createGetTxEncodeAmino, + queryKeyPrefix: "TxEncodeAminoQuery" +}); +export const createGetTxDecodeAmino = (clientResolver?: RpcResolver) => buildQuery({ + encode: TxDecodeAminoRequest.encode, + decode: TxDecodeAminoResponse.decode, + service: "cosmos.tx.v1beta1.Service", + method: "TxDecodeAmino", + clientResolver +}); +export const useGetTxDecodeAmino = buildUseQuery({ + builderQueryFn: createGetTxDecodeAmino, + queryKeyPrefix: "TxDecodeAminoQuery" +}); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/tx/v1beta1/service.ts b/libs/interchain-query/src/cosmos/tx/v1beta1/service.ts new file mode 100644 index 00000000..9c0eaf31 --- /dev/null +++ b/libs/interchain-query/src/cosmos/tx/v1beta1/service.ts @@ -0,0 +1,2294 @@ +import { Tx, TxAmino } from "./tx"; +import { PageRequest, PageRequestAmino, PageResponse, PageResponseAmino } from "../../base/query/v1beta1/pagination"; +import { TxResponse, TxResponseAmino, GasInfo, GasInfoAmino, Result, ResultAmino } from "../../base/abci/v1beta1/abci"; +import { BlockID, BlockIDAmino } from "../../../tendermint/types/types"; +import { Block, BlockAmino } from "../../../tendermint/types/block"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; +/** OrderBy defines the sorting order */ +export enum OrderBy { + /** + * ORDER_BY_UNSPECIFIED - ORDER_BY_UNSPECIFIED specifies an unknown sorting order. OrderBy defaults + * to ASC in this case. + */ + ORDER_BY_UNSPECIFIED = 0, + /** ORDER_BY_ASC - ORDER_BY_ASC defines ascending order */ + ORDER_BY_ASC = 1, + /** ORDER_BY_DESC - ORDER_BY_DESC defines descending order */ + ORDER_BY_DESC = 2, + UNRECOGNIZED = -1, +} +export const OrderByAmino = OrderBy; +export function orderByFromJSON(object: any): OrderBy { + switch (object) { + case 0: + case "ORDER_BY_UNSPECIFIED": + return OrderBy.ORDER_BY_UNSPECIFIED; + case 1: + case "ORDER_BY_ASC": + return OrderBy.ORDER_BY_ASC; + case 2: + case "ORDER_BY_DESC": + return OrderBy.ORDER_BY_DESC; + case -1: + case "UNRECOGNIZED": + default: + return OrderBy.UNRECOGNIZED; + } +} +export function orderByToJSON(object: OrderBy): string { + switch (object) { + case OrderBy.ORDER_BY_UNSPECIFIED: + return "ORDER_BY_UNSPECIFIED"; + case OrderBy.ORDER_BY_ASC: + return "ORDER_BY_ASC"; + case OrderBy.ORDER_BY_DESC: + return "ORDER_BY_DESC"; + case OrderBy.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** + * BroadcastMode specifies the broadcast mode for the TxService.Broadcast RPC + * method. + */ +export enum BroadcastMode { + /** BROADCAST_MODE_UNSPECIFIED - zero-value for mode ordering */ + BROADCAST_MODE_UNSPECIFIED = 0, + /** + * BROADCAST_MODE_BLOCK - DEPRECATED: use BROADCAST_MODE_SYNC instead, + * BROADCAST_MODE_BLOCK is not supported by the SDK from v0.47.x onwards. + */ + BROADCAST_MODE_BLOCK = 1, + /** + * BROADCAST_MODE_SYNC - BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits + * for a CheckTx execution response only. + */ + BROADCAST_MODE_SYNC = 2, + /** + * BROADCAST_MODE_ASYNC - BROADCAST_MODE_ASYNC defines a tx broadcasting mode where the client + * returns immediately. + */ + BROADCAST_MODE_ASYNC = 3, + UNRECOGNIZED = -1, +} +export const BroadcastModeAmino = BroadcastMode; +export function broadcastModeFromJSON(object: any): BroadcastMode { + switch (object) { + case 0: + case "BROADCAST_MODE_UNSPECIFIED": + return BroadcastMode.BROADCAST_MODE_UNSPECIFIED; + case 1: + case "BROADCAST_MODE_BLOCK": + return BroadcastMode.BROADCAST_MODE_BLOCK; + case 2: + case "BROADCAST_MODE_SYNC": + return BroadcastMode.BROADCAST_MODE_SYNC; + case 3: + case "BROADCAST_MODE_ASYNC": + return BroadcastMode.BROADCAST_MODE_ASYNC; + case -1: + case "UNRECOGNIZED": + default: + return BroadcastMode.UNRECOGNIZED; + } +} +export function broadcastModeToJSON(object: BroadcastMode): string { + switch (object) { + case BroadcastMode.BROADCAST_MODE_UNSPECIFIED: + return "BROADCAST_MODE_UNSPECIFIED"; + case BroadcastMode.BROADCAST_MODE_BLOCK: + return "BROADCAST_MODE_BLOCK"; + case BroadcastMode.BROADCAST_MODE_SYNC: + return "BROADCAST_MODE_SYNC"; + case BroadcastMode.BROADCAST_MODE_ASYNC: + return "BROADCAST_MODE_ASYNC"; + case BroadcastMode.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** + * GetTxsEventRequest is the request type for the Service.TxsByEvents + * RPC method. + */ +export interface GetTxsEventRequest { + /** + * events is the list of transaction event type. + * Deprecated post v0.47.x: use query instead, which should contain a valid + * events query. + */ + /** @deprecated */ + events: string[]; + /** + * pagination defines a pagination for the request. + * Deprecated post v0.46.x: use page and limit instead. + */ + /** @deprecated */ + pagination?: PageRequest; + orderBy: OrderBy; + /** + * page is the page number to query, starts at 1. If not provided, will + * default to first page. + */ + page: bigint; + /** + * limit is the total number of results to be returned in the result page. + * If left empty it will default to a value to be set by each app. + */ + limit: bigint; + /** + * query defines the transaction event query that is proxied to Tendermint's + * TxSearch RPC method. The query must be valid. + * + * Since cosmos-sdk 0.50 + */ + query: string; +} +export interface GetTxsEventRequestProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.GetTxsEventRequest"; + value: Uint8Array; +} +/** + * GetTxsEventRequest is the request type for the Service.TxsByEvents + * RPC method. + */ +export interface GetTxsEventRequestAmino { + /** + * events is the list of transaction event type. + * Deprecated post v0.47.x: use query instead, which should contain a valid + * events query. + */ + /** @deprecated */ + events: string[]; + /** + * pagination defines a pagination for the request. + * Deprecated post v0.46.x: use page and limit instead. + */ + /** @deprecated */ + pagination?: PageRequestAmino; + order_by: OrderBy; + /** + * page is the page number to query, starts at 1. If not provided, will + * default to first page. + */ + page: string; + /** + * limit is the total number of results to be returned in the result page. + * If left empty it will default to a value to be set by each app. + */ + limit: string; + /** + * query defines the transaction event query that is proxied to Tendermint's + * TxSearch RPC method. The query must be valid. + * + * Since cosmos-sdk 0.50 + */ + query: string; +} +export interface GetTxsEventRequestAminoMsg { + type: "cosmos-sdk/GetTxsEventRequest"; + value: GetTxsEventRequestAmino; +} +/** + * GetTxsEventResponse is the response type for the Service.TxsByEvents + * RPC method. + */ +export interface GetTxsEventResponse { + /** txs is the list of queried transactions. */ + txs: Tx[]; + /** tx_responses is the list of queried TxResponses. */ + txResponses: TxResponse[]; + /** + * pagination defines a pagination for the response. + * Deprecated post v0.46.x: use total instead. + */ + /** @deprecated */ + pagination?: PageResponse; + /** total is total number of results available */ + total: bigint; +} +export interface GetTxsEventResponseProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.GetTxsEventResponse"; + value: Uint8Array; +} +/** + * GetTxsEventResponse is the response type for the Service.TxsByEvents + * RPC method. + */ +export interface GetTxsEventResponseAmino { + /** txs is the list of queried transactions. */ + txs: TxAmino[]; + /** tx_responses is the list of queried TxResponses. */ + tx_responses: TxResponseAmino[]; + /** + * pagination defines a pagination for the response. + * Deprecated post v0.46.x: use total instead. + */ + /** @deprecated */ + pagination?: PageResponseAmino; + /** total is total number of results available */ + total: string; +} +export interface GetTxsEventResponseAminoMsg { + type: "cosmos-sdk/GetTxsEventResponse"; + value: GetTxsEventResponseAmino; +} +/** + * BroadcastTxRequest is the request type for the Service.BroadcastTxRequest + * RPC method. + */ +export interface BroadcastTxRequest { + /** tx_bytes is the raw transaction. */ + txBytes: Uint8Array; + mode: BroadcastMode; +} +export interface BroadcastTxRequestProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.BroadcastTxRequest"; + value: Uint8Array; +} +/** + * BroadcastTxRequest is the request type for the Service.BroadcastTxRequest + * RPC method. + */ +export interface BroadcastTxRequestAmino { + /** tx_bytes is the raw transaction. */ + tx_bytes: string; + mode: BroadcastMode; +} +export interface BroadcastTxRequestAminoMsg { + type: "cosmos-sdk/BroadcastTxRequest"; + value: BroadcastTxRequestAmino; +} +/** + * BroadcastTxResponse is the response type for the + * Service.BroadcastTx method. + */ +export interface BroadcastTxResponse { + /** tx_response is the queried TxResponses. */ + txResponse?: TxResponse; +} +export interface BroadcastTxResponseProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.BroadcastTxResponse"; + value: Uint8Array; +} +/** + * BroadcastTxResponse is the response type for the + * Service.BroadcastTx method. + */ +export interface BroadcastTxResponseAmino { + /** tx_response is the queried TxResponses. */ + tx_response?: TxResponseAmino; +} +export interface BroadcastTxResponseAminoMsg { + type: "cosmos-sdk/BroadcastTxResponse"; + value: BroadcastTxResponseAmino; +} +/** + * SimulateRequest is the request type for the Service.Simulate + * RPC method. + */ +export interface SimulateRequest { + /** + * tx is the transaction to simulate. + * Deprecated. Send raw tx bytes instead. + */ + /** @deprecated */ + tx?: Tx; + /** + * tx_bytes is the raw transaction. + * + * Since: cosmos-sdk 0.43 + */ + txBytes: Uint8Array; +} +export interface SimulateRequestProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.SimulateRequest"; + value: Uint8Array; +} +/** + * SimulateRequest is the request type for the Service.Simulate + * RPC method. + */ +export interface SimulateRequestAmino { + /** + * tx is the transaction to simulate. + * Deprecated. Send raw tx bytes instead. + */ + /** @deprecated */ + tx?: TxAmino; + /** + * tx_bytes is the raw transaction. + * + * Since: cosmos-sdk 0.43 + */ + tx_bytes: string; +} +export interface SimulateRequestAminoMsg { + type: "cosmos-sdk/SimulateRequest"; + value: SimulateRequestAmino; +} +/** + * SimulateResponse is the response type for the + * Service.SimulateRPC method. + */ +export interface SimulateResponse { + /** gas_info is the information about gas used in the simulation. */ + gasInfo?: GasInfo; + /** result is the result of the simulation. */ + result?: Result; +} +export interface SimulateResponseProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.SimulateResponse"; + value: Uint8Array; +} +/** + * SimulateResponse is the response type for the + * Service.SimulateRPC method. + */ +export interface SimulateResponseAmino { + /** gas_info is the information about gas used in the simulation. */ + gas_info?: GasInfoAmino; + /** result is the result of the simulation. */ + result?: ResultAmino; +} +export interface SimulateResponseAminoMsg { + type: "cosmos-sdk/SimulateResponse"; + value: SimulateResponseAmino; +} +/** + * GetTxRequest is the request type for the Service.GetTx + * RPC method. + */ +export interface GetTxRequest { + /** hash is the tx hash to query, encoded as a hex string. */ + hash: string; +} +export interface GetTxRequestProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.GetTxRequest"; + value: Uint8Array; +} +/** + * GetTxRequest is the request type for the Service.GetTx + * RPC method. + */ +export interface GetTxRequestAmino { + /** hash is the tx hash to query, encoded as a hex string. */ + hash: string; +} +export interface GetTxRequestAminoMsg { + type: "cosmos-sdk/GetTxRequest"; + value: GetTxRequestAmino; +} +/** GetTxResponse is the response type for the Service.GetTx method. */ +export interface GetTxResponse { + /** tx is the queried transaction. */ + tx?: Tx; + /** tx_response is the queried TxResponses. */ + txResponse?: TxResponse; +} +export interface GetTxResponseProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.GetTxResponse"; + value: Uint8Array; +} +/** GetTxResponse is the response type for the Service.GetTx method. */ +export interface GetTxResponseAmino { + /** tx is the queried transaction. */ + tx?: TxAmino; + /** tx_response is the queried TxResponses. */ + tx_response?: TxResponseAmino; +} +export interface GetTxResponseAminoMsg { + type: "cosmos-sdk/GetTxResponse"; + value: GetTxResponseAmino; +} +/** + * GetBlockWithTxsRequest is the request type for the Service.GetBlockWithTxs + * RPC method. + * + * Since: cosmos-sdk 0.45.2 + */ +export interface GetBlockWithTxsRequest { + /** height is the height of the block to query. */ + height: bigint; + /** pagination defines a pagination for the request. */ + pagination?: PageRequest; +} +export interface GetBlockWithTxsRequestProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.GetBlockWithTxsRequest"; + value: Uint8Array; +} +/** + * GetBlockWithTxsRequest is the request type for the Service.GetBlockWithTxs + * RPC method. + * + * Since: cosmos-sdk 0.45.2 + */ +export interface GetBlockWithTxsRequestAmino { + /** height is the height of the block to query. */ + height: string; + /** pagination defines a pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface GetBlockWithTxsRequestAminoMsg { + type: "cosmos-sdk/GetBlockWithTxsRequest"; + value: GetBlockWithTxsRequestAmino; +} +/** + * GetBlockWithTxsResponse is the response type for the Service.GetBlockWithTxs + * method. + * + * Since: cosmos-sdk 0.45.2 + */ +export interface GetBlockWithTxsResponse { + /** txs are the transactions in the block. */ + txs: Tx[]; + blockId?: BlockID; + block?: Block; + /** pagination defines a pagination for the response. */ + pagination?: PageResponse; +} +export interface GetBlockWithTxsResponseProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.GetBlockWithTxsResponse"; + value: Uint8Array; +} +/** + * GetBlockWithTxsResponse is the response type for the Service.GetBlockWithTxs + * method. + * + * Since: cosmos-sdk 0.45.2 + */ +export interface GetBlockWithTxsResponseAmino { + /** txs are the transactions in the block. */ + txs: TxAmino[]; + block_id?: BlockIDAmino; + block?: BlockAmino; + /** pagination defines a pagination for the response. */ + pagination?: PageResponseAmino; +} +export interface GetBlockWithTxsResponseAminoMsg { + type: "cosmos-sdk/GetBlockWithTxsResponse"; + value: GetBlockWithTxsResponseAmino; +} +/** + * TxDecodeRequest is the request type for the Service.TxDecode + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxDecodeRequest { + /** tx_bytes is the raw transaction. */ + txBytes: Uint8Array; +} +export interface TxDecodeRequestProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.TxDecodeRequest"; + value: Uint8Array; +} +/** + * TxDecodeRequest is the request type for the Service.TxDecode + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxDecodeRequestAmino { + /** tx_bytes is the raw transaction. */ + tx_bytes: string; +} +export interface TxDecodeRequestAminoMsg { + type: "cosmos-sdk/TxDecodeRequest"; + value: TxDecodeRequestAmino; +} +/** + * TxDecodeResponse is the response type for the + * Service.TxDecode method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxDecodeResponse { + /** tx is the decoded transaction. */ + tx?: Tx; +} +export interface TxDecodeResponseProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.TxDecodeResponse"; + value: Uint8Array; +} +/** + * TxDecodeResponse is the response type for the + * Service.TxDecode method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxDecodeResponseAmino { + /** tx is the decoded transaction. */ + tx?: TxAmino; +} +export interface TxDecodeResponseAminoMsg { + type: "cosmos-sdk/TxDecodeResponse"; + value: TxDecodeResponseAmino; +} +/** + * TxEncodeRequest is the request type for the Service.TxEncode + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxEncodeRequest { + /** tx is the transaction to encode. */ + tx?: Tx; +} +export interface TxEncodeRequestProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.TxEncodeRequest"; + value: Uint8Array; +} +/** + * TxEncodeRequest is the request type for the Service.TxEncode + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxEncodeRequestAmino { + /** tx is the transaction to encode. */ + tx?: TxAmino; +} +export interface TxEncodeRequestAminoMsg { + type: "cosmos-sdk/TxEncodeRequest"; + value: TxEncodeRequestAmino; +} +/** + * TxEncodeResponse is the response type for the + * Service.TxEncode method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxEncodeResponse { + /** tx_bytes is the encoded transaction bytes. */ + txBytes: Uint8Array; +} +export interface TxEncodeResponseProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.TxEncodeResponse"; + value: Uint8Array; +} +/** + * TxEncodeResponse is the response type for the + * Service.TxEncode method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxEncodeResponseAmino { + /** tx_bytes is the encoded transaction bytes. */ + tx_bytes: string; +} +export interface TxEncodeResponseAminoMsg { + type: "cosmos-sdk/TxEncodeResponse"; + value: TxEncodeResponseAmino; +} +/** + * TxEncodeAminoRequest is the request type for the Service.TxEncodeAmino + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxEncodeAminoRequest { + aminoJson: string; +} +export interface TxEncodeAminoRequestProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.TxEncodeAminoRequest"; + value: Uint8Array; +} +/** + * TxEncodeAminoRequest is the request type for the Service.TxEncodeAmino + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxEncodeAminoRequestAmino { + amino_json: string; +} +export interface TxEncodeAminoRequestAminoMsg { + type: "cosmos-sdk/TxEncodeAminoRequest"; + value: TxEncodeAminoRequestAmino; +} +/** + * TxEncodeAminoResponse is the response type for the Service.TxEncodeAmino + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxEncodeAminoResponse { + aminoBinary: Uint8Array; +} +export interface TxEncodeAminoResponseProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.TxEncodeAminoResponse"; + value: Uint8Array; +} +/** + * TxEncodeAminoResponse is the response type for the Service.TxEncodeAmino + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxEncodeAminoResponseAmino { + amino_binary: string; +} +export interface TxEncodeAminoResponseAminoMsg { + type: "cosmos-sdk/TxEncodeAminoResponse"; + value: TxEncodeAminoResponseAmino; +} +/** + * TxDecodeAminoRequest is the request type for the Service.TxDecodeAmino + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxDecodeAminoRequest { + aminoBinary: Uint8Array; +} +export interface TxDecodeAminoRequestProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.TxDecodeAminoRequest"; + value: Uint8Array; +} +/** + * TxDecodeAminoRequest is the request type for the Service.TxDecodeAmino + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxDecodeAminoRequestAmino { + amino_binary: string; +} +export interface TxDecodeAminoRequestAminoMsg { + type: "cosmos-sdk/TxDecodeAminoRequest"; + value: TxDecodeAminoRequestAmino; +} +/** + * TxDecodeAminoResponse is the response type for the Service.TxDecodeAmino + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxDecodeAminoResponse { + aminoJson: string; +} +export interface TxDecodeAminoResponseProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.TxDecodeAminoResponse"; + value: Uint8Array; +} +/** + * TxDecodeAminoResponse is the response type for the Service.TxDecodeAmino + * RPC method. + * + * Since: cosmos-sdk 0.47 + */ +export interface TxDecodeAminoResponseAmino { + amino_json: string; +} +export interface TxDecodeAminoResponseAminoMsg { + type: "cosmos-sdk/TxDecodeAminoResponse"; + value: TxDecodeAminoResponseAmino; +} +function createBaseGetTxsEventRequest(): GetTxsEventRequest { + return { + events: [], + pagination: undefined, + orderBy: 0, + page: BigInt(0), + limit: BigInt(0), + query: "" + }; +} +export const GetTxsEventRequest = { + typeUrl: "/cosmos.tx.v1beta1.GetTxsEventRequest", + aminoType: "cosmos-sdk/GetTxsEventRequest", + is(o: any): o is GetTxsEventRequest { + return o && (o.$typeUrl === GetTxsEventRequest.typeUrl || Array.isArray(o.events) && (!o.events.length || typeof o.events[0] === "string") && isSet(o.orderBy) && typeof o.page === "bigint" && typeof o.limit === "bigint" && typeof o.query === "string"); + }, + isAmino(o: any): o is GetTxsEventRequestAmino { + return o && (o.$typeUrl === GetTxsEventRequest.typeUrl || Array.isArray(o.events) && (!o.events.length || typeof o.events[0] === "string") && isSet(o.order_by) && typeof o.page === "bigint" && typeof o.limit === "bigint" && typeof o.query === "string"); + }, + encode(message: GetTxsEventRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.events) { + writer.uint32(10).string(v!); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + if (message.orderBy !== 0) { + writer.uint32(24).int32(message.orderBy); + } + if (message.page !== BigInt(0)) { + writer.uint32(32).uint64(message.page); + } + if (message.limit !== BigInt(0)) { + writer.uint32(40).uint64(message.limit); + } + if (message.query !== "") { + writer.uint32(50).string(message.query); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GetTxsEventRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxsEventRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.events.push(reader.string()); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + case 3: + message.orderBy = (reader.int32() as any); + break; + case 4: + message.page = reader.uint64(); + break; + case 5: + message.limit = reader.uint64(); + break; + case 6: + message.query = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): GetTxsEventRequest { + const message = createBaseGetTxsEventRequest(); + message.events = object.events?.map(e => e) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + message.orderBy = object.orderBy ?? 0; + message.page = object.page !== undefined && object.page !== null ? BigInt(object.page.toString()) : BigInt(0); + message.limit = object.limit !== undefined && object.limit !== null ? BigInt(object.limit.toString()) : BigInt(0); + message.query = object.query ?? ""; + return message; + }, + fromAmino(object: GetTxsEventRequestAmino): GetTxsEventRequest { + const message = createBaseGetTxsEventRequest(); + message.events = object.events?.map(e => e) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + if (object.order_by !== undefined && object.order_by !== null) { + message.orderBy = object.order_by; + } + if (object.page !== undefined && object.page !== null) { + message.page = BigInt(object.page); + } + if (object.limit !== undefined && object.limit !== null) { + message.limit = BigInt(object.limit); + } + if (object.query !== undefined && object.query !== null) { + message.query = object.query; + } + return message; + }, + toAmino(message: GetTxsEventRequest): GetTxsEventRequestAmino { + const obj: any = {}; + if (message.events) { + obj.events = message.events.map(e => e); + } else { + obj.events = message.events; + } + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + obj.order_by = message.orderBy === 0 ? undefined : message.orderBy; + obj.page = message.page !== BigInt(0) ? message.page?.toString() : undefined; + obj.limit = message.limit !== BigInt(0) ? message.limit?.toString() : undefined; + obj.query = message.query === "" ? undefined : message.query; + return obj; + }, + fromAminoMsg(object: GetTxsEventRequestAminoMsg): GetTxsEventRequest { + return GetTxsEventRequest.fromAmino(object.value); + }, + toAminoMsg(message: GetTxsEventRequest): GetTxsEventRequestAminoMsg { + return { + type: "cosmos-sdk/GetTxsEventRequest", + value: GetTxsEventRequest.toAmino(message) + }; + }, + fromProtoMsg(message: GetTxsEventRequestProtoMsg): GetTxsEventRequest { + return GetTxsEventRequest.decode(message.value); + }, + toProto(message: GetTxsEventRequest): Uint8Array { + return GetTxsEventRequest.encode(message).finish(); + }, + toProtoMsg(message: GetTxsEventRequest): GetTxsEventRequestProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.GetTxsEventRequest", + value: GetTxsEventRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(GetTxsEventRequest.typeUrl, GetTxsEventRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(GetTxsEventRequest.aminoType, GetTxsEventRequest.typeUrl); +function createBaseGetTxsEventResponse(): GetTxsEventResponse { + return { + txs: [], + txResponses: [], + pagination: undefined, + total: BigInt(0) + }; +} +export const GetTxsEventResponse = { + typeUrl: "/cosmos.tx.v1beta1.GetTxsEventResponse", + aminoType: "cosmos-sdk/GetTxsEventResponse", + is(o: any): o is GetTxsEventResponse { + return o && (o.$typeUrl === GetTxsEventResponse.typeUrl || Array.isArray(o.txs) && (!o.txs.length || Tx.is(o.txs[0])) && Array.isArray(o.txResponses) && (!o.txResponses.length || TxResponse.is(o.txResponses[0])) && typeof o.total === "bigint"); + }, + isAmino(o: any): o is GetTxsEventResponseAmino { + return o && (o.$typeUrl === GetTxsEventResponse.typeUrl || Array.isArray(o.txs) && (!o.txs.length || Tx.isAmino(o.txs[0])) && Array.isArray(o.tx_responses) && (!o.tx_responses.length || TxResponse.isAmino(o.tx_responses[0])) && typeof o.total === "bigint"); + }, + encode(message: GetTxsEventResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.txs) { + Tx.encode(v!, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.txResponses) { + TxResponse.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(26).fork()).ldelim(); + } + if (message.total !== BigInt(0)) { + writer.uint32(32).uint64(message.total); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GetTxsEventResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxsEventResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.txs.push(Tx.decode(reader, reader.uint32())); + break; + case 2: + message.txResponses.push(TxResponse.decode(reader, reader.uint32())); + break; + case 3: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + case 4: + message.total = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): GetTxsEventResponse { + const message = createBaseGetTxsEventResponse(); + message.txs = object.txs?.map(e => Tx.fromPartial(e)) || []; + message.txResponses = object.txResponses?.map(e => TxResponse.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + message.total = object.total !== undefined && object.total !== null ? BigInt(object.total.toString()) : BigInt(0); + return message; + }, + fromAmino(object: GetTxsEventResponseAmino): GetTxsEventResponse { + const message = createBaseGetTxsEventResponse(); + message.txs = object.txs?.map(e => Tx.fromAmino(e)) || []; + message.txResponses = object.tx_responses?.map(e => TxResponse.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + if (object.total !== undefined && object.total !== null) { + message.total = BigInt(object.total); + } + return message; + }, + toAmino(message: GetTxsEventResponse): GetTxsEventResponseAmino { + const obj: any = {}; + if (message.txs) { + obj.txs = message.txs.map(e => e ? Tx.toAmino(e) : undefined); + } else { + obj.txs = message.txs; + } + if (message.txResponses) { + obj.tx_responses = message.txResponses.map(e => e ? TxResponse.toAmino(e) : undefined); + } else { + obj.tx_responses = message.txResponses; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + obj.total = message.total !== BigInt(0) ? message.total?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: GetTxsEventResponseAminoMsg): GetTxsEventResponse { + return GetTxsEventResponse.fromAmino(object.value); + }, + toAminoMsg(message: GetTxsEventResponse): GetTxsEventResponseAminoMsg { + return { + type: "cosmos-sdk/GetTxsEventResponse", + value: GetTxsEventResponse.toAmino(message) + }; + }, + fromProtoMsg(message: GetTxsEventResponseProtoMsg): GetTxsEventResponse { + return GetTxsEventResponse.decode(message.value); + }, + toProto(message: GetTxsEventResponse): Uint8Array { + return GetTxsEventResponse.encode(message).finish(); + }, + toProtoMsg(message: GetTxsEventResponse): GetTxsEventResponseProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.GetTxsEventResponse", + value: GetTxsEventResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(GetTxsEventResponse.typeUrl, GetTxsEventResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(GetTxsEventResponse.aminoType, GetTxsEventResponse.typeUrl); +function createBaseBroadcastTxRequest(): BroadcastTxRequest { + return { + txBytes: new Uint8Array(), + mode: 0 + }; +} +export const BroadcastTxRequest = { + typeUrl: "/cosmos.tx.v1beta1.BroadcastTxRequest", + aminoType: "cosmos-sdk/BroadcastTxRequest", + is(o: any): o is BroadcastTxRequest { + return o && (o.$typeUrl === BroadcastTxRequest.typeUrl || (o.txBytes instanceof Uint8Array || typeof o.txBytes === "string") && isSet(o.mode)); + }, + isAmino(o: any): o is BroadcastTxRequestAmino { + return o && (o.$typeUrl === BroadcastTxRequest.typeUrl || (o.tx_bytes instanceof Uint8Array || typeof o.tx_bytes === "string") && isSet(o.mode)); + }, + encode(message: BroadcastTxRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.txBytes.length !== 0) { + writer.uint32(10).bytes(message.txBytes); + } + if (message.mode !== 0) { + writer.uint32(16).int32(message.mode); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): BroadcastTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBroadcastTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.txBytes = reader.bytes(); + break; + case 2: + message.mode = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): BroadcastTxRequest { + const message = createBaseBroadcastTxRequest(); + message.txBytes = object.txBytes ?? new Uint8Array(); + message.mode = object.mode ?? 0; + return message; + }, + fromAmino(object: BroadcastTxRequestAmino): BroadcastTxRequest { + const message = createBaseBroadcastTxRequest(); + if (object.tx_bytes !== undefined && object.tx_bytes !== null) { + message.txBytes = bytesFromBase64(object.tx_bytes); + } + if (object.mode !== undefined && object.mode !== null) { + message.mode = object.mode; + } + return message; + }, + toAmino(message: BroadcastTxRequest): BroadcastTxRequestAmino { + const obj: any = {}; + obj.tx_bytes = message.txBytes ? base64FromBytes(message.txBytes) : undefined; + obj.mode = message.mode === 0 ? undefined : message.mode; + return obj; + }, + fromAminoMsg(object: BroadcastTxRequestAminoMsg): BroadcastTxRequest { + return BroadcastTxRequest.fromAmino(object.value); + }, + toAminoMsg(message: BroadcastTxRequest): BroadcastTxRequestAminoMsg { + return { + type: "cosmos-sdk/BroadcastTxRequest", + value: BroadcastTxRequest.toAmino(message) + }; + }, + fromProtoMsg(message: BroadcastTxRequestProtoMsg): BroadcastTxRequest { + return BroadcastTxRequest.decode(message.value); + }, + toProto(message: BroadcastTxRequest): Uint8Array { + return BroadcastTxRequest.encode(message).finish(); + }, + toProtoMsg(message: BroadcastTxRequest): BroadcastTxRequestProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.BroadcastTxRequest", + value: BroadcastTxRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(BroadcastTxRequest.typeUrl, BroadcastTxRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(BroadcastTxRequest.aminoType, BroadcastTxRequest.typeUrl); +function createBaseBroadcastTxResponse(): BroadcastTxResponse { + return { + txResponse: undefined + }; +} +export const BroadcastTxResponse = { + typeUrl: "/cosmos.tx.v1beta1.BroadcastTxResponse", + aminoType: "cosmos-sdk/BroadcastTxResponse", + is(o: any): o is BroadcastTxResponse { + return o && o.$typeUrl === BroadcastTxResponse.typeUrl; + }, + isAmino(o: any): o is BroadcastTxResponseAmino { + return o && o.$typeUrl === BroadcastTxResponse.typeUrl; + }, + encode(message: BroadcastTxResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.txResponse !== undefined) { + TxResponse.encode(message.txResponse, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): BroadcastTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBroadcastTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.txResponse = TxResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): BroadcastTxResponse { + const message = createBaseBroadcastTxResponse(); + message.txResponse = object.txResponse !== undefined && object.txResponse !== null ? TxResponse.fromPartial(object.txResponse) : undefined; + return message; + }, + fromAmino(object: BroadcastTxResponseAmino): BroadcastTxResponse { + const message = createBaseBroadcastTxResponse(); + if (object.tx_response !== undefined && object.tx_response !== null) { + message.txResponse = TxResponse.fromAmino(object.tx_response); + } + return message; + }, + toAmino(message: BroadcastTxResponse): BroadcastTxResponseAmino { + const obj: any = {}; + obj.tx_response = message.txResponse ? TxResponse.toAmino(message.txResponse) : undefined; + return obj; + }, + fromAminoMsg(object: BroadcastTxResponseAminoMsg): BroadcastTxResponse { + return BroadcastTxResponse.fromAmino(object.value); + }, + toAminoMsg(message: BroadcastTxResponse): BroadcastTxResponseAminoMsg { + return { + type: "cosmos-sdk/BroadcastTxResponse", + value: BroadcastTxResponse.toAmino(message) + }; + }, + fromProtoMsg(message: BroadcastTxResponseProtoMsg): BroadcastTxResponse { + return BroadcastTxResponse.decode(message.value); + }, + toProto(message: BroadcastTxResponse): Uint8Array { + return BroadcastTxResponse.encode(message).finish(); + }, + toProtoMsg(message: BroadcastTxResponse): BroadcastTxResponseProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.BroadcastTxResponse", + value: BroadcastTxResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(BroadcastTxResponse.typeUrl, BroadcastTxResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(BroadcastTxResponse.aminoType, BroadcastTxResponse.typeUrl); +function createBaseSimulateRequest(): SimulateRequest { + return { + tx: undefined, + txBytes: new Uint8Array() + }; +} +export const SimulateRequest = { + typeUrl: "/cosmos.tx.v1beta1.SimulateRequest", + aminoType: "cosmos-sdk/SimulateRequest", + is(o: any): o is SimulateRequest { + return o && (o.$typeUrl === SimulateRequest.typeUrl || o.txBytes instanceof Uint8Array || typeof o.txBytes === "string"); + }, + isAmino(o: any): o is SimulateRequestAmino { + return o && (o.$typeUrl === SimulateRequest.typeUrl || o.tx_bytes instanceof Uint8Array || typeof o.tx_bytes === "string"); + }, + encode(message: SimulateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.tx !== undefined) { + Tx.encode(message.tx, writer.uint32(10).fork()).ldelim(); + } + if (message.txBytes.length !== 0) { + writer.uint32(18).bytes(message.txBytes); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SimulateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSimulateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.tx = Tx.decode(reader, reader.uint32()); + break; + case 2: + message.txBytes = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SimulateRequest { + const message = createBaseSimulateRequest(); + message.tx = object.tx !== undefined && object.tx !== null ? Tx.fromPartial(object.tx) : undefined; + message.txBytes = object.txBytes ?? new Uint8Array(); + return message; + }, + fromAmino(object: SimulateRequestAmino): SimulateRequest { + const message = createBaseSimulateRequest(); + if (object.tx !== undefined && object.tx !== null) { + message.tx = Tx.fromAmino(object.tx); + } + if (object.tx_bytes !== undefined && object.tx_bytes !== null) { + message.txBytes = bytesFromBase64(object.tx_bytes); + } + return message; + }, + toAmino(message: SimulateRequest): SimulateRequestAmino { + const obj: any = {}; + obj.tx = message.tx ? Tx.toAmino(message.tx) : undefined; + obj.tx_bytes = message.txBytes ? base64FromBytes(message.txBytes) : undefined; + return obj; + }, + fromAminoMsg(object: SimulateRequestAminoMsg): SimulateRequest { + return SimulateRequest.fromAmino(object.value); + }, + toAminoMsg(message: SimulateRequest): SimulateRequestAminoMsg { + return { + type: "cosmos-sdk/SimulateRequest", + value: SimulateRequest.toAmino(message) + }; + }, + fromProtoMsg(message: SimulateRequestProtoMsg): SimulateRequest { + return SimulateRequest.decode(message.value); + }, + toProto(message: SimulateRequest): Uint8Array { + return SimulateRequest.encode(message).finish(); + }, + toProtoMsg(message: SimulateRequest): SimulateRequestProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.SimulateRequest", + value: SimulateRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(SimulateRequest.typeUrl, SimulateRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(SimulateRequest.aminoType, SimulateRequest.typeUrl); +function createBaseSimulateResponse(): SimulateResponse { + return { + gasInfo: undefined, + result: undefined + }; +} +export const SimulateResponse = { + typeUrl: "/cosmos.tx.v1beta1.SimulateResponse", + aminoType: "cosmos-sdk/SimulateResponse", + is(o: any): o is SimulateResponse { + return o && o.$typeUrl === SimulateResponse.typeUrl; + }, + isAmino(o: any): o is SimulateResponseAmino { + return o && o.$typeUrl === SimulateResponse.typeUrl; + }, + encode(message: SimulateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.gasInfo !== undefined) { + GasInfo.encode(message.gasInfo, writer.uint32(10).fork()).ldelim(); + } + if (message.result !== undefined) { + Result.encode(message.result, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SimulateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSimulateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.gasInfo = GasInfo.decode(reader, reader.uint32()); + break; + case 2: + message.result = Result.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SimulateResponse { + const message = createBaseSimulateResponse(); + message.gasInfo = object.gasInfo !== undefined && object.gasInfo !== null ? GasInfo.fromPartial(object.gasInfo) : undefined; + message.result = object.result !== undefined && object.result !== null ? Result.fromPartial(object.result) : undefined; + return message; + }, + fromAmino(object: SimulateResponseAmino): SimulateResponse { + const message = createBaseSimulateResponse(); + if (object.gas_info !== undefined && object.gas_info !== null) { + message.gasInfo = GasInfo.fromAmino(object.gas_info); + } + if (object.result !== undefined && object.result !== null) { + message.result = Result.fromAmino(object.result); + } + return message; + }, + toAmino(message: SimulateResponse): SimulateResponseAmino { + const obj: any = {}; + obj.gas_info = message.gasInfo ? GasInfo.toAmino(message.gasInfo) : undefined; + obj.result = message.result ? Result.toAmino(message.result) : undefined; + return obj; + }, + fromAminoMsg(object: SimulateResponseAminoMsg): SimulateResponse { + return SimulateResponse.fromAmino(object.value); + }, + toAminoMsg(message: SimulateResponse): SimulateResponseAminoMsg { + return { + type: "cosmos-sdk/SimulateResponse", + value: SimulateResponse.toAmino(message) + }; + }, + fromProtoMsg(message: SimulateResponseProtoMsg): SimulateResponse { + return SimulateResponse.decode(message.value); + }, + toProto(message: SimulateResponse): Uint8Array { + return SimulateResponse.encode(message).finish(); + }, + toProtoMsg(message: SimulateResponse): SimulateResponseProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.SimulateResponse", + value: SimulateResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(SimulateResponse.typeUrl, SimulateResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(SimulateResponse.aminoType, SimulateResponse.typeUrl); +function createBaseGetTxRequest(): GetTxRequest { + return { + hash: "" + }; +} +export const GetTxRequest = { + typeUrl: "/cosmos.tx.v1beta1.GetTxRequest", + aminoType: "cosmos-sdk/GetTxRequest", + is(o: any): o is GetTxRequest { + return o && (o.$typeUrl === GetTxRequest.typeUrl || typeof o.hash === "string"); + }, + isAmino(o: any): o is GetTxRequestAmino { + return o && (o.$typeUrl === GetTxRequest.typeUrl || typeof o.hash === "string"); + }, + encode(message: GetTxRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.hash !== "") { + writer.uint32(10).string(message.hash); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GetTxRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hash = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): GetTxRequest { + const message = createBaseGetTxRequest(); + message.hash = object.hash ?? ""; + return message; + }, + fromAmino(object: GetTxRequestAmino): GetTxRequest { + const message = createBaseGetTxRequest(); + if (object.hash !== undefined && object.hash !== null) { + message.hash = object.hash; + } + return message; + }, + toAmino(message: GetTxRequest): GetTxRequestAmino { + const obj: any = {}; + obj.hash = message.hash === "" ? undefined : message.hash; + return obj; + }, + fromAminoMsg(object: GetTxRequestAminoMsg): GetTxRequest { + return GetTxRequest.fromAmino(object.value); + }, + toAminoMsg(message: GetTxRequest): GetTxRequestAminoMsg { + return { + type: "cosmos-sdk/GetTxRequest", + value: GetTxRequest.toAmino(message) + }; + }, + fromProtoMsg(message: GetTxRequestProtoMsg): GetTxRequest { + return GetTxRequest.decode(message.value); + }, + toProto(message: GetTxRequest): Uint8Array { + return GetTxRequest.encode(message).finish(); + }, + toProtoMsg(message: GetTxRequest): GetTxRequestProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.GetTxRequest", + value: GetTxRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(GetTxRequest.typeUrl, GetTxRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(GetTxRequest.aminoType, GetTxRequest.typeUrl); +function createBaseGetTxResponse(): GetTxResponse { + return { + tx: undefined, + txResponse: undefined + }; +} +export const GetTxResponse = { + typeUrl: "/cosmos.tx.v1beta1.GetTxResponse", + aminoType: "cosmos-sdk/GetTxResponse", + is(o: any): o is GetTxResponse { + return o && o.$typeUrl === GetTxResponse.typeUrl; + }, + isAmino(o: any): o is GetTxResponseAmino { + return o && o.$typeUrl === GetTxResponse.typeUrl; + }, + encode(message: GetTxResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.tx !== undefined) { + Tx.encode(message.tx, writer.uint32(10).fork()).ldelim(); + } + if (message.txResponse !== undefined) { + TxResponse.encode(message.txResponse, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GetTxResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetTxResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.tx = Tx.decode(reader, reader.uint32()); + break; + case 2: + message.txResponse = TxResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): GetTxResponse { + const message = createBaseGetTxResponse(); + message.tx = object.tx !== undefined && object.tx !== null ? Tx.fromPartial(object.tx) : undefined; + message.txResponse = object.txResponse !== undefined && object.txResponse !== null ? TxResponse.fromPartial(object.txResponse) : undefined; + return message; + }, + fromAmino(object: GetTxResponseAmino): GetTxResponse { + const message = createBaseGetTxResponse(); + if (object.tx !== undefined && object.tx !== null) { + message.tx = Tx.fromAmino(object.tx); + } + if (object.tx_response !== undefined && object.tx_response !== null) { + message.txResponse = TxResponse.fromAmino(object.tx_response); + } + return message; + }, + toAmino(message: GetTxResponse): GetTxResponseAmino { + const obj: any = {}; + obj.tx = message.tx ? Tx.toAmino(message.tx) : undefined; + obj.tx_response = message.txResponse ? TxResponse.toAmino(message.txResponse) : undefined; + return obj; + }, + fromAminoMsg(object: GetTxResponseAminoMsg): GetTxResponse { + return GetTxResponse.fromAmino(object.value); + }, + toAminoMsg(message: GetTxResponse): GetTxResponseAminoMsg { + return { + type: "cosmos-sdk/GetTxResponse", + value: GetTxResponse.toAmino(message) + }; + }, + fromProtoMsg(message: GetTxResponseProtoMsg): GetTxResponse { + return GetTxResponse.decode(message.value); + }, + toProto(message: GetTxResponse): Uint8Array { + return GetTxResponse.encode(message).finish(); + }, + toProtoMsg(message: GetTxResponse): GetTxResponseProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.GetTxResponse", + value: GetTxResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(GetTxResponse.typeUrl, GetTxResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(GetTxResponse.aminoType, GetTxResponse.typeUrl); +function createBaseGetBlockWithTxsRequest(): GetBlockWithTxsRequest { + return { + height: BigInt(0), + pagination: undefined + }; +} +export const GetBlockWithTxsRequest = { + typeUrl: "/cosmos.tx.v1beta1.GetBlockWithTxsRequest", + aminoType: "cosmos-sdk/GetBlockWithTxsRequest", + is(o: any): o is GetBlockWithTxsRequest { + return o && (o.$typeUrl === GetBlockWithTxsRequest.typeUrl || typeof o.height === "bigint"); + }, + isAmino(o: any): o is GetBlockWithTxsRequestAmino { + return o && (o.$typeUrl === GetBlockWithTxsRequest.typeUrl || typeof o.height === "bigint"); + }, + encode(message: GetBlockWithTxsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { + writer.uint32(8).int64(message.height); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GetBlockWithTxsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetBlockWithTxsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.int64(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): GetBlockWithTxsRequest { + const message = createBaseGetBlockWithTxsRequest(); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: GetBlockWithTxsRequestAmino): GetBlockWithTxsRequest { + const message = createBaseGetBlockWithTxsRequest(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: GetBlockWithTxsRequest): GetBlockWithTxsRequestAmino { + const obj: any = {}; + obj.height = message.height !== BigInt(0) ? message.height?.toString() : undefined; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: GetBlockWithTxsRequestAminoMsg): GetBlockWithTxsRequest { + return GetBlockWithTxsRequest.fromAmino(object.value); + }, + toAminoMsg(message: GetBlockWithTxsRequest): GetBlockWithTxsRequestAminoMsg { + return { + type: "cosmos-sdk/GetBlockWithTxsRequest", + value: GetBlockWithTxsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: GetBlockWithTxsRequestProtoMsg): GetBlockWithTxsRequest { + return GetBlockWithTxsRequest.decode(message.value); + }, + toProto(message: GetBlockWithTxsRequest): Uint8Array { + return GetBlockWithTxsRequest.encode(message).finish(); + }, + toProtoMsg(message: GetBlockWithTxsRequest): GetBlockWithTxsRequestProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.GetBlockWithTxsRequest", + value: GetBlockWithTxsRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(GetBlockWithTxsRequest.typeUrl, GetBlockWithTxsRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(GetBlockWithTxsRequest.aminoType, GetBlockWithTxsRequest.typeUrl); +function createBaseGetBlockWithTxsResponse(): GetBlockWithTxsResponse { + return { + txs: [], + blockId: undefined, + block: undefined, + pagination: undefined + }; +} +export const GetBlockWithTxsResponse = { + typeUrl: "/cosmos.tx.v1beta1.GetBlockWithTxsResponse", + aminoType: "cosmos-sdk/GetBlockWithTxsResponse", + is(o: any): o is GetBlockWithTxsResponse { + return o && (o.$typeUrl === GetBlockWithTxsResponse.typeUrl || Array.isArray(o.txs) && (!o.txs.length || Tx.is(o.txs[0]))); + }, + isAmino(o: any): o is GetBlockWithTxsResponseAmino { + return o && (o.$typeUrl === GetBlockWithTxsResponse.typeUrl || Array.isArray(o.txs) && (!o.txs.length || Tx.isAmino(o.txs[0]))); + }, + encode(message: GetBlockWithTxsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.txs) { + Tx.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(18).fork()).ldelim(); + } + if (message.block !== undefined) { + Block.encode(message.block, writer.uint32(26).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GetBlockWithTxsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGetBlockWithTxsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.txs.push(Tx.decode(reader, reader.uint32())); + break; + case 2: + message.blockId = BlockID.decode(reader, reader.uint32()); + break; + case 3: + message.block = Block.decode(reader, reader.uint32()); + break; + case 4: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): GetBlockWithTxsResponse { + const message = createBaseGetBlockWithTxsResponse(); + message.txs = object.txs?.map(e => Tx.fromPartial(e)) || []; + message.blockId = object.blockId !== undefined && object.blockId !== null ? BlockID.fromPartial(object.blockId) : undefined; + message.block = object.block !== undefined && object.block !== null ? Block.fromPartial(object.block) : undefined; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: GetBlockWithTxsResponseAmino): GetBlockWithTxsResponse { + const message = createBaseGetBlockWithTxsResponse(); + message.txs = object.txs?.map(e => Tx.fromAmino(e)) || []; + if (object.block_id !== undefined && object.block_id !== null) { + message.blockId = BlockID.fromAmino(object.block_id); + } + if (object.block !== undefined && object.block !== null) { + message.block = Block.fromAmino(object.block); + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: GetBlockWithTxsResponse): GetBlockWithTxsResponseAmino { + const obj: any = {}; + if (message.txs) { + obj.txs = message.txs.map(e => e ? Tx.toAmino(e) : undefined); + } else { + obj.txs = message.txs; + } + obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; + obj.block = message.block ? Block.toAmino(message.block) : undefined; + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: GetBlockWithTxsResponseAminoMsg): GetBlockWithTxsResponse { + return GetBlockWithTxsResponse.fromAmino(object.value); + }, + toAminoMsg(message: GetBlockWithTxsResponse): GetBlockWithTxsResponseAminoMsg { + return { + type: "cosmos-sdk/GetBlockWithTxsResponse", + value: GetBlockWithTxsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: GetBlockWithTxsResponseProtoMsg): GetBlockWithTxsResponse { + return GetBlockWithTxsResponse.decode(message.value); + }, + toProto(message: GetBlockWithTxsResponse): Uint8Array { + return GetBlockWithTxsResponse.encode(message).finish(); + }, + toProtoMsg(message: GetBlockWithTxsResponse): GetBlockWithTxsResponseProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.GetBlockWithTxsResponse", + value: GetBlockWithTxsResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(GetBlockWithTxsResponse.typeUrl, GetBlockWithTxsResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(GetBlockWithTxsResponse.aminoType, GetBlockWithTxsResponse.typeUrl); +function createBaseTxDecodeRequest(): TxDecodeRequest { + return { + txBytes: new Uint8Array() + }; +} +export const TxDecodeRequest = { + typeUrl: "/cosmos.tx.v1beta1.TxDecodeRequest", + aminoType: "cosmos-sdk/TxDecodeRequest", + is(o: any): o is TxDecodeRequest { + return o && (o.$typeUrl === TxDecodeRequest.typeUrl || o.txBytes instanceof Uint8Array || typeof o.txBytes === "string"); + }, + isAmino(o: any): o is TxDecodeRequestAmino { + return o && (o.$typeUrl === TxDecodeRequest.typeUrl || o.tx_bytes instanceof Uint8Array || typeof o.tx_bytes === "string"); + }, + encode(message: TxDecodeRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.txBytes.length !== 0) { + writer.uint32(10).bytes(message.txBytes); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TxDecodeRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxDecodeRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.txBytes = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): TxDecodeRequest { + const message = createBaseTxDecodeRequest(); + message.txBytes = object.txBytes ?? new Uint8Array(); + return message; + }, + fromAmino(object: TxDecodeRequestAmino): TxDecodeRequest { + const message = createBaseTxDecodeRequest(); + if (object.tx_bytes !== undefined && object.tx_bytes !== null) { + message.txBytes = bytesFromBase64(object.tx_bytes); + } + return message; + }, + toAmino(message: TxDecodeRequest): TxDecodeRequestAmino { + const obj: any = {}; + obj.tx_bytes = message.txBytes ? base64FromBytes(message.txBytes) : undefined; + return obj; + }, + fromAminoMsg(object: TxDecodeRequestAminoMsg): TxDecodeRequest { + return TxDecodeRequest.fromAmino(object.value); + }, + toAminoMsg(message: TxDecodeRequest): TxDecodeRequestAminoMsg { + return { + type: "cosmos-sdk/TxDecodeRequest", + value: TxDecodeRequest.toAmino(message) + }; + }, + fromProtoMsg(message: TxDecodeRequestProtoMsg): TxDecodeRequest { + return TxDecodeRequest.decode(message.value); + }, + toProto(message: TxDecodeRequest): Uint8Array { + return TxDecodeRequest.encode(message).finish(); + }, + toProtoMsg(message: TxDecodeRequest): TxDecodeRequestProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.TxDecodeRequest", + value: TxDecodeRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(TxDecodeRequest.typeUrl, TxDecodeRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(TxDecodeRequest.aminoType, TxDecodeRequest.typeUrl); +function createBaseTxDecodeResponse(): TxDecodeResponse { + return { + tx: undefined + }; +} +export const TxDecodeResponse = { + typeUrl: "/cosmos.tx.v1beta1.TxDecodeResponse", + aminoType: "cosmos-sdk/TxDecodeResponse", + is(o: any): o is TxDecodeResponse { + return o && o.$typeUrl === TxDecodeResponse.typeUrl; + }, + isAmino(o: any): o is TxDecodeResponseAmino { + return o && o.$typeUrl === TxDecodeResponse.typeUrl; + }, + encode(message: TxDecodeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.tx !== undefined) { + Tx.encode(message.tx, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TxDecodeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxDecodeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.tx = Tx.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): TxDecodeResponse { + const message = createBaseTxDecodeResponse(); + message.tx = object.tx !== undefined && object.tx !== null ? Tx.fromPartial(object.tx) : undefined; + return message; + }, + fromAmino(object: TxDecodeResponseAmino): TxDecodeResponse { + const message = createBaseTxDecodeResponse(); + if (object.tx !== undefined && object.tx !== null) { + message.tx = Tx.fromAmino(object.tx); + } + return message; + }, + toAmino(message: TxDecodeResponse): TxDecodeResponseAmino { + const obj: any = {}; + obj.tx = message.tx ? Tx.toAmino(message.tx) : undefined; + return obj; + }, + fromAminoMsg(object: TxDecodeResponseAminoMsg): TxDecodeResponse { + return TxDecodeResponse.fromAmino(object.value); + }, + toAminoMsg(message: TxDecodeResponse): TxDecodeResponseAminoMsg { + return { + type: "cosmos-sdk/TxDecodeResponse", + value: TxDecodeResponse.toAmino(message) + }; + }, + fromProtoMsg(message: TxDecodeResponseProtoMsg): TxDecodeResponse { + return TxDecodeResponse.decode(message.value); + }, + toProto(message: TxDecodeResponse): Uint8Array { + return TxDecodeResponse.encode(message).finish(); + }, + toProtoMsg(message: TxDecodeResponse): TxDecodeResponseProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.TxDecodeResponse", + value: TxDecodeResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(TxDecodeResponse.typeUrl, TxDecodeResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(TxDecodeResponse.aminoType, TxDecodeResponse.typeUrl); +function createBaseTxEncodeRequest(): TxEncodeRequest { + return { + tx: undefined + }; +} +export const TxEncodeRequest = { + typeUrl: "/cosmos.tx.v1beta1.TxEncodeRequest", + aminoType: "cosmos-sdk/TxEncodeRequest", + is(o: any): o is TxEncodeRequest { + return o && o.$typeUrl === TxEncodeRequest.typeUrl; + }, + isAmino(o: any): o is TxEncodeRequestAmino { + return o && o.$typeUrl === TxEncodeRequest.typeUrl; + }, + encode(message: TxEncodeRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.tx !== undefined) { + Tx.encode(message.tx, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TxEncodeRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxEncodeRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.tx = Tx.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): TxEncodeRequest { + const message = createBaseTxEncodeRequest(); + message.tx = object.tx !== undefined && object.tx !== null ? Tx.fromPartial(object.tx) : undefined; + return message; + }, + fromAmino(object: TxEncodeRequestAmino): TxEncodeRequest { + const message = createBaseTxEncodeRequest(); + if (object.tx !== undefined && object.tx !== null) { + message.tx = Tx.fromAmino(object.tx); + } + return message; + }, + toAmino(message: TxEncodeRequest): TxEncodeRequestAmino { + const obj: any = {}; + obj.tx = message.tx ? Tx.toAmino(message.tx) : undefined; + return obj; + }, + fromAminoMsg(object: TxEncodeRequestAminoMsg): TxEncodeRequest { + return TxEncodeRequest.fromAmino(object.value); + }, + toAminoMsg(message: TxEncodeRequest): TxEncodeRequestAminoMsg { + return { + type: "cosmos-sdk/TxEncodeRequest", + value: TxEncodeRequest.toAmino(message) + }; + }, + fromProtoMsg(message: TxEncodeRequestProtoMsg): TxEncodeRequest { + return TxEncodeRequest.decode(message.value); + }, + toProto(message: TxEncodeRequest): Uint8Array { + return TxEncodeRequest.encode(message).finish(); + }, + toProtoMsg(message: TxEncodeRequest): TxEncodeRequestProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.TxEncodeRequest", + value: TxEncodeRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(TxEncodeRequest.typeUrl, TxEncodeRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(TxEncodeRequest.aminoType, TxEncodeRequest.typeUrl); +function createBaseTxEncodeResponse(): TxEncodeResponse { + return { + txBytes: new Uint8Array() + }; +} +export const TxEncodeResponse = { + typeUrl: "/cosmos.tx.v1beta1.TxEncodeResponse", + aminoType: "cosmos-sdk/TxEncodeResponse", + is(o: any): o is TxEncodeResponse { + return o && (o.$typeUrl === TxEncodeResponse.typeUrl || o.txBytes instanceof Uint8Array || typeof o.txBytes === "string"); + }, + isAmino(o: any): o is TxEncodeResponseAmino { + return o && (o.$typeUrl === TxEncodeResponse.typeUrl || o.tx_bytes instanceof Uint8Array || typeof o.tx_bytes === "string"); + }, + encode(message: TxEncodeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.txBytes.length !== 0) { + writer.uint32(10).bytes(message.txBytes); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TxEncodeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxEncodeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.txBytes = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): TxEncodeResponse { + const message = createBaseTxEncodeResponse(); + message.txBytes = object.txBytes ?? new Uint8Array(); + return message; + }, + fromAmino(object: TxEncodeResponseAmino): TxEncodeResponse { + const message = createBaseTxEncodeResponse(); + if (object.tx_bytes !== undefined && object.tx_bytes !== null) { + message.txBytes = bytesFromBase64(object.tx_bytes); + } + return message; + }, + toAmino(message: TxEncodeResponse): TxEncodeResponseAmino { + const obj: any = {}; + obj.tx_bytes = message.txBytes ? base64FromBytes(message.txBytes) : undefined; + return obj; + }, + fromAminoMsg(object: TxEncodeResponseAminoMsg): TxEncodeResponse { + return TxEncodeResponse.fromAmino(object.value); + }, + toAminoMsg(message: TxEncodeResponse): TxEncodeResponseAminoMsg { + return { + type: "cosmos-sdk/TxEncodeResponse", + value: TxEncodeResponse.toAmino(message) + }; + }, + fromProtoMsg(message: TxEncodeResponseProtoMsg): TxEncodeResponse { + return TxEncodeResponse.decode(message.value); + }, + toProto(message: TxEncodeResponse): Uint8Array { + return TxEncodeResponse.encode(message).finish(); + }, + toProtoMsg(message: TxEncodeResponse): TxEncodeResponseProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.TxEncodeResponse", + value: TxEncodeResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(TxEncodeResponse.typeUrl, TxEncodeResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(TxEncodeResponse.aminoType, TxEncodeResponse.typeUrl); +function createBaseTxEncodeAminoRequest(): TxEncodeAminoRequest { + return { + aminoJson: "" + }; +} +export const TxEncodeAminoRequest = { + typeUrl: "/cosmos.tx.v1beta1.TxEncodeAminoRequest", + aminoType: "cosmos-sdk/TxEncodeAminoRequest", + is(o: any): o is TxEncodeAminoRequest { + return o && (o.$typeUrl === TxEncodeAminoRequest.typeUrl || typeof o.aminoJson === "string"); + }, + isAmino(o: any): o is TxEncodeAminoRequestAmino { + return o && (o.$typeUrl === TxEncodeAminoRequest.typeUrl || typeof o.amino_json === "string"); + }, + encode(message: TxEncodeAminoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.aminoJson !== "") { + writer.uint32(10).string(message.aminoJson); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TxEncodeAminoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxEncodeAminoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.aminoJson = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): TxEncodeAminoRequest { + const message = createBaseTxEncodeAminoRequest(); + message.aminoJson = object.aminoJson ?? ""; + return message; + }, + fromAmino(object: TxEncodeAminoRequestAmino): TxEncodeAminoRequest { + const message = createBaseTxEncodeAminoRequest(); + if (object.amino_json !== undefined && object.amino_json !== null) { + message.aminoJson = object.amino_json; + } + return message; + }, + toAmino(message: TxEncodeAminoRequest): TxEncodeAminoRequestAmino { + const obj: any = {}; + obj.amino_json = message.aminoJson === "" ? undefined : message.aminoJson; + return obj; + }, + fromAminoMsg(object: TxEncodeAminoRequestAminoMsg): TxEncodeAminoRequest { + return TxEncodeAminoRequest.fromAmino(object.value); + }, + toAminoMsg(message: TxEncodeAminoRequest): TxEncodeAminoRequestAminoMsg { + return { + type: "cosmos-sdk/TxEncodeAminoRequest", + value: TxEncodeAminoRequest.toAmino(message) + }; + }, + fromProtoMsg(message: TxEncodeAminoRequestProtoMsg): TxEncodeAminoRequest { + return TxEncodeAminoRequest.decode(message.value); + }, + toProto(message: TxEncodeAminoRequest): Uint8Array { + return TxEncodeAminoRequest.encode(message).finish(); + }, + toProtoMsg(message: TxEncodeAminoRequest): TxEncodeAminoRequestProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.TxEncodeAminoRequest", + value: TxEncodeAminoRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(TxEncodeAminoRequest.typeUrl, TxEncodeAminoRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(TxEncodeAminoRequest.aminoType, TxEncodeAminoRequest.typeUrl); +function createBaseTxEncodeAminoResponse(): TxEncodeAminoResponse { + return { + aminoBinary: new Uint8Array() + }; +} +export const TxEncodeAminoResponse = { + typeUrl: "/cosmos.tx.v1beta1.TxEncodeAminoResponse", + aminoType: "cosmos-sdk/TxEncodeAminoResponse", + is(o: any): o is TxEncodeAminoResponse { + return o && (o.$typeUrl === TxEncodeAminoResponse.typeUrl || o.aminoBinary instanceof Uint8Array || typeof o.aminoBinary === "string"); + }, + isAmino(o: any): o is TxEncodeAminoResponseAmino { + return o && (o.$typeUrl === TxEncodeAminoResponse.typeUrl || o.amino_binary instanceof Uint8Array || typeof o.amino_binary === "string"); + }, + encode(message: TxEncodeAminoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.aminoBinary.length !== 0) { + writer.uint32(10).bytes(message.aminoBinary); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TxEncodeAminoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxEncodeAminoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.aminoBinary = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): TxEncodeAminoResponse { + const message = createBaseTxEncodeAminoResponse(); + message.aminoBinary = object.aminoBinary ?? new Uint8Array(); + return message; + }, + fromAmino(object: TxEncodeAminoResponseAmino): TxEncodeAminoResponse { + const message = createBaseTxEncodeAminoResponse(); + if (object.amino_binary !== undefined && object.amino_binary !== null) { + message.aminoBinary = bytesFromBase64(object.amino_binary); + } + return message; + }, + toAmino(message: TxEncodeAminoResponse): TxEncodeAminoResponseAmino { + const obj: any = {}; + obj.amino_binary = message.aminoBinary ? base64FromBytes(message.aminoBinary) : undefined; + return obj; + }, + fromAminoMsg(object: TxEncodeAminoResponseAminoMsg): TxEncodeAminoResponse { + return TxEncodeAminoResponse.fromAmino(object.value); + }, + toAminoMsg(message: TxEncodeAminoResponse): TxEncodeAminoResponseAminoMsg { + return { + type: "cosmos-sdk/TxEncodeAminoResponse", + value: TxEncodeAminoResponse.toAmino(message) + }; + }, + fromProtoMsg(message: TxEncodeAminoResponseProtoMsg): TxEncodeAminoResponse { + return TxEncodeAminoResponse.decode(message.value); + }, + toProto(message: TxEncodeAminoResponse): Uint8Array { + return TxEncodeAminoResponse.encode(message).finish(); + }, + toProtoMsg(message: TxEncodeAminoResponse): TxEncodeAminoResponseProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.TxEncodeAminoResponse", + value: TxEncodeAminoResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(TxEncodeAminoResponse.typeUrl, TxEncodeAminoResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(TxEncodeAminoResponse.aminoType, TxEncodeAminoResponse.typeUrl); +function createBaseTxDecodeAminoRequest(): TxDecodeAminoRequest { + return { + aminoBinary: new Uint8Array() + }; +} +export const TxDecodeAminoRequest = { + typeUrl: "/cosmos.tx.v1beta1.TxDecodeAminoRequest", + aminoType: "cosmos-sdk/TxDecodeAminoRequest", + is(o: any): o is TxDecodeAminoRequest { + return o && (o.$typeUrl === TxDecodeAminoRequest.typeUrl || o.aminoBinary instanceof Uint8Array || typeof o.aminoBinary === "string"); + }, + isAmino(o: any): o is TxDecodeAminoRequestAmino { + return o && (o.$typeUrl === TxDecodeAminoRequest.typeUrl || o.amino_binary instanceof Uint8Array || typeof o.amino_binary === "string"); + }, + encode(message: TxDecodeAminoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.aminoBinary.length !== 0) { + writer.uint32(10).bytes(message.aminoBinary); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TxDecodeAminoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxDecodeAminoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.aminoBinary = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): TxDecodeAminoRequest { + const message = createBaseTxDecodeAminoRequest(); + message.aminoBinary = object.aminoBinary ?? new Uint8Array(); + return message; + }, + fromAmino(object: TxDecodeAminoRequestAmino): TxDecodeAminoRequest { + const message = createBaseTxDecodeAminoRequest(); + if (object.amino_binary !== undefined && object.amino_binary !== null) { + message.aminoBinary = bytesFromBase64(object.amino_binary); + } + return message; + }, + toAmino(message: TxDecodeAminoRequest): TxDecodeAminoRequestAmino { + const obj: any = {}; + obj.amino_binary = message.aminoBinary ? base64FromBytes(message.aminoBinary) : undefined; + return obj; + }, + fromAminoMsg(object: TxDecodeAminoRequestAminoMsg): TxDecodeAminoRequest { + return TxDecodeAminoRequest.fromAmino(object.value); + }, + toAminoMsg(message: TxDecodeAminoRequest): TxDecodeAminoRequestAminoMsg { + return { + type: "cosmos-sdk/TxDecodeAminoRequest", + value: TxDecodeAminoRequest.toAmino(message) + }; + }, + fromProtoMsg(message: TxDecodeAminoRequestProtoMsg): TxDecodeAminoRequest { + return TxDecodeAminoRequest.decode(message.value); + }, + toProto(message: TxDecodeAminoRequest): Uint8Array { + return TxDecodeAminoRequest.encode(message).finish(); + }, + toProtoMsg(message: TxDecodeAminoRequest): TxDecodeAminoRequestProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.TxDecodeAminoRequest", + value: TxDecodeAminoRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(TxDecodeAminoRequest.typeUrl, TxDecodeAminoRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(TxDecodeAminoRequest.aminoType, TxDecodeAminoRequest.typeUrl); +function createBaseTxDecodeAminoResponse(): TxDecodeAminoResponse { + return { + aminoJson: "" + }; +} +export const TxDecodeAminoResponse = { + typeUrl: "/cosmos.tx.v1beta1.TxDecodeAminoResponse", + aminoType: "cosmos-sdk/TxDecodeAminoResponse", + is(o: any): o is TxDecodeAminoResponse { + return o && (o.$typeUrl === TxDecodeAminoResponse.typeUrl || typeof o.aminoJson === "string"); + }, + isAmino(o: any): o is TxDecodeAminoResponseAmino { + return o && (o.$typeUrl === TxDecodeAminoResponse.typeUrl || typeof o.amino_json === "string"); + }, + encode(message: TxDecodeAminoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.aminoJson !== "") { + writer.uint32(10).string(message.aminoJson); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TxDecodeAminoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxDecodeAminoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.aminoJson = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): TxDecodeAminoResponse { + const message = createBaseTxDecodeAminoResponse(); + message.aminoJson = object.aminoJson ?? ""; + return message; + }, + fromAmino(object: TxDecodeAminoResponseAmino): TxDecodeAminoResponse { + const message = createBaseTxDecodeAminoResponse(); + if (object.amino_json !== undefined && object.amino_json !== null) { + message.aminoJson = object.amino_json; + } + return message; + }, + toAmino(message: TxDecodeAminoResponse): TxDecodeAminoResponseAmino { + const obj: any = {}; + obj.amino_json = message.aminoJson === "" ? undefined : message.aminoJson; + return obj; + }, + fromAminoMsg(object: TxDecodeAminoResponseAminoMsg): TxDecodeAminoResponse { + return TxDecodeAminoResponse.fromAmino(object.value); + }, + toAminoMsg(message: TxDecodeAminoResponse): TxDecodeAminoResponseAminoMsg { + return { + type: "cosmos-sdk/TxDecodeAminoResponse", + value: TxDecodeAminoResponse.toAmino(message) + }; + }, + fromProtoMsg(message: TxDecodeAminoResponseProtoMsg): TxDecodeAminoResponse { + return TxDecodeAminoResponse.decode(message.value); + }, + toProto(message: TxDecodeAminoResponse): Uint8Array { + return TxDecodeAminoResponse.encode(message).finish(); + }, + toProtoMsg(message: TxDecodeAminoResponse): TxDecodeAminoResponseProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.TxDecodeAminoResponse", + value: TxDecodeAminoResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(TxDecodeAminoResponse.typeUrl, TxDecodeAminoResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(TxDecodeAminoResponse.aminoType, TxDecodeAminoResponse.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/tx/v1beta1/tx.ts b/libs/interchain-query/src/cosmos/tx/v1beta1/tx.ts new file mode 100644 index 00000000..6e8614bb --- /dev/null +++ b/libs/interchain-query/src/cosmos/tx/v1beta1/tx.ts @@ -0,0 +1,2029 @@ +import { Any, AnyAmino } from "../../../google/protobuf/any"; +import { SignMode } from "../signing/v1beta1/signing"; +import { CompactBitArray, CompactBitArrayAmino } from "../../crypto/multisig/v1beta1/multisig"; +import { Coin, CoinAmino } from "../../base/v1beta1/coin"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes, isSet } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; +/** Tx is the standard type used for broadcasting transactions. */ +export interface Tx { + /** body is the processable content of the transaction */ + body?: TxBody; + /** + * auth_info is the authorization related content of the transaction, + * specifically signers, signer modes and fee + */ + authInfo?: AuthInfo; + /** + * signatures is a list of signatures that matches the length and order of + * AuthInfo's signer_infos to allow connecting signature meta information like + * public key and signing mode by position. + */ + signatures: Uint8Array[]; +} +export interface TxProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.Tx"; + value: Uint8Array; +} +/** Tx is the standard type used for broadcasting transactions. */ +export interface TxAmino { + /** body is the processable content of the transaction */ + body?: TxBodyAmino; + /** + * auth_info is the authorization related content of the transaction, + * specifically signers, signer modes and fee + */ + auth_info?: AuthInfoAmino; + /** + * signatures is a list of signatures that matches the length and order of + * AuthInfo's signer_infos to allow connecting signature meta information like + * public key and signing mode by position. + */ + signatures: string[]; +} +export interface TxAminoMsg { + type: "cosmos-sdk/Tx"; + value: TxAmino; +} +/** + * TxRaw is a variant of Tx that pins the signer's exact binary representation + * of body and auth_info. This is used for signing, broadcasting and + * verification. The binary `serialize(tx: TxRaw)` is stored in Tendermint and + * the hash `sha256(serialize(tx: TxRaw))` becomes the "txhash", commonly used + * as the transaction ID. + */ +export interface TxRaw { + /** + * body_bytes is a protobuf serialization of a TxBody that matches the + * representation in SignDoc. + */ + bodyBytes: Uint8Array; + /** + * auth_info_bytes is a protobuf serialization of an AuthInfo that matches the + * representation in SignDoc. + */ + authInfoBytes: Uint8Array; + /** + * signatures is a list of signatures that matches the length and order of + * AuthInfo's signer_infos to allow connecting signature meta information like + * public key and signing mode by position. + */ + signatures: Uint8Array[]; +} +export interface TxRawProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.TxRaw"; + value: Uint8Array; +} +/** + * TxRaw is a variant of Tx that pins the signer's exact binary representation + * of body and auth_info. This is used for signing, broadcasting and + * verification. The binary `serialize(tx: TxRaw)` is stored in Tendermint and + * the hash `sha256(serialize(tx: TxRaw))` becomes the "txhash", commonly used + * as the transaction ID. + */ +export interface TxRawAmino { + /** + * body_bytes is a protobuf serialization of a TxBody that matches the + * representation in SignDoc. + */ + body_bytes: string; + /** + * auth_info_bytes is a protobuf serialization of an AuthInfo that matches the + * representation in SignDoc. + */ + auth_info_bytes: string; + /** + * signatures is a list of signatures that matches the length and order of + * AuthInfo's signer_infos to allow connecting signature meta information like + * public key and signing mode by position. + */ + signatures: string[]; +} +export interface TxRawAminoMsg { + type: "cosmos-sdk/TxRaw"; + value: TxRawAmino; +} +/** SignDoc is the type used for generating sign bytes for SIGN_MODE_DIRECT. */ +export interface SignDoc { + /** + * body_bytes is protobuf serialization of a TxBody that matches the + * representation in TxRaw. + */ + bodyBytes: Uint8Array; + /** + * auth_info_bytes is a protobuf serialization of an AuthInfo that matches the + * representation in TxRaw. + */ + authInfoBytes: Uint8Array; + /** + * chain_id is the unique identifier of the chain this transaction targets. + * It prevents signed transactions from being used on another chain by an + * attacker + */ + chainId: string; + /** account_number is the account number of the account in state */ + accountNumber: bigint; +} +export interface SignDocProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.SignDoc"; + value: Uint8Array; +} +/** SignDoc is the type used for generating sign bytes for SIGN_MODE_DIRECT. */ +export interface SignDocAmino { + /** + * body_bytes is protobuf serialization of a TxBody that matches the + * representation in TxRaw. + */ + body_bytes: string; + /** + * auth_info_bytes is a protobuf serialization of an AuthInfo that matches the + * representation in TxRaw. + */ + auth_info_bytes: string; + /** + * chain_id is the unique identifier of the chain this transaction targets. + * It prevents signed transactions from being used on another chain by an + * attacker + */ + chain_id: string; + /** account_number is the account number of the account in state */ + account_number: string; +} +export interface SignDocAminoMsg { + type: "cosmos-sdk/SignDoc"; + value: SignDocAmino; +} +/** + * SignDocDirectAux is the type used for generating sign bytes for + * SIGN_MODE_DIRECT_AUX. + * + * Since: cosmos-sdk 0.46 + */ +export interface SignDocDirectAux { + /** + * body_bytes is protobuf serialization of a TxBody that matches the + * representation in TxRaw. + */ + bodyBytes: Uint8Array; + /** public_key is the public key of the signing account. */ + publicKey?: Any; + /** + * chain_id is the identifier of the chain this transaction targets. + * It prevents signed transactions from being used on another chain by an + * attacker. + */ + chainId: string; + /** account_number is the account number of the account in state. */ + accountNumber: bigint; + /** sequence is the sequence number of the signing account. */ + sequence: bigint; + /** tips have been depreacted and should not be used */ + /** @deprecated */ + tip?: Tip; +} +export interface SignDocDirectAuxProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.SignDocDirectAux"; + value: Uint8Array; +} +/** + * SignDocDirectAux is the type used for generating sign bytes for + * SIGN_MODE_DIRECT_AUX. + * + * Since: cosmos-sdk 0.46 + */ +export interface SignDocDirectAuxAmino { + /** + * body_bytes is protobuf serialization of a TxBody that matches the + * representation in TxRaw. + */ + body_bytes: string; + /** public_key is the public key of the signing account. */ + public_key?: AnyAmino; + /** + * chain_id is the identifier of the chain this transaction targets. + * It prevents signed transactions from being used on another chain by an + * attacker. + */ + chain_id: string; + /** account_number is the account number of the account in state. */ + account_number: string; + /** sequence is the sequence number of the signing account. */ + sequence: string; + /** tips have been depreacted and should not be used */ + /** @deprecated */ + tip?: TipAmino; +} +export interface SignDocDirectAuxAminoMsg { + type: "cosmos-sdk/SignDocDirectAux"; + value: SignDocDirectAuxAmino; +} +/** TxBody is the body of a transaction that all signers sign over. */ +export interface TxBody { + /** + * messages is a list of messages to be executed. The required signers of + * those messages define the number and order of elements in AuthInfo's + * signer_infos and Tx's signatures. Each required signer address is added to + * the list only the first time it occurs. + * By convention, the first required signer (usually from the first message) + * is referred to as the primary signer and pays the fee for the whole + * transaction. + */ + messages: Any[]; + /** + * memo is any arbitrary note/comment to be added to the transaction. + * WARNING: in clients, any publicly exposed text should not be called memo, + * but should be called `note` instead (see https://github.com/cosmos/cosmos-sdk/issues/9122). + */ + memo: string; + /** + * timeout is the block height after which this transaction will not + * be processed by the chain + */ + timeoutHeight: bigint; + /** + * extension_options are arbitrary options that can be added by chains + * when the default options are not sufficient. If any of these are present + * and can't be handled, the transaction will be rejected + */ + extensionOptions: Any[]; + /** + * extension_options are arbitrary options that can be added by chains + * when the default options are not sufficient. If any of these are present + * and can't be handled, they will be ignored + */ + nonCriticalExtensionOptions: Any[]; +} +export interface TxBodyProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.TxBody"; + value: Uint8Array; +} +/** TxBody is the body of a transaction that all signers sign over. */ +export interface TxBodyAmino { + /** + * messages is a list of messages to be executed. The required signers of + * those messages define the number and order of elements in AuthInfo's + * signer_infos and Tx's signatures. Each required signer address is added to + * the list only the first time it occurs. + * By convention, the first required signer (usually from the first message) + * is referred to as the primary signer and pays the fee for the whole + * transaction. + */ + messages: AnyAmino[]; + /** + * memo is any arbitrary note/comment to be added to the transaction. + * WARNING: in clients, any publicly exposed text should not be called memo, + * but should be called `note` instead (see https://github.com/cosmos/cosmos-sdk/issues/9122). + */ + memo: string; + /** + * timeout is the block height after which this transaction will not + * be processed by the chain + */ + timeout_height: string; + /** + * extension_options are arbitrary options that can be added by chains + * when the default options are not sufficient. If any of these are present + * and can't be handled, the transaction will be rejected + */ + extension_options: AnyAmino[]; + /** + * extension_options are arbitrary options that can be added by chains + * when the default options are not sufficient. If any of these are present + * and can't be handled, they will be ignored + */ + non_critical_extension_options: AnyAmino[]; +} +export interface TxBodyAminoMsg { + type: "cosmos-sdk/TxBody"; + value: TxBodyAmino; +} +/** + * AuthInfo describes the fee and signer modes that are used to sign a + * transaction. + */ +export interface AuthInfo { + /** + * signer_infos defines the signing modes for the required signers. The number + * and order of elements must match the required signers from TxBody's + * messages. The first element is the primary signer and the one which pays + * the fee. + */ + signerInfos: SignerInfo[]; + /** + * Fee is the fee and gas limit for the transaction. The first signer is the + * primary signer and the one which pays the fee. The fee can be calculated + * based on the cost of evaluating the body and doing signature verification + * of the signers. This can be estimated via simulation. + */ + fee?: Fee; + /** + * Tip is the optional tip used for transactions fees paid in another denom. + * + * This field is ignored if the chain didn't enable tips, i.e. didn't add the + * `TipDecorator` in its posthandler. + * + * Since: cosmos-sdk 0.46 + */ + /** @deprecated */ + tip?: Tip; +} +export interface AuthInfoProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.AuthInfo"; + value: Uint8Array; +} +/** + * AuthInfo describes the fee and signer modes that are used to sign a + * transaction. + */ +export interface AuthInfoAmino { + /** + * signer_infos defines the signing modes for the required signers. The number + * and order of elements must match the required signers from TxBody's + * messages. The first element is the primary signer and the one which pays + * the fee. + */ + signer_infos: SignerInfoAmino[]; + /** + * Fee is the fee and gas limit for the transaction. The first signer is the + * primary signer and the one which pays the fee. The fee can be calculated + * based on the cost of evaluating the body and doing signature verification + * of the signers. This can be estimated via simulation. + */ + fee?: FeeAmino; + /** + * Tip is the optional tip used for transactions fees paid in another denom. + * + * This field is ignored if the chain didn't enable tips, i.e. didn't add the + * `TipDecorator` in its posthandler. + * + * Since: cosmos-sdk 0.46 + */ + /** @deprecated */ + tip?: TipAmino; +} +export interface AuthInfoAminoMsg { + type: "cosmos-sdk/AuthInfo"; + value: AuthInfoAmino; +} +/** + * SignerInfo describes the public key and signing mode of a single top-level + * signer. + */ +export interface SignerInfo { + /** + * public_key is the public key of the signer. It is optional for accounts + * that already exist in state. If unset, the verifier can use the required \ + * signer address for this position and lookup the public key. + */ + publicKey?: Any; + /** + * mode_info describes the signing mode of the signer and is a nested + * structure to support nested multisig pubkey's + */ + modeInfo?: ModeInfo; + /** + * sequence is the sequence of the account, which describes the + * number of committed transactions signed by a given address. It is used to + * prevent replay attacks. + */ + sequence: bigint; +} +export interface SignerInfoProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.SignerInfo"; + value: Uint8Array; +} +/** + * SignerInfo describes the public key and signing mode of a single top-level + * signer. + */ +export interface SignerInfoAmino { + /** + * public_key is the public key of the signer. It is optional for accounts + * that already exist in state. If unset, the verifier can use the required \ + * signer address for this position and lookup the public key. + */ + public_key?: AnyAmino; + /** + * mode_info describes the signing mode of the signer and is a nested + * structure to support nested multisig pubkey's + */ + mode_info?: ModeInfoAmino; + /** + * sequence is the sequence of the account, which describes the + * number of committed transactions signed by a given address. It is used to + * prevent replay attacks. + */ + sequence: string; +} +export interface SignerInfoAminoMsg { + type: "cosmos-sdk/SignerInfo"; + value: SignerInfoAmino; +} +/** ModeInfo describes the signing mode of a single or nested multisig signer. */ +export interface ModeInfo { + /** single represents a single signer */ + single?: ModeInfo_Single; + /** multi represents a nested multisig signer */ + multi?: ModeInfo_Multi; +} +export interface ModeInfoProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.ModeInfo"; + value: Uint8Array; +} +/** ModeInfo describes the signing mode of a single or nested multisig signer. */ +export interface ModeInfoAmino { + /** single represents a single signer */ + single?: ModeInfo_SingleAmino; + /** multi represents a nested multisig signer */ + multi?: ModeInfo_MultiAmino; +} +export interface ModeInfoAminoMsg { + type: "cosmos-sdk/ModeInfo"; + value: ModeInfoAmino; +} +/** + * Single is the mode info for a single signer. It is structured as a message + * to allow for additional fields such as locale for SIGN_MODE_TEXTUAL in the + * future + */ +export interface ModeInfo_Single { + /** mode is the signing mode of the single signer */ + mode: SignMode; +} +export interface ModeInfo_SingleProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.Single"; + value: Uint8Array; +} +/** + * Single is the mode info for a single signer. It is structured as a message + * to allow for additional fields such as locale for SIGN_MODE_TEXTUAL in the + * future + */ +export interface ModeInfo_SingleAmino { + /** mode is the signing mode of the single signer */ + mode: SignMode; +} +export interface ModeInfo_SingleAminoMsg { + type: "cosmos-sdk/Single"; + value: ModeInfo_SingleAmino; +} +/** Multi is the mode info for a multisig public key */ +export interface ModeInfo_Multi { + /** bitarray specifies which keys within the multisig are signing */ + bitarray?: CompactBitArray; + /** + * mode_infos is the corresponding modes of the signers of the multisig + * which could include nested multisig public keys + */ + modeInfos: ModeInfo[]; +} +export interface ModeInfo_MultiProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.Multi"; + value: Uint8Array; +} +/** Multi is the mode info for a multisig public key */ +export interface ModeInfo_MultiAmino { + /** bitarray specifies which keys within the multisig are signing */ + bitarray?: CompactBitArrayAmino; + /** + * mode_infos is the corresponding modes of the signers of the multisig + * which could include nested multisig public keys + */ + mode_infos: ModeInfoAmino[]; +} +export interface ModeInfo_MultiAminoMsg { + type: "cosmos-sdk/Multi"; + value: ModeInfo_MultiAmino; +} +/** + * Fee includes the amount of coins paid in fees and the maximum + * gas to be used by the transaction. The ratio yields an effective "gasprice", + * which must be above some miminum to be accepted into the mempool. + */ +export interface Fee { + /** amount is the amount of coins to be paid as a fee */ + amount: Coin[]; + /** + * gas_limit is the maximum gas that can be used in transaction processing + * before an out of gas error occurs + */ + gasLimit: bigint; + /** + * if unset, the first signer is responsible for paying the fees. If set, the specified account must pay the fees. + * the payer must be a tx signer (and thus have signed this field in AuthInfo). + * setting this field does *not* change the ordering of required signers for the transaction. + */ + payer: string; + /** + * if set, the fee payer (either the first signer or the value of the payer field) requests that a fee grant be used + * to pay fees instead of the fee payer's own balance. If an appropriate fee grant does not exist or the chain does + * not support fee grants, this will fail + */ + granter: string; +} +export interface FeeProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.Fee"; + value: Uint8Array; +} +/** + * Fee includes the amount of coins paid in fees and the maximum + * gas to be used by the transaction. The ratio yields an effective "gasprice", + * which must be above some miminum to be accepted into the mempool. + */ +export interface FeeAmino { + /** amount is the amount of coins to be paid as a fee */ + amount: CoinAmino[]; + /** + * gas_limit is the maximum gas that can be used in transaction processing + * before an out of gas error occurs + */ + gas_limit: string; + /** + * if unset, the first signer is responsible for paying the fees. If set, the specified account must pay the fees. + * the payer must be a tx signer (and thus have signed this field in AuthInfo). + * setting this field does *not* change the ordering of required signers for the transaction. + */ + payer: string; + /** + * if set, the fee payer (either the first signer or the value of the payer field) requests that a fee grant be used + * to pay fees instead of the fee payer's own balance. If an appropriate fee grant does not exist or the chain does + * not support fee grants, this will fail + */ + granter: string; +} +export interface FeeAminoMsg { + type: "cosmos-sdk/Fee"; + value: FeeAmino; +} +/** + * Tip is the tip used for meta-transactions. + * + * Since: cosmos-sdk 0.46 + */ +/** @deprecated */ +export interface Tip { + /** amount is the amount of the tip */ + amount: Coin[]; + /** tipper is the address of the account paying for the tip */ + tipper: string; +} +export interface TipProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.Tip"; + value: Uint8Array; +} +/** + * Tip is the tip used for meta-transactions. + * + * Since: cosmos-sdk 0.46 + */ +/** @deprecated */ +export interface TipAmino { + /** amount is the amount of the tip */ + amount: CoinAmino[]; + /** tipper is the address of the account paying for the tip */ + tipper: string; +} +export interface TipAminoMsg { + type: "cosmos-sdk/Tip"; + value: TipAmino; +} +/** + * AuxSignerData is the intermediary format that an auxiliary signer (e.g. a + * tipper) builds and sends to the fee payer (who will build and broadcast the + * actual tx). AuxSignerData is not a valid tx in itself, and will be rejected + * by the node if sent directly as-is. + * + * Since: cosmos-sdk 0.46 + */ +export interface AuxSignerData { + /** + * address is the bech32-encoded address of the auxiliary signer. If using + * AuxSignerData across different chains, the bech32 prefix of the target + * chain (where the final transaction is broadcasted) should be used. + */ + address: string; + /** + * sign_doc is the SIGN_MODE_DIRECT_AUX sign doc that the auxiliary signer + * signs. Note: we use the same sign doc even if we're signing with + * LEGACY_AMINO_JSON. + */ + signDoc?: SignDocDirectAux; + /** mode is the signing mode of the single signer. */ + mode: SignMode; + /** sig is the signature of the sign doc. */ + sig: Uint8Array; +} +export interface AuxSignerDataProtoMsg { + typeUrl: "/cosmos.tx.v1beta1.AuxSignerData"; + value: Uint8Array; +} +/** + * AuxSignerData is the intermediary format that an auxiliary signer (e.g. a + * tipper) builds and sends to the fee payer (who will build and broadcast the + * actual tx). AuxSignerData is not a valid tx in itself, and will be rejected + * by the node if sent directly as-is. + * + * Since: cosmos-sdk 0.46 + */ +export interface AuxSignerDataAmino { + /** + * address is the bech32-encoded address of the auxiliary signer. If using + * AuxSignerData across different chains, the bech32 prefix of the target + * chain (where the final transaction is broadcasted) should be used. + */ + address: string; + /** + * sign_doc is the SIGN_MODE_DIRECT_AUX sign doc that the auxiliary signer + * signs. Note: we use the same sign doc even if we're signing with + * LEGACY_AMINO_JSON. + */ + sign_doc?: SignDocDirectAuxAmino; + /** mode is the signing mode of the single signer. */ + mode: SignMode; + /** sig is the signature of the sign doc. */ + sig: string; +} +export interface AuxSignerDataAminoMsg { + type: "cosmos-sdk/AuxSignerData"; + value: AuxSignerDataAmino; +} +function createBaseTx(): Tx { + return { + body: undefined, + authInfo: undefined, + signatures: [] + }; +} +export const Tx = { + typeUrl: "/cosmos.tx.v1beta1.Tx", + aminoType: "cosmos-sdk/Tx", + is(o: any): o is Tx { + return o && (o.$typeUrl === Tx.typeUrl || Array.isArray(o.signatures) && (!o.signatures.length || o.signatures[0] instanceof Uint8Array || typeof o.signatures[0] === "string")); + }, + isAmino(o: any): o is TxAmino { + return o && (o.$typeUrl === Tx.typeUrl || Array.isArray(o.signatures) && (!o.signatures.length || o.signatures[0] instanceof Uint8Array || typeof o.signatures[0] === "string")); + }, + encode(message: Tx, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.body !== undefined) { + TxBody.encode(message.body, writer.uint32(10).fork()).ldelim(); + } + if (message.authInfo !== undefined) { + AuthInfo.encode(message.authInfo, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.signatures) { + writer.uint32(26).bytes(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Tx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.body = TxBody.decode(reader, reader.uint32()); + break; + case 2: + message.authInfo = AuthInfo.decode(reader, reader.uint32()); + break; + case 3: + message.signatures.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Tx { + const message = createBaseTx(); + message.body = object.body !== undefined && object.body !== null ? TxBody.fromPartial(object.body) : undefined; + message.authInfo = object.authInfo !== undefined && object.authInfo !== null ? AuthInfo.fromPartial(object.authInfo) : undefined; + message.signatures = object.signatures?.map(e => e) || []; + return message; + }, + fromAmino(object: TxAmino): Tx { + const message = createBaseTx(); + if (object.body !== undefined && object.body !== null) { + message.body = TxBody.fromAmino(object.body); + } + if (object.auth_info !== undefined && object.auth_info !== null) { + message.authInfo = AuthInfo.fromAmino(object.auth_info); + } + message.signatures = object.signatures?.map(e => bytesFromBase64(e)) || []; + return message; + }, + toAmino(message: Tx): TxAmino { + const obj: any = {}; + obj.body = message.body ? TxBody.toAmino(message.body) : undefined; + obj.auth_info = message.authInfo ? AuthInfo.toAmino(message.authInfo) : undefined; + if (message.signatures) { + obj.signatures = message.signatures.map(e => base64FromBytes(e)); + } else { + obj.signatures = message.signatures; + } + return obj; + }, + fromAminoMsg(object: TxAminoMsg): Tx { + return Tx.fromAmino(object.value); + }, + toAminoMsg(message: Tx): TxAminoMsg { + return { + type: "cosmos-sdk/Tx", + value: Tx.toAmino(message) + }; + }, + fromProtoMsg(message: TxProtoMsg): Tx { + return Tx.decode(message.value); + }, + toProto(message: Tx): Uint8Array { + return Tx.encode(message).finish(); + }, + toProtoMsg(message: Tx): TxProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.Tx", + value: Tx.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Tx.typeUrl, Tx); +GlobalDecoderRegistry.registerAminoProtoMapping(Tx.aminoType, Tx.typeUrl); +function createBaseTxRaw(): TxRaw { + return { + bodyBytes: new Uint8Array(), + authInfoBytes: new Uint8Array(), + signatures: [] + }; +} +export const TxRaw = { + typeUrl: "/cosmos.tx.v1beta1.TxRaw", + aminoType: "cosmos-sdk/TxRaw", + is(o: any): o is TxRaw { + return o && (o.$typeUrl === TxRaw.typeUrl || (o.bodyBytes instanceof Uint8Array || typeof o.bodyBytes === "string") && (o.authInfoBytes instanceof Uint8Array || typeof o.authInfoBytes === "string") && Array.isArray(o.signatures) && (!o.signatures.length || o.signatures[0] instanceof Uint8Array || typeof o.signatures[0] === "string")); + }, + isAmino(o: any): o is TxRawAmino { + return o && (o.$typeUrl === TxRaw.typeUrl || (o.body_bytes instanceof Uint8Array || typeof o.body_bytes === "string") && (o.auth_info_bytes instanceof Uint8Array || typeof o.auth_info_bytes === "string") && Array.isArray(o.signatures) && (!o.signatures.length || o.signatures[0] instanceof Uint8Array || typeof o.signatures[0] === "string")); + }, + encode(message: TxRaw, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.bodyBytes.length !== 0) { + writer.uint32(10).bytes(message.bodyBytes); + } + if (message.authInfoBytes.length !== 0) { + writer.uint32(18).bytes(message.authInfoBytes); + } + for (const v of message.signatures) { + writer.uint32(26).bytes(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TxRaw { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxRaw(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bodyBytes = reader.bytes(); + break; + case 2: + message.authInfoBytes = reader.bytes(); + break; + case 3: + message.signatures.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): TxRaw { + const message = createBaseTxRaw(); + message.bodyBytes = object.bodyBytes ?? new Uint8Array(); + message.authInfoBytes = object.authInfoBytes ?? new Uint8Array(); + message.signatures = object.signatures?.map(e => e) || []; + return message; + }, + fromAmino(object: TxRawAmino): TxRaw { + const message = createBaseTxRaw(); + if (object.body_bytes !== undefined && object.body_bytes !== null) { + message.bodyBytes = bytesFromBase64(object.body_bytes); + } + if (object.auth_info_bytes !== undefined && object.auth_info_bytes !== null) { + message.authInfoBytes = bytesFromBase64(object.auth_info_bytes); + } + message.signatures = object.signatures?.map(e => bytesFromBase64(e)) || []; + return message; + }, + toAmino(message: TxRaw): TxRawAmino { + const obj: any = {}; + obj.body_bytes = message.bodyBytes ? base64FromBytes(message.bodyBytes) : undefined; + obj.auth_info_bytes = message.authInfoBytes ? base64FromBytes(message.authInfoBytes) : undefined; + if (message.signatures) { + obj.signatures = message.signatures.map(e => base64FromBytes(e)); + } else { + obj.signatures = message.signatures; + } + return obj; + }, + fromAminoMsg(object: TxRawAminoMsg): TxRaw { + return TxRaw.fromAmino(object.value); + }, + toAminoMsg(message: TxRaw): TxRawAminoMsg { + return { + type: "cosmos-sdk/TxRaw", + value: TxRaw.toAmino(message) + }; + }, + fromProtoMsg(message: TxRawProtoMsg): TxRaw { + return TxRaw.decode(message.value); + }, + toProto(message: TxRaw): Uint8Array { + return TxRaw.encode(message).finish(); + }, + toProtoMsg(message: TxRaw): TxRawProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.TxRaw", + value: TxRaw.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(TxRaw.typeUrl, TxRaw); +GlobalDecoderRegistry.registerAminoProtoMapping(TxRaw.aminoType, TxRaw.typeUrl); +function createBaseSignDoc(): SignDoc { + return { + bodyBytes: new Uint8Array(), + authInfoBytes: new Uint8Array(), + chainId: "", + accountNumber: BigInt(0) + }; +} +export const SignDoc = { + typeUrl: "/cosmos.tx.v1beta1.SignDoc", + aminoType: "cosmos-sdk/SignDoc", + is(o: any): o is SignDoc { + return o && (o.$typeUrl === SignDoc.typeUrl || (o.bodyBytes instanceof Uint8Array || typeof o.bodyBytes === "string") && (o.authInfoBytes instanceof Uint8Array || typeof o.authInfoBytes === "string") && typeof o.chainId === "string" && typeof o.accountNumber === "bigint"); + }, + isAmino(o: any): o is SignDocAmino { + return o && (o.$typeUrl === SignDoc.typeUrl || (o.body_bytes instanceof Uint8Array || typeof o.body_bytes === "string") && (o.auth_info_bytes instanceof Uint8Array || typeof o.auth_info_bytes === "string") && typeof o.chain_id === "string" && typeof o.account_number === "bigint"); + }, + encode(message: SignDoc, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.bodyBytes.length !== 0) { + writer.uint32(10).bytes(message.bodyBytes); + } + if (message.authInfoBytes.length !== 0) { + writer.uint32(18).bytes(message.authInfoBytes); + } + if (message.chainId !== "") { + writer.uint32(26).string(message.chainId); + } + if (message.accountNumber !== BigInt(0)) { + writer.uint32(32).uint64(message.accountNumber); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SignDoc { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignDoc(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bodyBytes = reader.bytes(); + break; + case 2: + message.authInfoBytes = reader.bytes(); + break; + case 3: + message.chainId = reader.string(); + break; + case 4: + message.accountNumber = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SignDoc { + const message = createBaseSignDoc(); + message.bodyBytes = object.bodyBytes ?? new Uint8Array(); + message.authInfoBytes = object.authInfoBytes ?? new Uint8Array(); + message.chainId = object.chainId ?? ""; + message.accountNumber = object.accountNumber !== undefined && object.accountNumber !== null ? BigInt(object.accountNumber.toString()) : BigInt(0); + return message; + }, + fromAmino(object: SignDocAmino): SignDoc { + const message = createBaseSignDoc(); + if (object.body_bytes !== undefined && object.body_bytes !== null) { + message.bodyBytes = bytesFromBase64(object.body_bytes); + } + if (object.auth_info_bytes !== undefined && object.auth_info_bytes !== null) { + message.authInfoBytes = bytesFromBase64(object.auth_info_bytes); + } + if (object.chain_id !== undefined && object.chain_id !== null) { + message.chainId = object.chain_id; + } + if (object.account_number !== undefined && object.account_number !== null) { + message.accountNumber = BigInt(object.account_number); + } + return message; + }, + toAmino(message: SignDoc): SignDocAmino { + const obj: any = {}; + obj.body_bytes = message.bodyBytes ? base64FromBytes(message.bodyBytes) : undefined; + obj.auth_info_bytes = message.authInfoBytes ? base64FromBytes(message.authInfoBytes) : undefined; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; + obj.account_number = message.accountNumber !== BigInt(0) ? message.accountNumber?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: SignDocAminoMsg): SignDoc { + return SignDoc.fromAmino(object.value); + }, + toAminoMsg(message: SignDoc): SignDocAminoMsg { + return { + type: "cosmos-sdk/SignDoc", + value: SignDoc.toAmino(message) + }; + }, + fromProtoMsg(message: SignDocProtoMsg): SignDoc { + return SignDoc.decode(message.value); + }, + toProto(message: SignDoc): Uint8Array { + return SignDoc.encode(message).finish(); + }, + toProtoMsg(message: SignDoc): SignDocProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.SignDoc", + value: SignDoc.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(SignDoc.typeUrl, SignDoc); +GlobalDecoderRegistry.registerAminoProtoMapping(SignDoc.aminoType, SignDoc.typeUrl); +function createBaseSignDocDirectAux(): SignDocDirectAux { + return { + bodyBytes: new Uint8Array(), + publicKey: undefined, + chainId: "", + accountNumber: BigInt(0), + sequence: BigInt(0), + tip: undefined + }; +} +export const SignDocDirectAux = { + typeUrl: "/cosmos.tx.v1beta1.SignDocDirectAux", + aminoType: "cosmos-sdk/SignDocDirectAux", + is(o: any): o is SignDocDirectAux { + return o && (o.$typeUrl === SignDocDirectAux.typeUrl || (o.bodyBytes instanceof Uint8Array || typeof o.bodyBytes === "string") && typeof o.chainId === "string" && typeof o.accountNumber === "bigint" && typeof o.sequence === "bigint"); + }, + isAmino(o: any): o is SignDocDirectAuxAmino { + return o && (o.$typeUrl === SignDocDirectAux.typeUrl || (o.body_bytes instanceof Uint8Array || typeof o.body_bytes === "string") && typeof o.chain_id === "string" && typeof o.account_number === "bigint" && typeof o.sequence === "bigint"); + }, + encode(message: SignDocDirectAux, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.bodyBytes.length !== 0) { + writer.uint32(10).bytes(message.bodyBytes); + } + if (message.publicKey !== undefined) { + Any.encode(message.publicKey, writer.uint32(18).fork()).ldelim(); + } + if (message.chainId !== "") { + writer.uint32(26).string(message.chainId); + } + if (message.accountNumber !== BigInt(0)) { + writer.uint32(32).uint64(message.accountNumber); + } + if (message.sequence !== BigInt(0)) { + writer.uint32(40).uint64(message.sequence); + } + if (message.tip !== undefined) { + Tip.encode(message.tip, writer.uint32(50).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SignDocDirectAux { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignDocDirectAux(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bodyBytes = reader.bytes(); + break; + case 2: + message.publicKey = Any.decode(reader, reader.uint32()); + break; + case 3: + message.chainId = reader.string(); + break; + case 4: + message.accountNumber = reader.uint64(); + break; + case 5: + message.sequence = reader.uint64(); + break; + case 6: + message.tip = Tip.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SignDocDirectAux { + const message = createBaseSignDocDirectAux(); + message.bodyBytes = object.bodyBytes ?? new Uint8Array(); + message.publicKey = object.publicKey !== undefined && object.publicKey !== null ? Any.fromPartial(object.publicKey) : undefined; + message.chainId = object.chainId ?? ""; + message.accountNumber = object.accountNumber !== undefined && object.accountNumber !== null ? BigInt(object.accountNumber.toString()) : BigInt(0); + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + message.tip = object.tip !== undefined && object.tip !== null ? Tip.fromPartial(object.tip) : undefined; + return message; + }, + fromAmino(object: SignDocDirectAuxAmino): SignDocDirectAux { + const message = createBaseSignDocDirectAux(); + if (object.body_bytes !== undefined && object.body_bytes !== null) { + message.bodyBytes = bytesFromBase64(object.body_bytes); + } + if (object.public_key !== undefined && object.public_key !== null) { + message.publicKey = Any.fromAmino(object.public_key); + } + if (object.chain_id !== undefined && object.chain_id !== null) { + message.chainId = object.chain_id; + } + if (object.account_number !== undefined && object.account_number !== null) { + message.accountNumber = BigInt(object.account_number); + } + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + if (object.tip !== undefined && object.tip !== null) { + message.tip = Tip.fromAmino(object.tip); + } + return message; + }, + toAmino(message: SignDocDirectAux): SignDocDirectAuxAmino { + const obj: any = {}; + obj.body_bytes = message.bodyBytes ? base64FromBytes(message.bodyBytes) : undefined; + obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; + obj.account_number = message.accountNumber !== BigInt(0) ? message.accountNumber?.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence?.toString() : undefined; + obj.tip = message.tip ? Tip.toAmino(message.tip) : undefined; + return obj; + }, + fromAminoMsg(object: SignDocDirectAuxAminoMsg): SignDocDirectAux { + return SignDocDirectAux.fromAmino(object.value); + }, + toAminoMsg(message: SignDocDirectAux): SignDocDirectAuxAminoMsg { + return { + type: "cosmos-sdk/SignDocDirectAux", + value: SignDocDirectAux.toAmino(message) + }; + }, + fromProtoMsg(message: SignDocDirectAuxProtoMsg): SignDocDirectAux { + return SignDocDirectAux.decode(message.value); + }, + toProto(message: SignDocDirectAux): Uint8Array { + return SignDocDirectAux.encode(message).finish(); + }, + toProtoMsg(message: SignDocDirectAux): SignDocDirectAuxProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.SignDocDirectAux", + value: SignDocDirectAux.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(SignDocDirectAux.typeUrl, SignDocDirectAux); +GlobalDecoderRegistry.registerAminoProtoMapping(SignDocDirectAux.aminoType, SignDocDirectAux.typeUrl); +function createBaseTxBody(): TxBody { + return { + messages: [], + memo: "", + timeoutHeight: BigInt(0), + extensionOptions: [], + nonCriticalExtensionOptions: [] + }; +} +export const TxBody = { + typeUrl: "/cosmos.tx.v1beta1.TxBody", + aminoType: "cosmos-sdk/TxBody", + is(o: any): o is TxBody { + return o && (o.$typeUrl === TxBody.typeUrl || Array.isArray(o.messages) && (!o.messages.length || Any.is(o.messages[0])) && typeof o.memo === "string" && typeof o.timeoutHeight === "bigint" && Array.isArray(o.extensionOptions) && (!o.extensionOptions.length || Any.is(o.extensionOptions[0])) && Array.isArray(o.nonCriticalExtensionOptions) && (!o.nonCriticalExtensionOptions.length || Any.is(o.nonCriticalExtensionOptions[0]))); + }, + isAmino(o: any): o is TxBodyAmino { + return o && (o.$typeUrl === TxBody.typeUrl || Array.isArray(o.messages) && (!o.messages.length || Any.isAmino(o.messages[0])) && typeof o.memo === "string" && typeof o.timeout_height === "bigint" && Array.isArray(o.extension_options) && (!o.extension_options.length || Any.isAmino(o.extension_options[0])) && Array.isArray(o.non_critical_extension_options) && (!o.non_critical_extension_options.length || Any.isAmino(o.non_critical_extension_options[0]))); + }, + encode(message: TxBody, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.messages) { + Any.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.memo !== "") { + writer.uint32(18).string(message.memo); + } + if (message.timeoutHeight !== BigInt(0)) { + writer.uint32(24).uint64(message.timeoutHeight); + } + for (const v of message.extensionOptions) { + Any.encode(v!, writer.uint32(8186).fork()).ldelim(); + } + for (const v of message.nonCriticalExtensionOptions) { + Any.encode(v!, writer.uint32(16378).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TxBody { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxBody(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.messages.push(Any.decode(reader, reader.uint32())); + break; + case 2: + message.memo = reader.string(); + break; + case 3: + message.timeoutHeight = reader.uint64(); + break; + case 1023: + message.extensionOptions.push(Any.decode(reader, reader.uint32())); + break; + case 2047: + message.nonCriticalExtensionOptions.push(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): TxBody { + const message = createBaseTxBody(); + message.messages = object.messages?.map(e => Any.fromPartial(e)) || []; + message.memo = object.memo ?? ""; + message.timeoutHeight = object.timeoutHeight !== undefined && object.timeoutHeight !== null ? BigInt(object.timeoutHeight.toString()) : BigInt(0); + message.extensionOptions = object.extensionOptions?.map(e => Any.fromPartial(e)) || []; + message.nonCriticalExtensionOptions = object.nonCriticalExtensionOptions?.map(e => Any.fromPartial(e)) || []; + return message; + }, + fromAmino(object: TxBodyAmino): TxBody { + const message = createBaseTxBody(); + message.messages = object.messages?.map(e => Any.fromAmino(e)) || []; + if (object.memo !== undefined && object.memo !== null) { + message.memo = object.memo; + } + if (object.timeout_height !== undefined && object.timeout_height !== null) { + message.timeoutHeight = BigInt(object.timeout_height); + } + message.extensionOptions = object.extension_options?.map(e => Any.fromAmino(e)) || []; + message.nonCriticalExtensionOptions = object.non_critical_extension_options?.map(e => Any.fromAmino(e)) || []; + return message; + }, + toAmino(message: TxBody): TxBodyAmino { + const obj: any = {}; + if (message.messages) { + obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.messages = message.messages; + } + obj.memo = message.memo === "" ? undefined : message.memo; + obj.timeout_height = message.timeoutHeight !== BigInt(0) ? message.timeoutHeight?.toString() : undefined; + if (message.extensionOptions) { + obj.extension_options = message.extensionOptions.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.extension_options = message.extensionOptions; + } + if (message.nonCriticalExtensionOptions) { + obj.non_critical_extension_options = message.nonCriticalExtensionOptions.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.non_critical_extension_options = message.nonCriticalExtensionOptions; + } + return obj; + }, + fromAminoMsg(object: TxBodyAminoMsg): TxBody { + return TxBody.fromAmino(object.value); + }, + toAminoMsg(message: TxBody): TxBodyAminoMsg { + return { + type: "cosmos-sdk/TxBody", + value: TxBody.toAmino(message) + }; + }, + fromProtoMsg(message: TxBodyProtoMsg): TxBody { + return TxBody.decode(message.value); + }, + toProto(message: TxBody): Uint8Array { + return TxBody.encode(message).finish(); + }, + toProtoMsg(message: TxBody): TxBodyProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.TxBody", + value: TxBody.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(TxBody.typeUrl, TxBody); +GlobalDecoderRegistry.registerAminoProtoMapping(TxBody.aminoType, TxBody.typeUrl); +function createBaseAuthInfo(): AuthInfo { + return { + signerInfos: [], + fee: undefined, + tip: undefined + }; +} +export const AuthInfo = { + typeUrl: "/cosmos.tx.v1beta1.AuthInfo", + aminoType: "cosmos-sdk/AuthInfo", + is(o: any): o is AuthInfo { + return o && (o.$typeUrl === AuthInfo.typeUrl || Array.isArray(o.signerInfos) && (!o.signerInfos.length || SignerInfo.is(o.signerInfos[0]))); + }, + isAmino(o: any): o is AuthInfoAmino { + return o && (o.$typeUrl === AuthInfo.typeUrl || Array.isArray(o.signer_infos) && (!o.signer_infos.length || SignerInfo.isAmino(o.signer_infos[0]))); + }, + encode(message: AuthInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.signerInfos) { + SignerInfo.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.fee !== undefined) { + Fee.encode(message.fee, writer.uint32(18).fork()).ldelim(); + } + if (message.tip !== undefined) { + Tip.encode(message.tip, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AuthInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuthInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signerInfos.push(SignerInfo.decode(reader, reader.uint32())); + break; + case 2: + message.fee = Fee.decode(reader, reader.uint32()); + break; + case 3: + message.tip = Tip.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): AuthInfo { + const message = createBaseAuthInfo(); + message.signerInfos = object.signerInfos?.map(e => SignerInfo.fromPartial(e)) || []; + message.fee = object.fee !== undefined && object.fee !== null ? Fee.fromPartial(object.fee) : undefined; + message.tip = object.tip !== undefined && object.tip !== null ? Tip.fromPartial(object.tip) : undefined; + return message; + }, + fromAmino(object: AuthInfoAmino): AuthInfo { + const message = createBaseAuthInfo(); + message.signerInfos = object.signer_infos?.map(e => SignerInfo.fromAmino(e)) || []; + if (object.fee !== undefined && object.fee !== null) { + message.fee = Fee.fromAmino(object.fee); + } + if (object.tip !== undefined && object.tip !== null) { + message.tip = Tip.fromAmino(object.tip); + } + return message; + }, + toAmino(message: AuthInfo): AuthInfoAmino { + const obj: any = {}; + if (message.signerInfos) { + obj.signer_infos = message.signerInfos.map(e => e ? SignerInfo.toAmino(e) : undefined); + } else { + obj.signer_infos = message.signerInfos; + } + obj.fee = message.fee ? Fee.toAmino(message.fee) : undefined; + obj.tip = message.tip ? Tip.toAmino(message.tip) : undefined; + return obj; + }, + fromAminoMsg(object: AuthInfoAminoMsg): AuthInfo { + return AuthInfo.fromAmino(object.value); + }, + toAminoMsg(message: AuthInfo): AuthInfoAminoMsg { + return { + type: "cosmos-sdk/AuthInfo", + value: AuthInfo.toAmino(message) + }; + }, + fromProtoMsg(message: AuthInfoProtoMsg): AuthInfo { + return AuthInfo.decode(message.value); + }, + toProto(message: AuthInfo): Uint8Array { + return AuthInfo.encode(message).finish(); + }, + toProtoMsg(message: AuthInfo): AuthInfoProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.AuthInfo", + value: AuthInfo.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(AuthInfo.typeUrl, AuthInfo); +GlobalDecoderRegistry.registerAminoProtoMapping(AuthInfo.aminoType, AuthInfo.typeUrl); +function createBaseSignerInfo(): SignerInfo { + return { + publicKey: undefined, + modeInfo: undefined, + sequence: BigInt(0) + }; +} +export const SignerInfo = { + typeUrl: "/cosmos.tx.v1beta1.SignerInfo", + aminoType: "cosmos-sdk/SignerInfo", + is(o: any): o is SignerInfo { + return o && (o.$typeUrl === SignerInfo.typeUrl || typeof o.sequence === "bigint"); + }, + isAmino(o: any): o is SignerInfoAmino { + return o && (o.$typeUrl === SignerInfo.typeUrl || typeof o.sequence === "bigint"); + }, + encode(message: SignerInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.publicKey !== undefined) { + Any.encode(message.publicKey, writer.uint32(10).fork()).ldelim(); + } + if (message.modeInfo !== undefined) { + ModeInfo.encode(message.modeInfo, writer.uint32(18).fork()).ldelim(); + } + if (message.sequence !== BigInt(0)) { + writer.uint32(24).uint64(message.sequence); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SignerInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignerInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.publicKey = Any.decode(reader, reader.uint32()); + break; + case 2: + message.modeInfo = ModeInfo.decode(reader, reader.uint32()); + break; + case 3: + message.sequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SignerInfo { + const message = createBaseSignerInfo(); + message.publicKey = object.publicKey !== undefined && object.publicKey !== null ? Any.fromPartial(object.publicKey) : undefined; + message.modeInfo = object.modeInfo !== undefined && object.modeInfo !== null ? ModeInfo.fromPartial(object.modeInfo) : undefined; + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + return message; + }, + fromAmino(object: SignerInfoAmino): SignerInfo { + const message = createBaseSignerInfo(); + if (object.public_key !== undefined && object.public_key !== null) { + message.publicKey = Any.fromAmino(object.public_key); + } + if (object.mode_info !== undefined && object.mode_info !== null) { + message.modeInfo = ModeInfo.fromAmino(object.mode_info); + } + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + return message; + }, + toAmino(message: SignerInfo): SignerInfoAmino { + const obj: any = {}; + obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; + obj.mode_info = message.modeInfo ? ModeInfo.toAmino(message.modeInfo) : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: SignerInfoAminoMsg): SignerInfo { + return SignerInfo.fromAmino(object.value); + }, + toAminoMsg(message: SignerInfo): SignerInfoAminoMsg { + return { + type: "cosmos-sdk/SignerInfo", + value: SignerInfo.toAmino(message) + }; + }, + fromProtoMsg(message: SignerInfoProtoMsg): SignerInfo { + return SignerInfo.decode(message.value); + }, + toProto(message: SignerInfo): Uint8Array { + return SignerInfo.encode(message).finish(); + }, + toProtoMsg(message: SignerInfo): SignerInfoProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.SignerInfo", + value: SignerInfo.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(SignerInfo.typeUrl, SignerInfo); +GlobalDecoderRegistry.registerAminoProtoMapping(SignerInfo.aminoType, SignerInfo.typeUrl); +function createBaseModeInfo(): ModeInfo { + return { + single: undefined, + multi: undefined + }; +} +export const ModeInfo = { + typeUrl: "/cosmos.tx.v1beta1.ModeInfo", + aminoType: "cosmos-sdk/ModeInfo", + is(o: any): o is ModeInfo { + return o && o.$typeUrl === ModeInfo.typeUrl; + }, + isAmino(o: any): o is ModeInfoAmino { + return o && o.$typeUrl === ModeInfo.typeUrl; + }, + encode(message: ModeInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.single !== undefined) { + ModeInfo_Single.encode(message.single, writer.uint32(10).fork()).ldelim(); + } + if (message.multi !== undefined) { + ModeInfo_Multi.encode(message.multi, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ModeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModeInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.single = ModeInfo_Single.decode(reader, reader.uint32()); + break; + case 2: + message.multi = ModeInfo_Multi.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ModeInfo { + const message = createBaseModeInfo(); + message.single = object.single !== undefined && object.single !== null ? ModeInfo_Single.fromPartial(object.single) : undefined; + message.multi = object.multi !== undefined && object.multi !== null ? ModeInfo_Multi.fromPartial(object.multi) : undefined; + return message; + }, + fromAmino(object: ModeInfoAmino): ModeInfo { + const message = createBaseModeInfo(); + if (object.single !== undefined && object.single !== null) { + message.single = ModeInfo_Single.fromAmino(object.single); + } + if (object.multi !== undefined && object.multi !== null) { + message.multi = ModeInfo_Multi.fromAmino(object.multi); + } + return message; + }, + toAmino(message: ModeInfo): ModeInfoAmino { + const obj: any = {}; + obj.single = message.single ? ModeInfo_Single.toAmino(message.single) : undefined; + obj.multi = message.multi ? ModeInfo_Multi.toAmino(message.multi) : undefined; + return obj; + }, + fromAminoMsg(object: ModeInfoAminoMsg): ModeInfo { + return ModeInfo.fromAmino(object.value); + }, + toAminoMsg(message: ModeInfo): ModeInfoAminoMsg { + return { + type: "cosmos-sdk/ModeInfo", + value: ModeInfo.toAmino(message) + }; + }, + fromProtoMsg(message: ModeInfoProtoMsg): ModeInfo { + return ModeInfo.decode(message.value); + }, + toProto(message: ModeInfo): Uint8Array { + return ModeInfo.encode(message).finish(); + }, + toProtoMsg(message: ModeInfo): ModeInfoProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.ModeInfo", + value: ModeInfo.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ModeInfo.typeUrl, ModeInfo); +GlobalDecoderRegistry.registerAminoProtoMapping(ModeInfo.aminoType, ModeInfo.typeUrl); +function createBaseModeInfo_Single(): ModeInfo_Single { + return { + mode: 0 + }; +} +export const ModeInfo_Single = { + typeUrl: "/cosmos.tx.v1beta1.Single", + aminoType: "cosmos-sdk/Single", + is(o: any): o is ModeInfo_Single { + return o && (o.$typeUrl === ModeInfo_Single.typeUrl || isSet(o.mode)); + }, + isAmino(o: any): o is ModeInfo_SingleAmino { + return o && (o.$typeUrl === ModeInfo_Single.typeUrl || isSet(o.mode)); + }, + encode(message: ModeInfo_Single, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.mode !== 0) { + writer.uint32(8).int32(message.mode); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ModeInfo_Single { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModeInfo_Single(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.mode = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ModeInfo_Single { + const message = createBaseModeInfo_Single(); + message.mode = object.mode ?? 0; + return message; + }, + fromAmino(object: ModeInfo_SingleAmino): ModeInfo_Single { + const message = createBaseModeInfo_Single(); + if (object.mode !== undefined && object.mode !== null) { + message.mode = object.mode; + } + return message; + }, + toAmino(message: ModeInfo_Single): ModeInfo_SingleAmino { + const obj: any = {}; + obj.mode = message.mode === 0 ? undefined : message.mode; + return obj; + }, + fromAminoMsg(object: ModeInfo_SingleAminoMsg): ModeInfo_Single { + return ModeInfo_Single.fromAmino(object.value); + }, + toAminoMsg(message: ModeInfo_Single): ModeInfo_SingleAminoMsg { + return { + type: "cosmos-sdk/Single", + value: ModeInfo_Single.toAmino(message) + }; + }, + fromProtoMsg(message: ModeInfo_SingleProtoMsg): ModeInfo_Single { + return ModeInfo_Single.decode(message.value); + }, + toProto(message: ModeInfo_Single): Uint8Array { + return ModeInfo_Single.encode(message).finish(); + }, + toProtoMsg(message: ModeInfo_Single): ModeInfo_SingleProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.Single", + value: ModeInfo_Single.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ModeInfo_Single.typeUrl, ModeInfo_Single); +GlobalDecoderRegistry.registerAminoProtoMapping(ModeInfo_Single.aminoType, ModeInfo_Single.typeUrl); +function createBaseModeInfo_Multi(): ModeInfo_Multi { + return { + bitarray: undefined, + modeInfos: [] + }; +} +export const ModeInfo_Multi = { + typeUrl: "/cosmos.tx.v1beta1.Multi", + aminoType: "cosmos-sdk/Multi", + is(o: any): o is ModeInfo_Multi { + return o && (o.$typeUrl === ModeInfo_Multi.typeUrl || Array.isArray(o.modeInfos) && (!o.modeInfos.length || ModeInfo.is(o.modeInfos[0]))); + }, + isAmino(o: any): o is ModeInfo_MultiAmino { + return o && (o.$typeUrl === ModeInfo_Multi.typeUrl || Array.isArray(o.mode_infos) && (!o.mode_infos.length || ModeInfo.isAmino(o.mode_infos[0]))); + }, + encode(message: ModeInfo_Multi, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.bitarray !== undefined) { + CompactBitArray.encode(message.bitarray, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.modeInfos) { + ModeInfo.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ModeInfo_Multi { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModeInfo_Multi(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.bitarray = CompactBitArray.decode(reader, reader.uint32()); + break; + case 2: + message.modeInfos.push(ModeInfo.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ModeInfo_Multi { + const message = createBaseModeInfo_Multi(); + message.bitarray = object.bitarray !== undefined && object.bitarray !== null ? CompactBitArray.fromPartial(object.bitarray) : undefined; + message.modeInfos = object.modeInfos?.map(e => ModeInfo.fromPartial(e)) || []; + return message; + }, + fromAmino(object: ModeInfo_MultiAmino): ModeInfo_Multi { + const message = createBaseModeInfo_Multi(); + if (object.bitarray !== undefined && object.bitarray !== null) { + message.bitarray = CompactBitArray.fromAmino(object.bitarray); + } + message.modeInfos = object.mode_infos?.map(e => ModeInfo.fromAmino(e)) || []; + return message; + }, + toAmino(message: ModeInfo_Multi): ModeInfo_MultiAmino { + const obj: any = {}; + obj.bitarray = message.bitarray ? CompactBitArray.toAmino(message.bitarray) : undefined; + if (message.modeInfos) { + obj.mode_infos = message.modeInfos.map(e => e ? ModeInfo.toAmino(e) : undefined); + } else { + obj.mode_infos = message.modeInfos; + } + return obj; + }, + fromAminoMsg(object: ModeInfo_MultiAminoMsg): ModeInfo_Multi { + return ModeInfo_Multi.fromAmino(object.value); + }, + toAminoMsg(message: ModeInfo_Multi): ModeInfo_MultiAminoMsg { + return { + type: "cosmos-sdk/Multi", + value: ModeInfo_Multi.toAmino(message) + }; + }, + fromProtoMsg(message: ModeInfo_MultiProtoMsg): ModeInfo_Multi { + return ModeInfo_Multi.decode(message.value); + }, + toProto(message: ModeInfo_Multi): Uint8Array { + return ModeInfo_Multi.encode(message).finish(); + }, + toProtoMsg(message: ModeInfo_Multi): ModeInfo_MultiProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.Multi", + value: ModeInfo_Multi.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ModeInfo_Multi.typeUrl, ModeInfo_Multi); +GlobalDecoderRegistry.registerAminoProtoMapping(ModeInfo_Multi.aminoType, ModeInfo_Multi.typeUrl); +function createBaseFee(): Fee { + return { + amount: [], + gasLimit: BigInt(0), + payer: "", + granter: "" + }; +} +export const Fee = { + typeUrl: "/cosmos.tx.v1beta1.Fee", + aminoType: "cosmos-sdk/Fee", + is(o: any): o is Fee { + return o && (o.$typeUrl === Fee.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0])) && typeof o.gasLimit === "bigint" && typeof o.payer === "string" && typeof o.granter === "string"); + }, + isAmino(o: any): o is FeeAmino { + return o && (o.$typeUrl === Fee.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0])) && typeof o.gas_limit === "bigint" && typeof o.payer === "string" && typeof o.granter === "string"); + }, + encode(message: Fee, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.gasLimit !== BigInt(0)) { + writer.uint32(16).uint64(message.gasLimit); + } + if (message.payer !== "") { + writer.uint32(26).string(message.payer); + } + if (message.granter !== "") { + writer.uint32(34).string(message.granter); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Fee { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFee(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + case 2: + message.gasLimit = reader.uint64(); + break; + case 3: + message.payer = reader.string(); + break; + case 4: + message.granter = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Fee { + const message = createBaseFee(); + message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; + message.gasLimit = object.gasLimit !== undefined && object.gasLimit !== null ? BigInt(object.gasLimit.toString()) : BigInt(0); + message.payer = object.payer ?? ""; + message.granter = object.granter ?? ""; + return message; + }, + fromAmino(object: FeeAmino): Fee { + const message = createBaseFee(); + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + if (object.gas_limit !== undefined && object.gas_limit !== null) { + message.gasLimit = BigInt(object.gas_limit); + } + if (object.payer !== undefined && object.payer !== null) { + message.payer = object.payer; + } + if (object.granter !== undefined && object.granter !== null) { + message.granter = object.granter; + } + return message; + }, + toAmino(message: Fee): FeeAmino { + const obj: any = {}; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = message.amount; + } + obj.gas_limit = message.gasLimit !== BigInt(0) ? message.gasLimit?.toString() : undefined; + obj.payer = message.payer === "" ? undefined : message.payer; + obj.granter = message.granter === "" ? undefined : message.granter; + return obj; + }, + fromAminoMsg(object: FeeAminoMsg): Fee { + return Fee.fromAmino(object.value); + }, + toAminoMsg(message: Fee): FeeAminoMsg { + return { + type: "cosmos-sdk/Fee", + value: Fee.toAmino(message) + }; + }, + fromProtoMsg(message: FeeProtoMsg): Fee { + return Fee.decode(message.value); + }, + toProto(message: Fee): Uint8Array { + return Fee.encode(message).finish(); + }, + toProtoMsg(message: Fee): FeeProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.Fee", + value: Fee.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Fee.typeUrl, Fee); +GlobalDecoderRegistry.registerAminoProtoMapping(Fee.aminoType, Fee.typeUrl); +function createBaseTip(): Tip { + return { + amount: [], + tipper: "" + }; +} +export const Tip = { + typeUrl: "/cosmos.tx.v1beta1.Tip", + aminoType: "cosmos-sdk/Tip", + is(o: any): o is Tip { + return o && (o.$typeUrl === Tip.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0])) && typeof o.tipper === "string"); + }, + isAmino(o: any): o is TipAmino { + return o && (o.$typeUrl === Tip.typeUrl || Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0])) && typeof o.tipper === "string"); + }, + encode(message: Tip, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.tipper !== "") { + writer.uint32(18).string(message.tipper); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Tip { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTip(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + case 2: + message.tipper = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Tip { + const message = createBaseTip(); + message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; + message.tipper = object.tipper ?? ""; + return message; + }, + fromAmino(object: TipAmino): Tip { + const message = createBaseTip(); + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + if (object.tipper !== undefined && object.tipper !== null) { + message.tipper = object.tipper; + } + return message; + }, + toAmino(message: Tip): TipAmino { + const obj: any = {}; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = message.amount; + } + obj.tipper = message.tipper === "" ? undefined : message.tipper; + return obj; + }, + fromAminoMsg(object: TipAminoMsg): Tip { + return Tip.fromAmino(object.value); + }, + toAminoMsg(message: Tip): TipAminoMsg { + return { + type: "cosmos-sdk/Tip", + value: Tip.toAmino(message) + }; + }, + fromProtoMsg(message: TipProtoMsg): Tip { + return Tip.decode(message.value); + }, + toProto(message: Tip): Uint8Array { + return Tip.encode(message).finish(); + }, + toProtoMsg(message: Tip): TipProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.Tip", + value: Tip.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Tip.typeUrl, Tip); +GlobalDecoderRegistry.registerAminoProtoMapping(Tip.aminoType, Tip.typeUrl); +function createBaseAuxSignerData(): AuxSignerData { + return { + address: "", + signDoc: undefined, + mode: 0, + sig: new Uint8Array() + }; +} +export const AuxSignerData = { + typeUrl: "/cosmos.tx.v1beta1.AuxSignerData", + aminoType: "cosmos-sdk/AuxSignerData", + is(o: any): o is AuxSignerData { + return o && (o.$typeUrl === AuxSignerData.typeUrl || typeof o.address === "string" && isSet(o.mode) && (o.sig instanceof Uint8Array || typeof o.sig === "string")); + }, + isAmino(o: any): o is AuxSignerDataAmino { + return o && (o.$typeUrl === AuxSignerData.typeUrl || typeof o.address === "string" && isSet(o.mode) && (o.sig instanceof Uint8Array || typeof o.sig === "string")); + }, + encode(message: AuxSignerData, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.signDoc !== undefined) { + SignDocDirectAux.encode(message.signDoc, writer.uint32(18).fork()).ldelim(); + } + if (message.mode !== 0) { + writer.uint32(24).int32(message.mode); + } + if (message.sig.length !== 0) { + writer.uint32(34).bytes(message.sig); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AuxSignerData { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAuxSignerData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.signDoc = SignDocDirectAux.decode(reader, reader.uint32()); + break; + case 3: + message.mode = (reader.int32() as any); + break; + case 4: + message.sig = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): AuxSignerData { + const message = createBaseAuxSignerData(); + message.address = object.address ?? ""; + message.signDoc = object.signDoc !== undefined && object.signDoc !== null ? SignDocDirectAux.fromPartial(object.signDoc) : undefined; + message.mode = object.mode ?? 0; + message.sig = object.sig ?? new Uint8Array(); + return message; + }, + fromAmino(object: AuxSignerDataAmino): AuxSignerData { + const message = createBaseAuxSignerData(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.sign_doc !== undefined && object.sign_doc !== null) { + message.signDoc = SignDocDirectAux.fromAmino(object.sign_doc); + } + if (object.mode !== undefined && object.mode !== null) { + message.mode = object.mode; + } + if (object.sig !== undefined && object.sig !== null) { + message.sig = bytesFromBase64(object.sig); + } + return message; + }, + toAmino(message: AuxSignerData): AuxSignerDataAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + obj.sign_doc = message.signDoc ? SignDocDirectAux.toAmino(message.signDoc) : undefined; + obj.mode = message.mode === 0 ? undefined : message.mode; + obj.sig = message.sig ? base64FromBytes(message.sig) : undefined; + return obj; + }, + fromAminoMsg(object: AuxSignerDataAminoMsg): AuxSignerData { + return AuxSignerData.fromAmino(object.value); + }, + toAminoMsg(message: AuxSignerData): AuxSignerDataAminoMsg { + return { + type: "cosmos-sdk/AuxSignerData", + value: AuxSignerData.toAmino(message) + }; + }, + fromProtoMsg(message: AuxSignerDataProtoMsg): AuxSignerData { + return AuxSignerData.decode(message.value); + }, + toProto(message: AuxSignerData): Uint8Array { + return AuxSignerData.encode(message).finish(); + }, + toProtoMsg(message: AuxSignerData): AuxSignerDataProtoMsg { + return { + typeUrl: "/cosmos.tx.v1beta1.AuxSignerData", + value: AuxSignerData.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(AuxSignerData.typeUrl, AuxSignerData); +GlobalDecoderRegistry.registerAminoProtoMapping(AuxSignerData.aminoType, AuxSignerData.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/upgrade/v1beta1/upgrade.ts b/libs/interchain-query/src/cosmos/upgrade/v1beta1/upgrade.ts new file mode 100644 index 00000000..c2adfcb7 --- /dev/null +++ b/libs/interchain-query/src/cosmos/upgrade/v1beta1/upgrade.ts @@ -0,0 +1,591 @@ +import { Timestamp } from "../../../google/protobuf/timestamp"; +import { Any, AnyAmino } from "../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { toTimestamp, fromTimestamp, DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; +/** Plan specifies information about a planned upgrade and when it should occur. */ +export interface Plan { + /** + * Sets the name for the upgrade. This name will be used by the upgraded + * version of the software to apply any special "on-upgrade" commands during + * the first BeginBlock method after the upgrade is applied. It is also used + * to detect whether a software version can handle a given upgrade. If no + * upgrade handler with this name has been set in the software, it will be + * assumed that the software is out-of-date when the upgrade Time or Height is + * reached and the software will exit. + */ + name: string; + /** + * Deprecated: Time based upgrades have been deprecated. Time based upgrade logic + * has been removed from the SDK. + * If this field is not empty, an error will be thrown. + */ + /** @deprecated */ + time: Date; + /** The height at which the upgrade must be performed. */ + height: bigint; + /** + * Any application specific upgrade info to be included on-chain + * such as a git commit that validators could automatically upgrade to + */ + info: string; + /** + * Deprecated: UpgradedClientState field has been deprecated. IBC upgrade logic has been + * moved to the IBC module in the sub module 02-client. + * If this field is not empty, an error will be thrown. + */ + /** @deprecated */ + upgradedClientState?: Any; +} +export interface PlanProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.Plan"; + value: Uint8Array; +} +/** Plan specifies information about a planned upgrade and when it should occur. */ +export interface PlanAmino { + /** + * Sets the name for the upgrade. This name will be used by the upgraded + * version of the software to apply any special "on-upgrade" commands during + * the first BeginBlock method after the upgrade is applied. It is also used + * to detect whether a software version can handle a given upgrade. If no + * upgrade handler with this name has been set in the software, it will be + * assumed that the software is out-of-date when the upgrade Time or Height is + * reached and the software will exit. + */ + name: string; + /** + * Deprecated: Time based upgrades have been deprecated. Time based upgrade logic + * has been removed from the SDK. + * If this field is not empty, an error will be thrown. + */ + /** @deprecated */ + time: string; + /** The height at which the upgrade must be performed. */ + height: string; + /** + * Any application specific upgrade info to be included on-chain + * such as a git commit that validators could automatically upgrade to + */ + info: string; + /** + * Deprecated: UpgradedClientState field has been deprecated. IBC upgrade logic has been + * moved to the IBC module in the sub module 02-client. + * If this field is not empty, an error will be thrown. + */ + /** @deprecated */ + upgraded_client_state?: AnyAmino; +} +export interface PlanAminoMsg { + type: "cosmos-sdk/Plan"; + value: PlanAmino; +} +/** + * SoftwareUpgradeProposal is a gov Content type for initiating a software + * upgrade. + * Deprecated: This legacy proposal is deprecated in favor of Msg-based gov + * proposals, see MsgSoftwareUpgrade. + */ +/** @deprecated */ +export interface SoftwareUpgradeProposal { + /** title of the proposal */ + title: string; + /** description of the proposal */ + description: string; + /** plan of the proposal */ + plan: Plan; +} +export interface SoftwareUpgradeProposalProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal"; + value: Uint8Array; +} +/** + * SoftwareUpgradeProposal is a gov Content type for initiating a software + * upgrade. + * Deprecated: This legacy proposal is deprecated in favor of Msg-based gov + * proposals, see MsgSoftwareUpgrade. + */ +/** @deprecated */ +export interface SoftwareUpgradeProposalAmino { + /** title of the proposal */ + title: string; + /** description of the proposal */ + description: string; + /** plan of the proposal */ + plan: PlanAmino; +} +export interface SoftwareUpgradeProposalAminoMsg { + type: "cosmos-sdk/SoftwareUpgradeProposal"; + value: SoftwareUpgradeProposalAmino; +} +/** + * CancelSoftwareUpgradeProposal is a gov Content type for cancelling a software + * upgrade. + * Deprecated: This legacy proposal is deprecated in favor of Msg-based gov + * proposals, see MsgCancelUpgrade. + */ +/** @deprecated */ +export interface CancelSoftwareUpgradeProposal { + /** title of the proposal */ + title: string; + /** description of the proposal */ + description: string; +} +export interface CancelSoftwareUpgradeProposalProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal"; + value: Uint8Array; +} +/** + * CancelSoftwareUpgradeProposal is a gov Content type for cancelling a software + * upgrade. + * Deprecated: This legacy proposal is deprecated in favor of Msg-based gov + * proposals, see MsgCancelUpgrade. + */ +/** @deprecated */ +export interface CancelSoftwareUpgradeProposalAmino { + /** title of the proposal */ + title: string; + /** description of the proposal */ + description: string; +} +export interface CancelSoftwareUpgradeProposalAminoMsg { + type: "cosmos-sdk/CancelSoftwareUpgradeProposal"; + value: CancelSoftwareUpgradeProposalAmino; +} +/** + * ModuleVersion specifies a module and its consensus version. + * + * Since: cosmos-sdk 0.43 + */ +export interface ModuleVersion { + /** name of the app module */ + name: string; + /** consensus version of the app module */ + version: bigint; +} +export interface ModuleVersionProtoMsg { + typeUrl: "/cosmos.upgrade.v1beta1.ModuleVersion"; + value: Uint8Array; +} +/** + * ModuleVersion specifies a module and its consensus version. + * + * Since: cosmos-sdk 0.43 + */ +export interface ModuleVersionAmino { + /** name of the app module */ + name: string; + /** consensus version of the app module */ + version: string; +} +export interface ModuleVersionAminoMsg { + type: "cosmos-sdk/ModuleVersion"; + value: ModuleVersionAmino; +} +function createBasePlan(): Plan { + return { + name: "", + time: new Date(), + height: BigInt(0), + info: "", + upgradedClientState: undefined + }; +} +export const Plan = { + typeUrl: "/cosmos.upgrade.v1beta1.Plan", + aminoType: "cosmos-sdk/Plan", + is(o: any): o is Plan { + return o && (o.$typeUrl === Plan.typeUrl || typeof o.name === "string" && Timestamp.is(o.time) && typeof o.height === "bigint" && typeof o.info === "string"); + }, + isAmino(o: any): o is PlanAmino { + return o && (o.$typeUrl === Plan.typeUrl || typeof o.name === "string" && Timestamp.isAmino(o.time) && typeof o.height === "bigint" && typeof o.info === "string"); + }, + encode(message: Plan, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(18).fork()).ldelim(); + } + if (message.height !== BigInt(0)) { + writer.uint32(24).int64(message.height); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.upgradedClientState !== undefined) { + Any.encode(message.upgradedClientState, writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Plan { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePlan(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 3: + message.height = reader.int64(); + break; + case 4: + message.info = reader.string(); + break; + case 5: + message.upgradedClientState = Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Plan { + const message = createBasePlan(); + message.name = object.name ?? ""; + message.time = object.time ?? undefined; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.info = object.info ?? ""; + message.upgradedClientState = object.upgradedClientState !== undefined && object.upgradedClientState !== null ? Any.fromPartial(object.upgradedClientState) : undefined; + return message; + }, + fromAmino(object: PlanAmino): Plan { + const message = createBasePlan(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.time !== undefined && object.time !== null) { + message.time = fromTimestamp(Timestamp.fromAmino(object.time)); + } + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.info !== undefined && object.info !== null) { + message.info = object.info; + } + if (object.upgraded_client_state !== undefined && object.upgraded_client_state !== null) { + message.upgradedClientState = Any.fromAmino(object.upgraded_client_state); + } + return message; + }, + toAmino(message: Plan): PlanAmino { + const obj: any = {}; + obj.name = message.name === "" ? undefined : message.name; + obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : new Date(); + obj.height = message.height !== BigInt(0) ? message.height?.toString() : undefined; + obj.info = message.info === "" ? undefined : message.info; + obj.upgraded_client_state = message.upgradedClientState ? Any.toAmino(message.upgradedClientState) : undefined; + return obj; + }, + fromAminoMsg(object: PlanAminoMsg): Plan { + return Plan.fromAmino(object.value); + }, + toAminoMsg(message: Plan): PlanAminoMsg { + return { + type: "cosmos-sdk/Plan", + value: Plan.toAmino(message) + }; + }, + fromProtoMsg(message: PlanProtoMsg): Plan { + return Plan.decode(message.value); + }, + toProto(message: Plan): Uint8Array { + return Plan.encode(message).finish(); + }, + toProtoMsg(message: Plan): PlanProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.Plan", + value: Plan.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Plan.typeUrl, Plan); +GlobalDecoderRegistry.registerAminoProtoMapping(Plan.aminoType, Plan.typeUrl); +function createBaseSoftwareUpgradeProposal(): SoftwareUpgradeProposal { + return { + title: "", + description: "", + plan: Plan.fromPartial({}) + }; +} +export const SoftwareUpgradeProposal = { + typeUrl: "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal", + aminoType: "cosmos-sdk/SoftwareUpgradeProposal", + is(o: any): o is SoftwareUpgradeProposal { + return o && (o.$typeUrl === SoftwareUpgradeProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Plan.is(o.plan)); + }, + isAmino(o: any): o is SoftwareUpgradeProposalAmino { + return o && (o.$typeUrl === SoftwareUpgradeProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Plan.isAmino(o.plan)); + }, + encode(message: SoftwareUpgradeProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.plan !== undefined) { + Plan.encode(message.plan, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SoftwareUpgradeProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSoftwareUpgradeProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + case 3: + message.plan = Plan.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SoftwareUpgradeProposal { + const message = createBaseSoftwareUpgradeProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.plan = object.plan !== undefined && object.plan !== null ? Plan.fromPartial(object.plan) : undefined; + return message; + }, + fromAmino(object: SoftwareUpgradeProposalAmino): SoftwareUpgradeProposal { + const message = createBaseSoftwareUpgradeProposal(); + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + if (object.plan !== undefined && object.plan !== null) { + message.plan = Plan.fromAmino(object.plan); + } + return message; + }, + toAmino(message: SoftwareUpgradeProposal): SoftwareUpgradeProposalAmino { + const obj: any = {}; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.plan = message.plan ? Plan.toAmino(message.plan) : Plan.toAmino(Plan.fromPartial({})); + return obj; + }, + fromAminoMsg(object: SoftwareUpgradeProposalAminoMsg): SoftwareUpgradeProposal { + return SoftwareUpgradeProposal.fromAmino(object.value); + }, + toAminoMsg(message: SoftwareUpgradeProposal): SoftwareUpgradeProposalAminoMsg { + return { + type: "cosmos-sdk/SoftwareUpgradeProposal", + value: SoftwareUpgradeProposal.toAmino(message) + }; + }, + fromProtoMsg(message: SoftwareUpgradeProposalProtoMsg): SoftwareUpgradeProposal { + return SoftwareUpgradeProposal.decode(message.value); + }, + toProto(message: SoftwareUpgradeProposal): Uint8Array { + return SoftwareUpgradeProposal.encode(message).finish(); + }, + toProtoMsg(message: SoftwareUpgradeProposal): SoftwareUpgradeProposalProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal", + value: SoftwareUpgradeProposal.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(SoftwareUpgradeProposal.typeUrl, SoftwareUpgradeProposal); +GlobalDecoderRegistry.registerAminoProtoMapping(SoftwareUpgradeProposal.aminoType, SoftwareUpgradeProposal.typeUrl); +function createBaseCancelSoftwareUpgradeProposal(): CancelSoftwareUpgradeProposal { + return { + title: "", + description: "" + }; +} +export const CancelSoftwareUpgradeProposal = { + typeUrl: "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal", + aminoType: "cosmos-sdk/CancelSoftwareUpgradeProposal", + is(o: any): o is CancelSoftwareUpgradeProposal { + return o && (o.$typeUrl === CancelSoftwareUpgradeProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string"); + }, + isAmino(o: any): o is CancelSoftwareUpgradeProposalAmino { + return o && (o.$typeUrl === CancelSoftwareUpgradeProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string"); + }, + encode(message: CancelSoftwareUpgradeProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): CancelSoftwareUpgradeProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCancelSoftwareUpgradeProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): CancelSoftwareUpgradeProposal { + const message = createBaseCancelSoftwareUpgradeProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + return message; + }, + fromAmino(object: CancelSoftwareUpgradeProposalAmino): CancelSoftwareUpgradeProposal { + const message = createBaseCancelSoftwareUpgradeProposal(); + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + return message; + }, + toAmino(message: CancelSoftwareUpgradeProposal): CancelSoftwareUpgradeProposalAmino { + const obj: any = {}; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + return obj; + }, + fromAminoMsg(object: CancelSoftwareUpgradeProposalAminoMsg): CancelSoftwareUpgradeProposal { + return CancelSoftwareUpgradeProposal.fromAmino(object.value); + }, + toAminoMsg(message: CancelSoftwareUpgradeProposal): CancelSoftwareUpgradeProposalAminoMsg { + return { + type: "cosmos-sdk/CancelSoftwareUpgradeProposal", + value: CancelSoftwareUpgradeProposal.toAmino(message) + }; + }, + fromProtoMsg(message: CancelSoftwareUpgradeProposalProtoMsg): CancelSoftwareUpgradeProposal { + return CancelSoftwareUpgradeProposal.decode(message.value); + }, + toProto(message: CancelSoftwareUpgradeProposal): Uint8Array { + return CancelSoftwareUpgradeProposal.encode(message).finish(); + }, + toProtoMsg(message: CancelSoftwareUpgradeProposal): CancelSoftwareUpgradeProposalProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal", + value: CancelSoftwareUpgradeProposal.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(CancelSoftwareUpgradeProposal.typeUrl, CancelSoftwareUpgradeProposal); +GlobalDecoderRegistry.registerAminoProtoMapping(CancelSoftwareUpgradeProposal.aminoType, CancelSoftwareUpgradeProposal.typeUrl); +function createBaseModuleVersion(): ModuleVersion { + return { + name: "", + version: BigInt(0) + }; +} +export const ModuleVersion = { + typeUrl: "/cosmos.upgrade.v1beta1.ModuleVersion", + aminoType: "cosmos-sdk/ModuleVersion", + is(o: any): o is ModuleVersion { + return o && (o.$typeUrl === ModuleVersion.typeUrl || typeof o.name === "string" && typeof o.version === "bigint"); + }, + isAmino(o: any): o is ModuleVersionAmino { + return o && (o.$typeUrl === ModuleVersion.typeUrl || typeof o.name === "string" && typeof o.version === "bigint"); + }, + encode(message: ModuleVersion, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.version !== BigInt(0)) { + writer.uint32(16).uint64(message.version); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ModuleVersion { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModuleVersion(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.version = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ModuleVersion { + const message = createBaseModuleVersion(); + message.name = object.name ?? ""; + message.version = object.version !== undefined && object.version !== null ? BigInt(object.version.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ModuleVersionAmino): ModuleVersion { + const message = createBaseModuleVersion(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.version !== undefined && object.version !== null) { + message.version = BigInt(object.version); + } + return message; + }, + toAmino(message: ModuleVersion): ModuleVersionAmino { + const obj: any = {}; + obj.name = message.name === "" ? undefined : message.name; + obj.version = message.version !== BigInt(0) ? message.version?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ModuleVersionAminoMsg): ModuleVersion { + return ModuleVersion.fromAmino(object.value); + }, + toAminoMsg(message: ModuleVersion): ModuleVersionAminoMsg { + return { + type: "cosmos-sdk/ModuleVersion", + value: ModuleVersion.toAmino(message) + }; + }, + fromProtoMsg(message: ModuleVersionProtoMsg): ModuleVersion { + return ModuleVersion.decode(message.value); + }, + toProto(message: ModuleVersion): Uint8Array { + return ModuleVersion.encode(message).finish(); + }, + toProtoMsg(message: ModuleVersion): ModuleVersionProtoMsg { + return { + typeUrl: "/cosmos.upgrade.v1beta1.ModuleVersion", + value: ModuleVersion.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ModuleVersion.typeUrl, ModuleVersion); +GlobalDecoderRegistry.registerAminoProtoMapping(ModuleVersion.aminoType, ModuleVersion.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/vesting/v1beta1/tx.rpc.func.ts b/libs/interchain-query/src/cosmos/vesting/v1beta1/tx.rpc.func.ts new file mode 100644 index 00000000..a0043688 --- /dev/null +++ b/libs/interchain-query/src/cosmos/vesting/v1beta1/tx.rpc.func.ts @@ -0,0 +1,31 @@ +import { buildTx, SigningClientResolver } from "../../../helper-func-types"; +import { buildUseMutation } from "../../../react-query"; +import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; +import { MsgCreateVestingAccount, MsgCreatePermanentLockedAccount, MsgCreatePeriodicVestingAccount } from "./tx"; +export const createCreateVestingAccount = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgCreateVestingAccount.typeUrl, + encoders: toEncoders(MsgCreateVestingAccount), + converters: toConverters(MsgCreateVestingAccount) +}); +export const useCreateVestingAccount = buildUseMutation({ + builderMutationFn: createCreateVestingAccount +}); +export const createCreatePermanentLockedAccount = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgCreatePermanentLockedAccount.typeUrl, + encoders: toEncoders(MsgCreatePermanentLockedAccount), + converters: toConverters(MsgCreatePermanentLockedAccount) +}); +export const useCreatePermanentLockedAccount = buildUseMutation({ + builderMutationFn: createCreatePermanentLockedAccount +}); +export const createCreatePeriodicVestingAccount = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgCreatePeriodicVestingAccount.typeUrl, + encoders: toEncoders(MsgCreatePeriodicVestingAccount), + converters: toConverters(MsgCreatePeriodicVestingAccount) +}); +export const useCreatePeriodicVestingAccount = buildUseMutation({ + builderMutationFn: createCreatePeriodicVestingAccount +}); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/vesting/v1beta1/tx.ts b/libs/interchain-query/src/cosmos/vesting/v1beta1/tx.ts new file mode 100644 index 00000000..4e9fcb3f --- /dev/null +++ b/libs/interchain-query/src/cosmos/vesting/v1beta1/tx.ts @@ -0,0 +1,698 @@ +import { Coin, CoinAmino } from "../../base/v1beta1/coin"; +import { Period, PeriodAmino } from "./vesting"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; +/** + * MsgCreateVestingAccount defines a message that enables creating a vesting + * account. + */ +export interface MsgCreateVestingAccount { + fromAddress: string; + toAddress: string; + amount: Coin[]; + /** end of vesting as unix time (in seconds). */ + endTime: bigint; + delayed: boolean; +} +export interface MsgCreateVestingAccountProtoMsg { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreateVestingAccount"; + value: Uint8Array; +} +/** + * MsgCreateVestingAccount defines a message that enables creating a vesting + * account. + */ +export interface MsgCreateVestingAccountAmino { + from_address: string; + to_address: string; + amount: CoinAmino[]; + /** end of vesting as unix time (in seconds). */ + end_time: string; + delayed: boolean; +} +export interface MsgCreateVestingAccountAminoMsg { + type: "cosmos-sdk/MsgCreateVestingAccount"; + value: MsgCreateVestingAccountAmino; +} +/** MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount response type. */ +export interface MsgCreateVestingAccountResponse {} +export interface MsgCreateVestingAccountResponseProtoMsg { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse"; + value: Uint8Array; +} +/** MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount response type. */ +export interface MsgCreateVestingAccountResponseAmino {} +export interface MsgCreateVestingAccountResponseAminoMsg { + type: "cosmos-sdk/MsgCreateVestingAccountResponse"; + value: MsgCreateVestingAccountResponseAmino; +} +/** + * MsgCreatePermanentLockedAccount defines a message that enables creating a permanent + * locked account. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCreatePermanentLockedAccount { + fromAddress: string; + toAddress: string; + amount: Coin[]; +} +export interface MsgCreatePermanentLockedAccountProtoMsg { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount"; + value: Uint8Array; +} +/** + * MsgCreatePermanentLockedAccount defines a message that enables creating a permanent + * locked account. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCreatePermanentLockedAccountAmino { + from_address: string; + to_address: string; + amount: CoinAmino[]; +} +export interface MsgCreatePermanentLockedAccountAminoMsg { + type: "cosmos-sdk/MsgCreatePermLockedAccount"; + value: MsgCreatePermanentLockedAccountAmino; +} +/** + * MsgCreatePermanentLockedAccountResponse defines the Msg/CreatePermanentLockedAccount response type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCreatePermanentLockedAccountResponse {} +export interface MsgCreatePermanentLockedAccountResponseProtoMsg { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse"; + value: Uint8Array; +} +/** + * MsgCreatePermanentLockedAccountResponse defines the Msg/CreatePermanentLockedAccount response type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCreatePermanentLockedAccountResponseAmino {} +export interface MsgCreatePermanentLockedAccountResponseAminoMsg { + type: "cosmos-sdk/MsgCreatePermanentLockedAccountResponse"; + value: MsgCreatePermanentLockedAccountResponseAmino; +} +/** + * MsgCreateVestingAccount defines a message that enables creating a vesting + * account. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCreatePeriodicVestingAccount { + fromAddress: string; + toAddress: string; + /** start of vesting as unix time (in seconds). */ + startTime: bigint; + vestingPeriods: Period[]; +} +export interface MsgCreatePeriodicVestingAccountProtoMsg { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount"; + value: Uint8Array; +} +/** + * MsgCreateVestingAccount defines a message that enables creating a vesting + * account. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCreatePeriodicVestingAccountAmino { + from_address: string; + to_address: string; + /** start of vesting as unix time (in seconds). */ + start_time: string; + vesting_periods: PeriodAmino[]; +} +export interface MsgCreatePeriodicVestingAccountAminoMsg { + type: "cosmos-sdk/MsgCreatePeriodVestAccount"; + value: MsgCreatePeriodicVestingAccountAmino; +} +/** + * MsgCreateVestingAccountResponse defines the Msg/CreatePeriodicVestingAccount + * response type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCreatePeriodicVestingAccountResponse {} +export interface MsgCreatePeriodicVestingAccountResponseProtoMsg { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse"; + value: Uint8Array; +} +/** + * MsgCreateVestingAccountResponse defines the Msg/CreatePeriodicVestingAccount + * response type. + * + * Since: cosmos-sdk 0.46 + */ +export interface MsgCreatePeriodicVestingAccountResponseAmino {} +export interface MsgCreatePeriodicVestingAccountResponseAminoMsg { + type: "cosmos-sdk/MsgCreatePeriodicVestingAccountResponse"; + value: MsgCreatePeriodicVestingAccountResponseAmino; +} +function createBaseMsgCreateVestingAccount(): MsgCreateVestingAccount { + return { + fromAddress: "", + toAddress: "", + amount: [], + endTime: BigInt(0), + delayed: false + }; +} +export const MsgCreateVestingAccount = { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreateVestingAccount", + aminoType: "cosmos-sdk/MsgCreateVestingAccount", + is(o: any): o is MsgCreateVestingAccount { + return o && (o.$typeUrl === MsgCreateVestingAccount.typeUrl || typeof o.fromAddress === "string" && typeof o.toAddress === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0])) && typeof o.endTime === "bigint" && typeof o.delayed === "boolean"); + }, + isAmino(o: any): o is MsgCreateVestingAccountAmino { + return o && (o.$typeUrl === MsgCreateVestingAccount.typeUrl || typeof o.from_address === "string" && typeof o.to_address === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0])) && typeof o.end_time === "bigint" && typeof o.delayed === "boolean"); + }, + encode(message: MsgCreateVestingAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.fromAddress !== "") { + writer.uint32(10).string(message.fromAddress); + } + if (message.toAddress !== "") { + writer.uint32(18).string(message.toAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.endTime !== BigInt(0)) { + writer.uint32(32).int64(message.endTime); + } + if (message.delayed === true) { + writer.uint32(40).bool(message.delayed); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.fromAddress = reader.string(); + break; + case 2: + message.toAddress = reader.string(); + break; + case 3: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + case 4: + message.endTime = reader.int64(); + break; + case 5: + message.delayed = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgCreateVestingAccount { + const message = createBaseMsgCreateVestingAccount(); + message.fromAddress = object.fromAddress ?? ""; + message.toAddress = object.toAddress ?? ""; + message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; + message.endTime = object.endTime !== undefined && object.endTime !== null ? BigInt(object.endTime.toString()) : BigInt(0); + message.delayed = object.delayed ?? false; + return message; + }, + fromAmino(object: MsgCreateVestingAccountAmino): MsgCreateVestingAccount { + const message = createBaseMsgCreateVestingAccount(); + if (object.from_address !== undefined && object.from_address !== null) { + message.fromAddress = object.from_address; + } + if (object.to_address !== undefined && object.to_address !== null) { + message.toAddress = object.to_address; + } + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + if (object.end_time !== undefined && object.end_time !== null) { + message.endTime = BigInt(object.end_time); + } + if (object.delayed !== undefined && object.delayed !== null) { + message.delayed = object.delayed; + } + return message; + }, + toAmino(message: MsgCreateVestingAccount): MsgCreateVestingAccountAmino { + const obj: any = {}; + obj.from_address = message.fromAddress === "" ? undefined : message.fromAddress; + obj.to_address = message.toAddress === "" ? undefined : message.toAddress; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = message.amount; + } + obj.end_time = message.endTime !== BigInt(0) ? message.endTime?.toString() : undefined; + obj.delayed = message.delayed === false ? undefined : message.delayed; + return obj; + }, + fromAminoMsg(object: MsgCreateVestingAccountAminoMsg): MsgCreateVestingAccount { + return MsgCreateVestingAccount.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreateVestingAccount): MsgCreateVestingAccountAminoMsg { + return { + type: "cosmos-sdk/MsgCreateVestingAccount", + value: MsgCreateVestingAccount.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreateVestingAccountProtoMsg): MsgCreateVestingAccount { + return MsgCreateVestingAccount.decode(message.value); + }, + toProto(message: MsgCreateVestingAccount): Uint8Array { + return MsgCreateVestingAccount.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateVestingAccount): MsgCreateVestingAccountProtoMsg { + return { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreateVestingAccount", + value: MsgCreateVestingAccount.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgCreateVestingAccount.typeUrl, MsgCreateVestingAccount); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgCreateVestingAccount.aminoType, MsgCreateVestingAccount.typeUrl); +function createBaseMsgCreateVestingAccountResponse(): MsgCreateVestingAccountResponse { + return {}; +} +export const MsgCreateVestingAccountResponse = { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse", + aminoType: "cosmos-sdk/MsgCreateVestingAccountResponse", + is(o: any): o is MsgCreateVestingAccountResponse { + return o && o.$typeUrl === MsgCreateVestingAccountResponse.typeUrl; + }, + isAmino(o: any): o is MsgCreateVestingAccountResponseAmino { + return o && o.$typeUrl === MsgCreateVestingAccountResponse.typeUrl; + }, + encode(_: MsgCreateVestingAccountResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateVestingAccountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateVestingAccountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgCreateVestingAccountResponse { + const message = createBaseMsgCreateVestingAccountResponse(); + return message; + }, + fromAmino(_: MsgCreateVestingAccountResponseAmino): MsgCreateVestingAccountResponse { + const message = createBaseMsgCreateVestingAccountResponse(); + return message; + }, + toAmino(_: MsgCreateVestingAccountResponse): MsgCreateVestingAccountResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgCreateVestingAccountResponseAminoMsg): MsgCreateVestingAccountResponse { + return MsgCreateVestingAccountResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreateVestingAccountResponse): MsgCreateVestingAccountResponseAminoMsg { + return { + type: "cosmos-sdk/MsgCreateVestingAccountResponse", + value: MsgCreateVestingAccountResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreateVestingAccountResponseProtoMsg): MsgCreateVestingAccountResponse { + return MsgCreateVestingAccountResponse.decode(message.value); + }, + toProto(message: MsgCreateVestingAccountResponse): Uint8Array { + return MsgCreateVestingAccountResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateVestingAccountResponse): MsgCreateVestingAccountResponseProtoMsg { + return { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse", + value: MsgCreateVestingAccountResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgCreateVestingAccountResponse.typeUrl, MsgCreateVestingAccountResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgCreateVestingAccountResponse.aminoType, MsgCreateVestingAccountResponse.typeUrl); +function createBaseMsgCreatePermanentLockedAccount(): MsgCreatePermanentLockedAccount { + return { + fromAddress: "", + toAddress: "", + amount: [] + }; +} +export const MsgCreatePermanentLockedAccount = { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount", + aminoType: "cosmos-sdk/MsgCreatePermLockedAccount", + is(o: any): o is MsgCreatePermanentLockedAccount { + return o && (o.$typeUrl === MsgCreatePermanentLockedAccount.typeUrl || typeof o.fromAddress === "string" && typeof o.toAddress === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0]))); + }, + isAmino(o: any): o is MsgCreatePermanentLockedAccountAmino { + return o && (o.$typeUrl === MsgCreatePermanentLockedAccount.typeUrl || typeof o.from_address === "string" && typeof o.to_address === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0]))); + }, + encode(message: MsgCreatePermanentLockedAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.fromAddress !== "") { + writer.uint32(10).string(message.fromAddress); + } + if (message.toAddress !== "") { + writer.uint32(18).string(message.toAddress); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreatePermanentLockedAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreatePermanentLockedAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.fromAddress = reader.string(); + break; + case 2: + message.toAddress = reader.string(); + break; + case 3: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgCreatePermanentLockedAccount { + const message = createBaseMsgCreatePermanentLockedAccount(); + message.fromAddress = object.fromAddress ?? ""; + message.toAddress = object.toAddress ?? ""; + message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MsgCreatePermanentLockedAccountAmino): MsgCreatePermanentLockedAccount { + const message = createBaseMsgCreatePermanentLockedAccount(); + if (object.from_address !== undefined && object.from_address !== null) { + message.fromAddress = object.from_address; + } + if (object.to_address !== undefined && object.to_address !== null) { + message.toAddress = object.to_address; + } + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgCreatePermanentLockedAccount): MsgCreatePermanentLockedAccountAmino { + const obj: any = {}; + obj.from_address = message.fromAddress === "" ? undefined : message.fromAddress; + obj.to_address = message.toAddress === "" ? undefined : message.toAddress; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = message.amount; + } + return obj; + }, + fromAminoMsg(object: MsgCreatePermanentLockedAccountAminoMsg): MsgCreatePermanentLockedAccount { + return MsgCreatePermanentLockedAccount.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreatePermanentLockedAccount): MsgCreatePermanentLockedAccountAminoMsg { + return { + type: "cosmos-sdk/MsgCreatePermLockedAccount", + value: MsgCreatePermanentLockedAccount.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreatePermanentLockedAccountProtoMsg): MsgCreatePermanentLockedAccount { + return MsgCreatePermanentLockedAccount.decode(message.value); + }, + toProto(message: MsgCreatePermanentLockedAccount): Uint8Array { + return MsgCreatePermanentLockedAccount.encode(message).finish(); + }, + toProtoMsg(message: MsgCreatePermanentLockedAccount): MsgCreatePermanentLockedAccountProtoMsg { + return { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccount", + value: MsgCreatePermanentLockedAccount.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgCreatePermanentLockedAccount.typeUrl, MsgCreatePermanentLockedAccount); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgCreatePermanentLockedAccount.aminoType, MsgCreatePermanentLockedAccount.typeUrl); +function createBaseMsgCreatePermanentLockedAccountResponse(): MsgCreatePermanentLockedAccountResponse { + return {}; +} +export const MsgCreatePermanentLockedAccountResponse = { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse", + aminoType: "cosmos-sdk/MsgCreatePermanentLockedAccountResponse", + is(o: any): o is MsgCreatePermanentLockedAccountResponse { + return o && o.$typeUrl === MsgCreatePermanentLockedAccountResponse.typeUrl; + }, + isAmino(o: any): o is MsgCreatePermanentLockedAccountResponseAmino { + return o && o.$typeUrl === MsgCreatePermanentLockedAccountResponse.typeUrl; + }, + encode(_: MsgCreatePermanentLockedAccountResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreatePermanentLockedAccountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreatePermanentLockedAccountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgCreatePermanentLockedAccountResponse { + const message = createBaseMsgCreatePermanentLockedAccountResponse(); + return message; + }, + fromAmino(_: MsgCreatePermanentLockedAccountResponseAmino): MsgCreatePermanentLockedAccountResponse { + const message = createBaseMsgCreatePermanentLockedAccountResponse(); + return message; + }, + toAmino(_: MsgCreatePermanentLockedAccountResponse): MsgCreatePermanentLockedAccountResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgCreatePermanentLockedAccountResponseAminoMsg): MsgCreatePermanentLockedAccountResponse { + return MsgCreatePermanentLockedAccountResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreatePermanentLockedAccountResponse): MsgCreatePermanentLockedAccountResponseAminoMsg { + return { + type: "cosmos-sdk/MsgCreatePermanentLockedAccountResponse", + value: MsgCreatePermanentLockedAccountResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreatePermanentLockedAccountResponseProtoMsg): MsgCreatePermanentLockedAccountResponse { + return MsgCreatePermanentLockedAccountResponse.decode(message.value); + }, + toProto(message: MsgCreatePermanentLockedAccountResponse): Uint8Array { + return MsgCreatePermanentLockedAccountResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgCreatePermanentLockedAccountResponse): MsgCreatePermanentLockedAccountResponseProtoMsg { + return { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePermanentLockedAccountResponse", + value: MsgCreatePermanentLockedAccountResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgCreatePermanentLockedAccountResponse.typeUrl, MsgCreatePermanentLockedAccountResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgCreatePermanentLockedAccountResponse.aminoType, MsgCreatePermanentLockedAccountResponse.typeUrl); +function createBaseMsgCreatePeriodicVestingAccount(): MsgCreatePeriodicVestingAccount { + return { + fromAddress: "", + toAddress: "", + startTime: BigInt(0), + vestingPeriods: [] + }; +} +export const MsgCreatePeriodicVestingAccount = { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount", + aminoType: "cosmos-sdk/MsgCreatePeriodVestAccount", + is(o: any): o is MsgCreatePeriodicVestingAccount { + return o && (o.$typeUrl === MsgCreatePeriodicVestingAccount.typeUrl || typeof o.fromAddress === "string" && typeof o.toAddress === "string" && typeof o.startTime === "bigint" && Array.isArray(o.vestingPeriods) && (!o.vestingPeriods.length || Period.is(o.vestingPeriods[0]))); + }, + isAmino(o: any): o is MsgCreatePeriodicVestingAccountAmino { + return o && (o.$typeUrl === MsgCreatePeriodicVestingAccount.typeUrl || typeof o.from_address === "string" && typeof o.to_address === "string" && typeof o.start_time === "bigint" && Array.isArray(o.vesting_periods) && (!o.vesting_periods.length || Period.isAmino(o.vesting_periods[0]))); + }, + encode(message: MsgCreatePeriodicVestingAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.fromAddress !== "") { + writer.uint32(10).string(message.fromAddress); + } + if (message.toAddress !== "") { + writer.uint32(18).string(message.toAddress); + } + if (message.startTime !== BigInt(0)) { + writer.uint32(24).int64(message.startTime); + } + for (const v of message.vestingPeriods) { + Period.encode(v!, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreatePeriodicVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreatePeriodicVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.fromAddress = reader.string(); + break; + case 2: + message.toAddress = reader.string(); + break; + case 3: + message.startTime = reader.int64(); + break; + case 4: + message.vestingPeriods.push(Period.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgCreatePeriodicVestingAccount { + const message = createBaseMsgCreatePeriodicVestingAccount(); + message.fromAddress = object.fromAddress ?? ""; + message.toAddress = object.toAddress ?? ""; + message.startTime = object.startTime !== undefined && object.startTime !== null ? BigInt(object.startTime.toString()) : BigInt(0); + message.vestingPeriods = object.vestingPeriods?.map(e => Period.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MsgCreatePeriodicVestingAccountAmino): MsgCreatePeriodicVestingAccount { + const message = createBaseMsgCreatePeriodicVestingAccount(); + if (object.from_address !== undefined && object.from_address !== null) { + message.fromAddress = object.from_address; + } + if (object.to_address !== undefined && object.to_address !== null) { + message.toAddress = object.to_address; + } + if (object.start_time !== undefined && object.start_time !== null) { + message.startTime = BigInt(object.start_time); + } + message.vestingPeriods = object.vesting_periods?.map(e => Period.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgCreatePeriodicVestingAccount): MsgCreatePeriodicVestingAccountAmino { + const obj: any = {}; + obj.from_address = message.fromAddress === "" ? undefined : message.fromAddress; + obj.to_address = message.toAddress === "" ? undefined : message.toAddress; + obj.start_time = message.startTime !== BigInt(0) ? message.startTime?.toString() : undefined; + if (message.vestingPeriods) { + obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e) : undefined); + } else { + obj.vesting_periods = message.vestingPeriods; + } + return obj; + }, + fromAminoMsg(object: MsgCreatePeriodicVestingAccountAminoMsg): MsgCreatePeriodicVestingAccount { + return MsgCreatePeriodicVestingAccount.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreatePeriodicVestingAccount): MsgCreatePeriodicVestingAccountAminoMsg { + return { + type: "cosmos-sdk/MsgCreatePeriodVestAccount", + value: MsgCreatePeriodicVestingAccount.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreatePeriodicVestingAccountProtoMsg): MsgCreatePeriodicVestingAccount { + return MsgCreatePeriodicVestingAccount.decode(message.value); + }, + toProto(message: MsgCreatePeriodicVestingAccount): Uint8Array { + return MsgCreatePeriodicVestingAccount.encode(message).finish(); + }, + toProtoMsg(message: MsgCreatePeriodicVestingAccount): MsgCreatePeriodicVestingAccountProtoMsg { + return { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccount", + value: MsgCreatePeriodicVestingAccount.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgCreatePeriodicVestingAccount.typeUrl, MsgCreatePeriodicVestingAccount); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgCreatePeriodicVestingAccount.aminoType, MsgCreatePeriodicVestingAccount.typeUrl); +function createBaseMsgCreatePeriodicVestingAccountResponse(): MsgCreatePeriodicVestingAccountResponse { + return {}; +} +export const MsgCreatePeriodicVestingAccountResponse = { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse", + aminoType: "cosmos-sdk/MsgCreatePeriodicVestingAccountResponse", + is(o: any): o is MsgCreatePeriodicVestingAccountResponse { + return o && o.$typeUrl === MsgCreatePeriodicVestingAccountResponse.typeUrl; + }, + isAmino(o: any): o is MsgCreatePeriodicVestingAccountResponseAmino { + return o && o.$typeUrl === MsgCreatePeriodicVestingAccountResponse.typeUrl; + }, + encode(_: MsgCreatePeriodicVestingAccountResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreatePeriodicVestingAccountResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreatePeriodicVestingAccountResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgCreatePeriodicVestingAccountResponse { + const message = createBaseMsgCreatePeriodicVestingAccountResponse(); + return message; + }, + fromAmino(_: MsgCreatePeriodicVestingAccountResponseAmino): MsgCreatePeriodicVestingAccountResponse { + const message = createBaseMsgCreatePeriodicVestingAccountResponse(); + return message; + }, + toAmino(_: MsgCreatePeriodicVestingAccountResponse): MsgCreatePeriodicVestingAccountResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgCreatePeriodicVestingAccountResponseAminoMsg): MsgCreatePeriodicVestingAccountResponse { + return MsgCreatePeriodicVestingAccountResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreatePeriodicVestingAccountResponse): MsgCreatePeriodicVestingAccountResponseAminoMsg { + return { + type: "cosmos-sdk/MsgCreatePeriodicVestingAccountResponse", + value: MsgCreatePeriodicVestingAccountResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreatePeriodicVestingAccountResponseProtoMsg): MsgCreatePeriodicVestingAccountResponse { + return MsgCreatePeriodicVestingAccountResponse.decode(message.value); + }, + toProto(message: MsgCreatePeriodicVestingAccountResponse): Uint8Array { + return MsgCreatePeriodicVestingAccountResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgCreatePeriodicVestingAccountResponse): MsgCreatePeriodicVestingAccountResponseProtoMsg { + return { + typeUrl: "/cosmos.vesting.v1beta1.MsgCreatePeriodicVestingAccountResponse", + value: MsgCreatePeriodicVestingAccountResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgCreatePeriodicVestingAccountResponse.typeUrl, MsgCreatePeriodicVestingAccountResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgCreatePeriodicVestingAccountResponse.aminoType, MsgCreatePeriodicVestingAccountResponse.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos/vesting/v1beta1/vesting.ts b/libs/interchain-query/src/cosmos/vesting/v1beta1/vesting.ts new file mode 100644 index 00000000..91f05562 --- /dev/null +++ b/libs/interchain-query/src/cosmos/vesting/v1beta1/vesting.ts @@ -0,0 +1,735 @@ +import { BaseAccount, BaseAccountAmino } from "../../auth/v1beta1/auth"; +import { Coin, CoinAmino } from "../../base/v1beta1/coin"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; +/** + * BaseVestingAccount implements the VestingAccount interface. It contains all + * the necessary fields needed for any vesting account implementation. + */ +export interface BaseVestingAccount { + baseAccount?: BaseAccount; + originalVesting: Coin[]; + delegatedFree: Coin[]; + delegatedVesting: Coin[]; + /** Vesting end time, as unix timestamp (in seconds). */ + endTime: bigint; +} +export interface BaseVestingAccountProtoMsg { + typeUrl: "/cosmos.vesting.v1beta1.BaseVestingAccount"; + value: Uint8Array; +} +/** + * BaseVestingAccount implements the VestingAccount interface. It contains all + * the necessary fields needed for any vesting account implementation. + */ +export interface BaseVestingAccountAmino { + base_account?: BaseAccountAmino; + original_vesting: CoinAmino[]; + delegated_free: CoinAmino[]; + delegated_vesting: CoinAmino[]; + /** Vesting end time, as unix timestamp (in seconds). */ + end_time: string; +} +export interface BaseVestingAccountAminoMsg { + type: "cosmos-sdk/BaseVestingAccount"; + value: BaseVestingAccountAmino; +} +/** + * ContinuousVestingAccount implements the VestingAccount interface. It + * continuously vests by unlocking coins linearly with respect to time. + */ +export interface ContinuousVestingAccount { + baseVestingAccount?: BaseVestingAccount; + /** Vesting start time, as unix timestamp (in seconds). */ + startTime: bigint; +} +export interface ContinuousVestingAccountProtoMsg { + typeUrl: "/cosmos.vesting.v1beta1.ContinuousVestingAccount"; + value: Uint8Array; +} +/** + * ContinuousVestingAccount implements the VestingAccount interface. It + * continuously vests by unlocking coins linearly with respect to time. + */ +export interface ContinuousVestingAccountAmino { + base_vesting_account?: BaseVestingAccountAmino; + /** Vesting start time, as unix timestamp (in seconds). */ + start_time: string; +} +export interface ContinuousVestingAccountAminoMsg { + type: "cosmos-sdk/ContinuousVestingAccount"; + value: ContinuousVestingAccountAmino; +} +/** + * DelayedVestingAccount implements the VestingAccount interface. It vests all + * coins after a specific time, but non prior. In other words, it keeps them + * locked until a specified time. + */ +export interface DelayedVestingAccount { + baseVestingAccount?: BaseVestingAccount; +} +export interface DelayedVestingAccountProtoMsg { + typeUrl: "/cosmos.vesting.v1beta1.DelayedVestingAccount"; + value: Uint8Array; +} +/** + * DelayedVestingAccount implements the VestingAccount interface. It vests all + * coins after a specific time, but non prior. In other words, it keeps them + * locked until a specified time. + */ +export interface DelayedVestingAccountAmino { + base_vesting_account?: BaseVestingAccountAmino; +} +export interface DelayedVestingAccountAminoMsg { + type: "cosmos-sdk/DelayedVestingAccount"; + value: DelayedVestingAccountAmino; +} +/** Period defines a length of time and amount of coins that will vest. */ +export interface Period { + /** Period duration in seconds. */ + length: bigint; + amount: Coin[]; +} +export interface PeriodProtoMsg { + typeUrl: "/cosmos.vesting.v1beta1.Period"; + value: Uint8Array; +} +/** Period defines a length of time and amount of coins that will vest. */ +export interface PeriodAmino { + /** Period duration in seconds. */ + length: string; + amount: CoinAmino[]; +} +export interface PeriodAminoMsg { + type: "cosmos-sdk/Period"; + value: PeriodAmino; +} +/** + * PeriodicVestingAccount implements the VestingAccount interface. It + * periodically vests by unlocking coins during each specified period. + */ +export interface PeriodicVestingAccount { + baseVestingAccount?: BaseVestingAccount; + startTime: bigint; + vestingPeriods: Period[]; +} +export interface PeriodicVestingAccountProtoMsg { + typeUrl: "/cosmos.vesting.v1beta1.PeriodicVestingAccount"; + value: Uint8Array; +} +/** + * PeriodicVestingAccount implements the VestingAccount interface. It + * periodically vests by unlocking coins during each specified period. + */ +export interface PeriodicVestingAccountAmino { + base_vesting_account?: BaseVestingAccountAmino; + start_time: string; + vesting_periods: PeriodAmino[]; +} +export interface PeriodicVestingAccountAminoMsg { + type: "cosmos-sdk/PeriodicVestingAccount"; + value: PeriodicVestingAccountAmino; +} +/** + * PermanentLockedAccount implements the VestingAccount interface. It does + * not ever release coins, locking them indefinitely. Coins in this account can + * still be used for delegating and for governance votes even while locked. + * + * Since: cosmos-sdk 0.43 + */ +export interface PermanentLockedAccount { + baseVestingAccount?: BaseVestingAccount; +} +export interface PermanentLockedAccountProtoMsg { + typeUrl: "/cosmos.vesting.v1beta1.PermanentLockedAccount"; + value: Uint8Array; +} +/** + * PermanentLockedAccount implements the VestingAccount interface. It does + * not ever release coins, locking them indefinitely. Coins in this account can + * still be used for delegating and for governance votes even while locked. + * + * Since: cosmos-sdk 0.43 + */ +export interface PermanentLockedAccountAmino { + base_vesting_account?: BaseVestingAccountAmino; +} +export interface PermanentLockedAccountAminoMsg { + type: "cosmos-sdk/PermanentLockedAccount"; + value: PermanentLockedAccountAmino; +} +function createBaseBaseVestingAccount(): BaseVestingAccount { + return { + baseAccount: undefined, + originalVesting: [], + delegatedFree: [], + delegatedVesting: [], + endTime: BigInt(0) + }; +} +export const BaseVestingAccount = { + typeUrl: "/cosmos.vesting.v1beta1.BaseVestingAccount", + aminoType: "cosmos-sdk/BaseVestingAccount", + is(o: any): o is BaseVestingAccount { + return o && (o.$typeUrl === BaseVestingAccount.typeUrl || Array.isArray(o.originalVesting) && (!o.originalVesting.length || Coin.is(o.originalVesting[0])) && Array.isArray(o.delegatedFree) && (!o.delegatedFree.length || Coin.is(o.delegatedFree[0])) && Array.isArray(o.delegatedVesting) && (!o.delegatedVesting.length || Coin.is(o.delegatedVesting[0])) && typeof o.endTime === "bigint"); + }, + isAmino(o: any): o is BaseVestingAccountAmino { + return o && (o.$typeUrl === BaseVestingAccount.typeUrl || Array.isArray(o.original_vesting) && (!o.original_vesting.length || Coin.isAmino(o.original_vesting[0])) && Array.isArray(o.delegated_free) && (!o.delegated_free.length || Coin.isAmino(o.delegated_free[0])) && Array.isArray(o.delegated_vesting) && (!o.delegated_vesting.length || Coin.isAmino(o.delegated_vesting[0])) && typeof o.end_time === "bigint"); + }, + encode(message: BaseVestingAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.baseAccount !== undefined) { + BaseAccount.encode(message.baseAccount, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.originalVesting) { + Coin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.delegatedFree) { + Coin.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.delegatedVesting) { + Coin.encode(v!, writer.uint32(34).fork()).ldelim(); + } + if (message.endTime !== BigInt(0)) { + writer.uint32(40).int64(message.endTime); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): BaseVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBaseVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.baseAccount = BaseAccount.decode(reader, reader.uint32()); + break; + case 2: + message.originalVesting.push(Coin.decode(reader, reader.uint32())); + break; + case 3: + message.delegatedFree.push(Coin.decode(reader, reader.uint32())); + break; + case 4: + message.delegatedVesting.push(Coin.decode(reader, reader.uint32())); + break; + case 5: + message.endTime = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): BaseVestingAccount { + const message = createBaseBaseVestingAccount(); + message.baseAccount = object.baseAccount !== undefined && object.baseAccount !== null ? BaseAccount.fromPartial(object.baseAccount) : undefined; + message.originalVesting = object.originalVesting?.map(e => Coin.fromPartial(e)) || []; + message.delegatedFree = object.delegatedFree?.map(e => Coin.fromPartial(e)) || []; + message.delegatedVesting = object.delegatedVesting?.map(e => Coin.fromPartial(e)) || []; + message.endTime = object.endTime !== undefined && object.endTime !== null ? BigInt(object.endTime.toString()) : BigInt(0); + return message; + }, + fromAmino(object: BaseVestingAccountAmino): BaseVestingAccount { + const message = createBaseBaseVestingAccount(); + if (object.base_account !== undefined && object.base_account !== null) { + message.baseAccount = BaseAccount.fromAmino(object.base_account); + } + message.originalVesting = object.original_vesting?.map(e => Coin.fromAmino(e)) || []; + message.delegatedFree = object.delegated_free?.map(e => Coin.fromAmino(e)) || []; + message.delegatedVesting = object.delegated_vesting?.map(e => Coin.fromAmino(e)) || []; + if (object.end_time !== undefined && object.end_time !== null) { + message.endTime = BigInt(object.end_time); + } + return message; + }, + toAmino(message: BaseVestingAccount): BaseVestingAccountAmino { + const obj: any = {}; + obj.base_account = message.baseAccount ? BaseAccount.toAmino(message.baseAccount) : undefined; + if (message.originalVesting) { + obj.original_vesting = message.originalVesting.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.original_vesting = message.originalVesting; + } + if (message.delegatedFree) { + obj.delegated_free = message.delegatedFree.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.delegated_free = message.delegatedFree; + } + if (message.delegatedVesting) { + obj.delegated_vesting = message.delegatedVesting.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.delegated_vesting = message.delegatedVesting; + } + obj.end_time = message.endTime !== BigInt(0) ? message.endTime?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: BaseVestingAccountAminoMsg): BaseVestingAccount { + return BaseVestingAccount.fromAmino(object.value); + }, + toAminoMsg(message: BaseVestingAccount): BaseVestingAccountAminoMsg { + return { + type: "cosmos-sdk/BaseVestingAccount", + value: BaseVestingAccount.toAmino(message) + }; + }, + fromProtoMsg(message: BaseVestingAccountProtoMsg): BaseVestingAccount { + return BaseVestingAccount.decode(message.value); + }, + toProto(message: BaseVestingAccount): Uint8Array { + return BaseVestingAccount.encode(message).finish(); + }, + toProtoMsg(message: BaseVestingAccount): BaseVestingAccountProtoMsg { + return { + typeUrl: "/cosmos.vesting.v1beta1.BaseVestingAccount", + value: BaseVestingAccount.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(BaseVestingAccount.typeUrl, BaseVestingAccount); +GlobalDecoderRegistry.registerAminoProtoMapping(BaseVestingAccount.aminoType, BaseVestingAccount.typeUrl); +function createBaseContinuousVestingAccount(): ContinuousVestingAccount { + return { + baseVestingAccount: undefined, + startTime: BigInt(0) + }; +} +export const ContinuousVestingAccount = { + typeUrl: "/cosmos.vesting.v1beta1.ContinuousVestingAccount", + aminoType: "cosmos-sdk/ContinuousVestingAccount", + is(o: any): o is ContinuousVestingAccount { + return o && (o.$typeUrl === ContinuousVestingAccount.typeUrl || typeof o.startTime === "bigint"); + }, + isAmino(o: any): o is ContinuousVestingAccountAmino { + return o && (o.$typeUrl === ContinuousVestingAccount.typeUrl || typeof o.start_time === "bigint"); + }, + encode(message: ContinuousVestingAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.baseVestingAccount !== undefined) { + BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).ldelim(); + } + if (message.startTime !== BigInt(0)) { + writer.uint32(16).int64(message.startTime); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ContinuousVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContinuousVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.baseVestingAccount = BaseVestingAccount.decode(reader, reader.uint32()); + break; + case 2: + message.startTime = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ContinuousVestingAccount { + const message = createBaseContinuousVestingAccount(); + message.baseVestingAccount = object.baseVestingAccount !== undefined && object.baseVestingAccount !== null ? BaseVestingAccount.fromPartial(object.baseVestingAccount) : undefined; + message.startTime = object.startTime !== undefined && object.startTime !== null ? BigInt(object.startTime.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ContinuousVestingAccountAmino): ContinuousVestingAccount { + const message = createBaseContinuousVestingAccount(); + if (object.base_vesting_account !== undefined && object.base_vesting_account !== null) { + message.baseVestingAccount = BaseVestingAccount.fromAmino(object.base_vesting_account); + } + if (object.start_time !== undefined && object.start_time !== null) { + message.startTime = BigInt(object.start_time); + } + return message; + }, + toAmino(message: ContinuousVestingAccount): ContinuousVestingAccountAmino { + const obj: any = {}; + obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; + obj.start_time = message.startTime !== BigInt(0) ? message.startTime?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ContinuousVestingAccountAminoMsg): ContinuousVestingAccount { + return ContinuousVestingAccount.fromAmino(object.value); + }, + toAminoMsg(message: ContinuousVestingAccount): ContinuousVestingAccountAminoMsg { + return { + type: "cosmos-sdk/ContinuousVestingAccount", + value: ContinuousVestingAccount.toAmino(message) + }; + }, + fromProtoMsg(message: ContinuousVestingAccountProtoMsg): ContinuousVestingAccount { + return ContinuousVestingAccount.decode(message.value); + }, + toProto(message: ContinuousVestingAccount): Uint8Array { + return ContinuousVestingAccount.encode(message).finish(); + }, + toProtoMsg(message: ContinuousVestingAccount): ContinuousVestingAccountProtoMsg { + return { + typeUrl: "/cosmos.vesting.v1beta1.ContinuousVestingAccount", + value: ContinuousVestingAccount.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ContinuousVestingAccount.typeUrl, ContinuousVestingAccount); +GlobalDecoderRegistry.registerAminoProtoMapping(ContinuousVestingAccount.aminoType, ContinuousVestingAccount.typeUrl); +function createBaseDelayedVestingAccount(): DelayedVestingAccount { + return { + baseVestingAccount: undefined + }; +} +export const DelayedVestingAccount = { + typeUrl: "/cosmos.vesting.v1beta1.DelayedVestingAccount", + aminoType: "cosmos-sdk/DelayedVestingAccount", + is(o: any): o is DelayedVestingAccount { + return o && o.$typeUrl === DelayedVestingAccount.typeUrl; + }, + isAmino(o: any): o is DelayedVestingAccountAmino { + return o && o.$typeUrl === DelayedVestingAccount.typeUrl; + }, + encode(message: DelayedVestingAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.baseVestingAccount !== undefined) { + BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DelayedVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDelayedVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.baseVestingAccount = BaseVestingAccount.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): DelayedVestingAccount { + const message = createBaseDelayedVestingAccount(); + message.baseVestingAccount = object.baseVestingAccount !== undefined && object.baseVestingAccount !== null ? BaseVestingAccount.fromPartial(object.baseVestingAccount) : undefined; + return message; + }, + fromAmino(object: DelayedVestingAccountAmino): DelayedVestingAccount { + const message = createBaseDelayedVestingAccount(); + if (object.base_vesting_account !== undefined && object.base_vesting_account !== null) { + message.baseVestingAccount = BaseVestingAccount.fromAmino(object.base_vesting_account); + } + return message; + }, + toAmino(message: DelayedVestingAccount): DelayedVestingAccountAmino { + const obj: any = {}; + obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; + return obj; + }, + fromAminoMsg(object: DelayedVestingAccountAminoMsg): DelayedVestingAccount { + return DelayedVestingAccount.fromAmino(object.value); + }, + toAminoMsg(message: DelayedVestingAccount): DelayedVestingAccountAminoMsg { + return { + type: "cosmos-sdk/DelayedVestingAccount", + value: DelayedVestingAccount.toAmino(message) + }; + }, + fromProtoMsg(message: DelayedVestingAccountProtoMsg): DelayedVestingAccount { + return DelayedVestingAccount.decode(message.value); + }, + toProto(message: DelayedVestingAccount): Uint8Array { + return DelayedVestingAccount.encode(message).finish(); + }, + toProtoMsg(message: DelayedVestingAccount): DelayedVestingAccountProtoMsg { + return { + typeUrl: "/cosmos.vesting.v1beta1.DelayedVestingAccount", + value: DelayedVestingAccount.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(DelayedVestingAccount.typeUrl, DelayedVestingAccount); +GlobalDecoderRegistry.registerAminoProtoMapping(DelayedVestingAccount.aminoType, DelayedVestingAccount.typeUrl); +function createBasePeriod(): Period { + return { + length: BigInt(0), + amount: [] + }; +} +export const Period = { + typeUrl: "/cosmos.vesting.v1beta1.Period", + aminoType: "cosmos-sdk/Period", + is(o: any): o is Period { + return o && (o.$typeUrl === Period.typeUrl || typeof o.length === "bigint" && Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0]))); + }, + isAmino(o: any): o is PeriodAmino { + return o && (o.$typeUrl === Period.typeUrl || typeof o.length === "bigint" && Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0]))); + }, + encode(message: Period, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.length !== BigInt(0)) { + writer.uint32(8).int64(message.length); + } + for (const v of message.amount) { + Coin.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Period { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePeriod(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.length = reader.int64(); + break; + case 2: + message.amount.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Period { + const message = createBasePeriod(); + message.length = object.length !== undefined && object.length !== null ? BigInt(object.length.toString()) : BigInt(0); + message.amount = object.amount?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: PeriodAmino): Period { + const message = createBasePeriod(); + if (object.length !== undefined && object.length !== null) { + message.length = BigInt(object.length); + } + message.amount = object.amount?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: Period): PeriodAmino { + const obj: any = {}; + obj.length = message.length !== BigInt(0) ? message.length?.toString() : undefined; + if (message.amount) { + obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.amount = message.amount; + } + return obj; + }, + fromAminoMsg(object: PeriodAminoMsg): Period { + return Period.fromAmino(object.value); + }, + toAminoMsg(message: Period): PeriodAminoMsg { + return { + type: "cosmos-sdk/Period", + value: Period.toAmino(message) + }; + }, + fromProtoMsg(message: PeriodProtoMsg): Period { + return Period.decode(message.value); + }, + toProto(message: Period): Uint8Array { + return Period.encode(message).finish(); + }, + toProtoMsg(message: Period): PeriodProtoMsg { + return { + typeUrl: "/cosmos.vesting.v1beta1.Period", + value: Period.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Period.typeUrl, Period); +GlobalDecoderRegistry.registerAminoProtoMapping(Period.aminoType, Period.typeUrl); +function createBasePeriodicVestingAccount(): PeriodicVestingAccount { + return { + baseVestingAccount: undefined, + startTime: BigInt(0), + vestingPeriods: [] + }; +} +export const PeriodicVestingAccount = { + typeUrl: "/cosmos.vesting.v1beta1.PeriodicVestingAccount", + aminoType: "cosmos-sdk/PeriodicVestingAccount", + is(o: any): o is PeriodicVestingAccount { + return o && (o.$typeUrl === PeriodicVestingAccount.typeUrl || typeof o.startTime === "bigint" && Array.isArray(o.vestingPeriods) && (!o.vestingPeriods.length || Period.is(o.vestingPeriods[0]))); + }, + isAmino(o: any): o is PeriodicVestingAccountAmino { + return o && (o.$typeUrl === PeriodicVestingAccount.typeUrl || typeof o.start_time === "bigint" && Array.isArray(o.vesting_periods) && (!o.vesting_periods.length || Period.isAmino(o.vesting_periods[0]))); + }, + encode(message: PeriodicVestingAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.baseVestingAccount !== undefined) { + BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).ldelim(); + } + if (message.startTime !== BigInt(0)) { + writer.uint32(16).int64(message.startTime); + } + for (const v of message.vestingPeriods) { + Period.encode(v!, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PeriodicVestingAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePeriodicVestingAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.baseVestingAccount = BaseVestingAccount.decode(reader, reader.uint32()); + break; + case 2: + message.startTime = reader.int64(); + break; + case 3: + message.vestingPeriods.push(Period.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): PeriodicVestingAccount { + const message = createBasePeriodicVestingAccount(); + message.baseVestingAccount = object.baseVestingAccount !== undefined && object.baseVestingAccount !== null ? BaseVestingAccount.fromPartial(object.baseVestingAccount) : undefined; + message.startTime = object.startTime !== undefined && object.startTime !== null ? BigInt(object.startTime.toString()) : BigInt(0); + message.vestingPeriods = object.vestingPeriods?.map(e => Period.fromPartial(e)) || []; + return message; + }, + fromAmino(object: PeriodicVestingAccountAmino): PeriodicVestingAccount { + const message = createBasePeriodicVestingAccount(); + if (object.base_vesting_account !== undefined && object.base_vesting_account !== null) { + message.baseVestingAccount = BaseVestingAccount.fromAmino(object.base_vesting_account); + } + if (object.start_time !== undefined && object.start_time !== null) { + message.startTime = BigInt(object.start_time); + } + message.vestingPeriods = object.vesting_periods?.map(e => Period.fromAmino(e)) || []; + return message; + }, + toAmino(message: PeriodicVestingAccount): PeriodicVestingAccountAmino { + const obj: any = {}; + obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; + obj.start_time = message.startTime !== BigInt(0) ? message.startTime?.toString() : undefined; + if (message.vestingPeriods) { + obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e) : undefined); + } else { + obj.vesting_periods = message.vestingPeriods; + } + return obj; + }, + fromAminoMsg(object: PeriodicVestingAccountAminoMsg): PeriodicVestingAccount { + return PeriodicVestingAccount.fromAmino(object.value); + }, + toAminoMsg(message: PeriodicVestingAccount): PeriodicVestingAccountAminoMsg { + return { + type: "cosmos-sdk/PeriodicVestingAccount", + value: PeriodicVestingAccount.toAmino(message) + }; + }, + fromProtoMsg(message: PeriodicVestingAccountProtoMsg): PeriodicVestingAccount { + return PeriodicVestingAccount.decode(message.value); + }, + toProto(message: PeriodicVestingAccount): Uint8Array { + return PeriodicVestingAccount.encode(message).finish(); + }, + toProtoMsg(message: PeriodicVestingAccount): PeriodicVestingAccountProtoMsg { + return { + typeUrl: "/cosmos.vesting.v1beta1.PeriodicVestingAccount", + value: PeriodicVestingAccount.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(PeriodicVestingAccount.typeUrl, PeriodicVestingAccount); +GlobalDecoderRegistry.registerAminoProtoMapping(PeriodicVestingAccount.aminoType, PeriodicVestingAccount.typeUrl); +function createBasePermanentLockedAccount(): PermanentLockedAccount { + return { + baseVestingAccount: undefined + }; +} +export const PermanentLockedAccount = { + typeUrl: "/cosmos.vesting.v1beta1.PermanentLockedAccount", + aminoType: "cosmos-sdk/PermanentLockedAccount", + is(o: any): o is PermanentLockedAccount { + return o && o.$typeUrl === PermanentLockedAccount.typeUrl; + }, + isAmino(o: any): o is PermanentLockedAccountAmino { + return o && o.$typeUrl === PermanentLockedAccount.typeUrl; + }, + encode(message: PermanentLockedAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.baseVestingAccount !== undefined) { + BaseVestingAccount.encode(message.baseVestingAccount, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PermanentLockedAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePermanentLockedAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.baseVestingAccount = BaseVestingAccount.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): PermanentLockedAccount { + const message = createBasePermanentLockedAccount(); + message.baseVestingAccount = object.baseVestingAccount !== undefined && object.baseVestingAccount !== null ? BaseVestingAccount.fromPartial(object.baseVestingAccount) : undefined; + return message; + }, + fromAmino(object: PermanentLockedAccountAmino): PermanentLockedAccount { + const message = createBasePermanentLockedAccount(); + if (object.base_vesting_account !== undefined && object.base_vesting_account !== null) { + message.baseVestingAccount = BaseVestingAccount.fromAmino(object.base_vesting_account); + } + return message; + }, + toAmino(message: PermanentLockedAccount): PermanentLockedAccountAmino { + const obj: any = {}; + obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; + return obj; + }, + fromAminoMsg(object: PermanentLockedAccountAminoMsg): PermanentLockedAccount { + return PermanentLockedAccount.fromAmino(object.value); + }, + toAminoMsg(message: PermanentLockedAccount): PermanentLockedAccountAminoMsg { + return { + type: "cosmos-sdk/PermanentLockedAccount", + value: PermanentLockedAccount.toAmino(message) + }; + }, + fromProtoMsg(message: PermanentLockedAccountProtoMsg): PermanentLockedAccount { + return PermanentLockedAccount.decode(message.value); + }, + toProto(message: PermanentLockedAccount): Uint8Array { + return PermanentLockedAccount.encode(message).finish(); + }, + toProtoMsg(message: PermanentLockedAccount): PermanentLockedAccountProtoMsg { + return { + typeUrl: "/cosmos.vesting.v1beta1.PermanentLockedAccount", + value: PermanentLockedAccount.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(PermanentLockedAccount.typeUrl, PermanentLockedAccount); +GlobalDecoderRegistry.registerAminoProtoMapping(PermanentLockedAccount.aminoType, PermanentLockedAccount.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmos_proto/cosmos.ts b/libs/interchain-query/src/cosmos_proto/cosmos.ts new file mode 100644 index 00000000..0a97877f --- /dev/null +++ b/libs/interchain-query/src/cosmos_proto/cosmos.ts @@ -0,0 +1,341 @@ +import { BinaryReader, BinaryWriter } from "../binary"; +import { DeepPartial } from "../helpers"; +import { GlobalDecoderRegistry } from "../registry"; +export enum ScalarType { + SCALAR_TYPE_UNSPECIFIED = 0, + SCALAR_TYPE_STRING = 1, + SCALAR_TYPE_BYTES = 2, + UNRECOGNIZED = -1, +} +export const ScalarTypeAmino = ScalarType; +export function scalarTypeFromJSON(object: any): ScalarType { + switch (object) { + case 0: + case "SCALAR_TYPE_UNSPECIFIED": + return ScalarType.SCALAR_TYPE_UNSPECIFIED; + case 1: + case "SCALAR_TYPE_STRING": + return ScalarType.SCALAR_TYPE_STRING; + case 2: + case "SCALAR_TYPE_BYTES": + return ScalarType.SCALAR_TYPE_BYTES; + case -1: + case "UNRECOGNIZED": + default: + return ScalarType.UNRECOGNIZED; + } +} +export function scalarTypeToJSON(object: ScalarType): string { + switch (object) { + case ScalarType.SCALAR_TYPE_UNSPECIFIED: + return "SCALAR_TYPE_UNSPECIFIED"; + case ScalarType.SCALAR_TYPE_STRING: + return "SCALAR_TYPE_STRING"; + case ScalarType.SCALAR_TYPE_BYTES: + return "SCALAR_TYPE_BYTES"; + case ScalarType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** + * InterfaceDescriptor describes an interface type to be used with + * accepts_interface and implements_interface and declared by declare_interface. + */ +export interface InterfaceDescriptor { + /** + * name is the name of the interface. It should be a short-name (without + * a period) such that the fully qualified name of the interface will be + * package.name, ex. for the package a.b and interface named C, the + * fully-qualified name will be a.b.C. + */ + name: string; + /** + * description is a human-readable description of the interface and its + * purpose. + */ + description: string; +} +export interface InterfaceDescriptorProtoMsg { + typeUrl: "/cosmos_proto.InterfaceDescriptor"; + value: Uint8Array; +} +/** + * InterfaceDescriptor describes an interface type to be used with + * accepts_interface and implements_interface and declared by declare_interface. + */ +export interface InterfaceDescriptorAmino { + /** + * name is the name of the interface. It should be a short-name (without + * a period) such that the fully qualified name of the interface will be + * package.name, ex. for the package a.b and interface named C, the + * fully-qualified name will be a.b.C. + */ + name: string; + /** + * description is a human-readable description of the interface and its + * purpose. + */ + description: string; +} +export interface InterfaceDescriptorAminoMsg { + type: "/cosmos_proto.InterfaceDescriptor"; + value: InterfaceDescriptorAmino; +} +/** + * ScalarDescriptor describes an scalar type to be used with + * the scalar field option and declared by declare_scalar. + * Scalars extend simple protobuf built-in types with additional + * syntax and semantics, for instance to represent big integers. + * Scalars should ideally define an encoding such that there is only one + * valid syntactical representation for a given semantic meaning, + * i.e. the encoding should be deterministic. + */ +export interface ScalarDescriptor { + /** + * name is the name of the scalar. It should be a short-name (without + * a period) such that the fully qualified name of the scalar will be + * package.name, ex. for the package a.b and scalar named C, the + * fully-qualified name will be a.b.C. + */ + name: string; + /** + * description is a human-readable description of the scalar and its + * encoding format. For instance a big integer or decimal scalar should + * specify precisely the expected encoding format. + */ + description: string; + /** + * field_type is the type of field with which this scalar can be used. + * Scalars can be used with one and only one type of field so that + * encoding standards and simple and clear. Currently only string and + * bytes fields are supported for scalars. + */ + fieldType: ScalarType[]; +} +export interface ScalarDescriptorProtoMsg { + typeUrl: "/cosmos_proto.ScalarDescriptor"; + value: Uint8Array; +} +/** + * ScalarDescriptor describes an scalar type to be used with + * the scalar field option and declared by declare_scalar. + * Scalars extend simple protobuf built-in types with additional + * syntax and semantics, for instance to represent big integers. + * Scalars should ideally define an encoding such that there is only one + * valid syntactical representation for a given semantic meaning, + * i.e. the encoding should be deterministic. + */ +export interface ScalarDescriptorAmino { + /** + * name is the name of the scalar. It should be a short-name (without + * a period) such that the fully qualified name of the scalar will be + * package.name, ex. for the package a.b and scalar named C, the + * fully-qualified name will be a.b.C. + */ + name: string; + /** + * description is a human-readable description of the scalar and its + * encoding format. For instance a big integer or decimal scalar should + * specify precisely the expected encoding format. + */ + description: string; + /** + * field_type is the type of field with which this scalar can be used. + * Scalars can be used with one and only one type of field so that + * encoding standards and simple and clear. Currently only string and + * bytes fields are supported for scalars. + */ + field_type: ScalarType[]; +} +export interface ScalarDescriptorAminoMsg { + type: "/cosmos_proto.ScalarDescriptor"; + value: ScalarDescriptorAmino; +} +function createBaseInterfaceDescriptor(): InterfaceDescriptor { + return { + name: "", + description: "" + }; +} +export const InterfaceDescriptor = { + typeUrl: "/cosmos_proto.InterfaceDescriptor", + is(o: any): o is InterfaceDescriptor { + return o && (o.$typeUrl === InterfaceDescriptor.typeUrl || typeof o.name === "string" && typeof o.description === "string"); + }, + isAmino(o: any): o is InterfaceDescriptorAmino { + return o && (o.$typeUrl === InterfaceDescriptor.typeUrl || typeof o.name === "string" && typeof o.description === "string"); + }, + encode(message: InterfaceDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): InterfaceDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInterfaceDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): InterfaceDescriptor { + const message = createBaseInterfaceDescriptor(); + message.name = object.name ?? ""; + message.description = object.description ?? ""; + return message; + }, + fromAmino(object: InterfaceDescriptorAmino): InterfaceDescriptor { + const message = createBaseInterfaceDescriptor(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + return message; + }, + toAmino(message: InterfaceDescriptor): InterfaceDescriptorAmino { + const obj: any = {}; + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; + return obj; + }, + fromAminoMsg(object: InterfaceDescriptorAminoMsg): InterfaceDescriptor { + return InterfaceDescriptor.fromAmino(object.value); + }, + fromProtoMsg(message: InterfaceDescriptorProtoMsg): InterfaceDescriptor { + return InterfaceDescriptor.decode(message.value); + }, + toProto(message: InterfaceDescriptor): Uint8Array { + return InterfaceDescriptor.encode(message).finish(); + }, + toProtoMsg(message: InterfaceDescriptor): InterfaceDescriptorProtoMsg { + return { + typeUrl: "/cosmos_proto.InterfaceDescriptor", + value: InterfaceDescriptor.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(InterfaceDescriptor.typeUrl, InterfaceDescriptor); +function createBaseScalarDescriptor(): ScalarDescriptor { + return { + name: "", + description: "", + fieldType: [] + }; +} +export const ScalarDescriptor = { + typeUrl: "/cosmos_proto.ScalarDescriptor", + is(o: any): o is ScalarDescriptor { + return o && (o.$typeUrl === ScalarDescriptor.typeUrl || typeof o.name === "string" && typeof o.description === "string" && Array.isArray(o.fieldType)); + }, + isAmino(o: any): o is ScalarDescriptorAmino { + return o && (o.$typeUrl === ScalarDescriptor.typeUrl || typeof o.name === "string" && typeof o.description === "string" && Array.isArray(o.field_type)); + }, + encode(message: ScalarDescriptor, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + writer.uint32(26).fork(); + for (const v of message.fieldType) { + writer.int32(v); + } + writer.ldelim(); + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ScalarDescriptor { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseScalarDescriptor(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + case 3: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.fieldType.push((reader.int32() as any)); + } + } else { + message.fieldType.push((reader.int32() as any)); + } + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ScalarDescriptor { + const message = createBaseScalarDescriptor(); + message.name = object.name ?? ""; + message.description = object.description ?? ""; + message.fieldType = object.fieldType?.map(e => e) || []; + return message; + }, + fromAmino(object: ScalarDescriptorAmino): ScalarDescriptor { + const message = createBaseScalarDescriptor(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + message.fieldType = object.field_type?.map(e => e) || []; + return message; + }, + toAmino(message: ScalarDescriptor): ScalarDescriptorAmino { + const obj: any = {}; + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; + if (message.fieldType) { + obj.field_type = message.fieldType.map(e => e); + } else { + obj.field_type = message.fieldType; + } + return obj; + }, + fromAminoMsg(object: ScalarDescriptorAminoMsg): ScalarDescriptor { + return ScalarDescriptor.fromAmino(object.value); + }, + fromProtoMsg(message: ScalarDescriptorProtoMsg): ScalarDescriptor { + return ScalarDescriptor.decode(message.value); + }, + toProto(message: ScalarDescriptor): Uint8Array { + return ScalarDescriptor.encode(message).finish(); + }, + toProtoMsg(message: ScalarDescriptor): ScalarDescriptorProtoMsg { + return { + typeUrl: "/cosmos_proto.ScalarDescriptor", + value: ScalarDescriptor.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ScalarDescriptor.typeUrl, ScalarDescriptor); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmwasm/wasm/v1/query.rpc.func.ts b/libs/interchain-query/src/cosmwasm/wasm/v1/query.rpc.func.ts new file mode 100644 index 00000000..53986d9b --- /dev/null +++ b/libs/interchain-query/src/cosmwasm/wasm/v1/query.rpc.func.ts @@ -0,0 +1,135 @@ +import { RpcResolver, buildQuery } from "../../../helper-func-types"; +import { buildUseQuery } from "../../../react-query"; +import { QueryContractInfoRequest, QueryContractInfoResponse, QueryContractHistoryRequest, QueryContractHistoryResponse, QueryContractsByCodeRequest, QueryContractsByCodeResponse, QueryAllContractStateRequest, QueryAllContractStateResponse, QueryRawContractStateRequest, QueryRawContractStateResponse, QuerySmartContractStateRequest, QuerySmartContractStateResponse, QueryCodeRequest, QueryCodeResponse, QueryCodesRequest, QueryCodesResponse, QueryPinnedCodesRequest, QueryPinnedCodesResponse, QueryParamsRequest, QueryParamsResponse, QueryContractsByCreatorRequest, QueryContractsByCreatorResponse, QueryBuildAddressRequest, QueryBuildAddressResponse } from "./query"; +export const createGetContractInfo = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryContractInfoRequest.encode, + decode: QueryContractInfoResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "ContractInfo", + clientResolver +}); +export const useGetContractInfo = buildUseQuery({ + builderQueryFn: createGetContractInfo, + queryKeyPrefix: "ContractInfoQuery" +}); +export const createGetContractHistory = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryContractHistoryRequest.encode, + decode: QueryContractHistoryResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "ContractHistory", + clientResolver +}); +export const useGetContractHistory = buildUseQuery({ + builderQueryFn: createGetContractHistory, + queryKeyPrefix: "ContractHistoryQuery" +}); +export const createGetContractsByCode = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryContractsByCodeRequest.encode, + decode: QueryContractsByCodeResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "ContractsByCode", + clientResolver +}); +export const useGetContractsByCode = buildUseQuery({ + builderQueryFn: createGetContractsByCode, + queryKeyPrefix: "ContractsByCodeQuery" +}); +export const createGetAllContractState = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryAllContractStateRequest.encode, + decode: QueryAllContractStateResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "AllContractState", + clientResolver +}); +export const useGetAllContractState = buildUseQuery({ + builderQueryFn: createGetAllContractState, + queryKeyPrefix: "AllContractStateQuery" +}); +export const createGetRawContractState = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryRawContractStateRequest.encode, + decode: QueryRawContractStateResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "RawContractState", + clientResolver +}); +export const useGetRawContractState = buildUseQuery({ + builderQueryFn: createGetRawContractState, + queryKeyPrefix: "RawContractStateQuery" +}); +export const createGetSmartContractState = (clientResolver?: RpcResolver) => buildQuery({ + encode: QuerySmartContractStateRequest.encode, + decode: QuerySmartContractStateResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "SmartContractState", + clientResolver +}); +export const useGetSmartContractState = buildUseQuery({ + builderQueryFn: createGetSmartContractState, + queryKeyPrefix: "SmartContractStateQuery" +}); +export const createGetCode = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryCodeRequest.encode, + decode: QueryCodeResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "Code", + clientResolver +}); +export const useGetCode = buildUseQuery({ + builderQueryFn: createGetCode, + queryKeyPrefix: "CodeQuery" +}); +export const createGetCodes = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryCodesRequest.encode, + decode: QueryCodesResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "Codes", + clientResolver +}); +export const useGetCodes = buildUseQuery({ + builderQueryFn: createGetCodes, + queryKeyPrefix: "CodesQuery" +}); +export const createGetPinnedCodes = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryPinnedCodesRequest.encode, + decode: QueryPinnedCodesResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "PinnedCodes", + clientResolver +}); +export const useGetPinnedCodes = buildUseQuery({ + builderQueryFn: createGetPinnedCodes, + queryKeyPrefix: "PinnedCodesQuery" +}); +export const createGetParams = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryParamsRequest.encode, + decode: QueryParamsResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "Params", + clientResolver +}); +export const useGetParams = buildUseQuery({ + builderQueryFn: createGetParams, + queryKeyPrefix: "ParamsQuery" +}); +export const createGetContractsByCreator = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryContractsByCreatorRequest.encode, + decode: QueryContractsByCreatorResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "ContractsByCreator", + clientResolver +}); +export const useGetContractsByCreator = buildUseQuery({ + builderQueryFn: createGetContractsByCreator, + queryKeyPrefix: "ContractsByCreatorQuery" +}); +export const createGetBuildAddress = (clientResolver?: RpcResolver) => buildQuery({ + encode: QueryBuildAddressRequest.encode, + decode: QueryBuildAddressResponse.decode, + service: "cosmwasm.wasm.v1.Query", + method: "BuildAddress", + clientResolver +}); +export const useGetBuildAddress = buildUseQuery({ + builderQueryFn: createGetBuildAddress, + queryKeyPrefix: "BuildAddressQuery" +}); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmwasm/wasm/v1/query.ts b/libs/interchain-query/src/cosmwasm/wasm/v1/query.ts new file mode 100644 index 00000000..3c8b6575 --- /dev/null +++ b/libs/interchain-query/src/cosmwasm/wasm/v1/query.ts @@ -0,0 +1,2818 @@ +import { PageRequest, PageRequestAmino, PageResponse, PageResponseAmino } from "../../../cosmos/base/query/v1beta1/pagination"; +import { ContractInfo, ContractInfoAmino, ContractCodeHistoryEntry, ContractCodeHistoryEntryAmino, Model, ModelAmino, AccessConfig, AccessConfigAmino, Params, ParamsAmino } from "./types"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; +import { toUtf8, fromUtf8 } from "@cosmjs/encoding"; +/** + * QueryContractInfoRequest is the request type for the Query/ContractInfo RPC + * method + */ +export interface QueryContractInfoRequest { + /** address is the address of the contract to query */ + address: string; +} +export interface QueryContractInfoRequestProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QueryContractInfoRequest"; + value: Uint8Array; +} +/** + * QueryContractInfoRequest is the request type for the Query/ContractInfo RPC + * method + */ +export interface QueryContractInfoRequestAmino { + /** address is the address of the contract to query */ + address: string; +} +export interface QueryContractInfoRequestAminoMsg { + type: "wasm/QueryContractInfoRequest"; + value: QueryContractInfoRequestAmino; +} +/** + * QueryContractInfoResponse is the response type for the Query/ContractInfo RPC + * method + */ +export interface QueryContractInfoResponse { + /** address is the address of the contract */ + address: string; + contractInfo: ContractInfo; +} +export interface QueryContractInfoResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QueryContractInfoResponse"; + value: Uint8Array; +} +/** + * QueryContractInfoResponse is the response type for the Query/ContractInfo RPC + * method + */ +export interface QueryContractInfoResponseAmino { + /** address is the address of the contract */ + address: string; + contract_info: ContractInfoAmino; +} +export interface QueryContractInfoResponseAminoMsg { + type: "wasm/QueryContractInfoResponse"; + value: QueryContractInfoResponseAmino; +} +/** + * QueryContractHistoryRequest is the request type for the Query/ContractHistory + * RPC method + */ +export interface QueryContractHistoryRequest { + /** address is the address of the contract to query */ + address: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryContractHistoryRequestProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QueryContractHistoryRequest"; + value: Uint8Array; +} +/** + * QueryContractHistoryRequest is the request type for the Query/ContractHistory + * RPC method + */ +export interface QueryContractHistoryRequestAmino { + /** address is the address of the contract to query */ + address: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryContractHistoryRequestAminoMsg { + type: "wasm/QueryContractHistoryRequest"; + value: QueryContractHistoryRequestAmino; +} +/** + * QueryContractHistoryResponse is the response type for the + * Query/ContractHistory RPC method + */ +export interface QueryContractHistoryResponse { + entries: ContractCodeHistoryEntry[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryContractHistoryResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QueryContractHistoryResponse"; + value: Uint8Array; +} +/** + * QueryContractHistoryResponse is the response type for the + * Query/ContractHistory RPC method + */ +export interface QueryContractHistoryResponseAmino { + entries: ContractCodeHistoryEntryAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryContractHistoryResponseAminoMsg { + type: "wasm/QueryContractHistoryResponse"; + value: QueryContractHistoryResponseAmino; +} +/** + * QueryContractsByCodeRequest is the request type for the Query/ContractsByCode + * RPC method + */ +export interface QueryContractsByCodeRequest { + /** grpc-gateway_out does not support Go style CodID */ + codeId: bigint; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryContractsByCodeRequestProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCodeRequest"; + value: Uint8Array; +} +/** + * QueryContractsByCodeRequest is the request type for the Query/ContractsByCode + * RPC method + */ +export interface QueryContractsByCodeRequestAmino { + /** grpc-gateway_out does not support Go style CodID */ + code_id: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryContractsByCodeRequestAminoMsg { + type: "wasm/QueryContractsByCodeRequest"; + value: QueryContractsByCodeRequestAmino; +} +/** + * QueryContractsByCodeResponse is the response type for the + * Query/ContractsByCode RPC method + */ +export interface QueryContractsByCodeResponse { + /** contracts are a set of contract addresses */ + contracts: string[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryContractsByCodeResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCodeResponse"; + value: Uint8Array; +} +/** + * QueryContractsByCodeResponse is the response type for the + * Query/ContractsByCode RPC method + */ +export interface QueryContractsByCodeResponseAmino { + /** contracts are a set of contract addresses */ + contracts: string[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryContractsByCodeResponseAminoMsg { + type: "wasm/QueryContractsByCodeResponse"; + value: QueryContractsByCodeResponseAmino; +} +/** + * QueryAllContractStateRequest is the request type for the + * Query/AllContractState RPC method + */ +export interface QueryAllContractStateRequest { + /** address is the address of the contract */ + address: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryAllContractStateRequestProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QueryAllContractStateRequest"; + value: Uint8Array; +} +/** + * QueryAllContractStateRequest is the request type for the + * Query/AllContractState RPC method + */ +export interface QueryAllContractStateRequestAmino { + /** address is the address of the contract */ + address: string; + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryAllContractStateRequestAminoMsg { + type: "wasm/QueryAllContractStateRequest"; + value: QueryAllContractStateRequestAmino; +} +/** + * QueryAllContractStateResponse is the response type for the + * Query/AllContractState RPC method + */ +export interface QueryAllContractStateResponse { + models: Model[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryAllContractStateResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QueryAllContractStateResponse"; + value: Uint8Array; +} +/** + * QueryAllContractStateResponse is the response type for the + * Query/AllContractState RPC method + */ +export interface QueryAllContractStateResponseAmino { + models: ModelAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryAllContractStateResponseAminoMsg { + type: "wasm/QueryAllContractStateResponse"; + value: QueryAllContractStateResponseAmino; +} +/** + * QueryRawContractStateRequest is the request type for the + * Query/RawContractState RPC method + */ +export interface QueryRawContractStateRequest { + /** address is the address of the contract */ + address: string; + queryData: Uint8Array; +} +export interface QueryRawContractStateRequestProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QueryRawContractStateRequest"; + value: Uint8Array; +} +/** + * QueryRawContractStateRequest is the request type for the + * Query/RawContractState RPC method + */ +export interface QueryRawContractStateRequestAmino { + /** address is the address of the contract */ + address: string; + query_data: string; +} +export interface QueryRawContractStateRequestAminoMsg { + type: "wasm/QueryRawContractStateRequest"; + value: QueryRawContractStateRequestAmino; +} +/** + * QueryRawContractStateResponse is the response type for the + * Query/RawContractState RPC method + */ +export interface QueryRawContractStateResponse { + /** Data contains the raw store data */ + data: Uint8Array; +} +export interface QueryRawContractStateResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QueryRawContractStateResponse"; + value: Uint8Array; +} +/** + * QueryRawContractStateResponse is the response type for the + * Query/RawContractState RPC method + */ +export interface QueryRawContractStateResponseAmino { + /** Data contains the raw store data */ + data: string; +} +export interface QueryRawContractStateResponseAminoMsg { + type: "wasm/QueryRawContractStateResponse"; + value: QueryRawContractStateResponseAmino; +} +/** + * QuerySmartContractStateRequest is the request type for the + * Query/SmartContractState RPC method + */ +export interface QuerySmartContractStateRequest { + /** address is the address of the contract */ + address: string; + /** QueryData contains the query data passed to the contract */ + queryData: Uint8Array; +} +export interface QuerySmartContractStateRequestProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QuerySmartContractStateRequest"; + value: Uint8Array; +} +/** + * QuerySmartContractStateRequest is the request type for the + * Query/SmartContractState RPC method + */ +export interface QuerySmartContractStateRequestAmino { + /** address is the address of the contract */ + address: string; + /** QueryData contains the query data passed to the contract */ + query_data: any; +} +export interface QuerySmartContractStateRequestAminoMsg { + type: "wasm/QuerySmartContractStateRequest"; + value: QuerySmartContractStateRequestAmino; +} +/** + * QuerySmartContractStateResponse is the response type for the + * Query/SmartContractState RPC method + */ +export interface QuerySmartContractStateResponse { + /** Data contains the json data returned from the smart contract */ + data: Uint8Array; +} +export interface QuerySmartContractStateResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QuerySmartContractStateResponse"; + value: Uint8Array; +} +/** + * QuerySmartContractStateResponse is the response type for the + * Query/SmartContractState RPC method + */ +export interface QuerySmartContractStateResponseAmino { + /** Data contains the json data returned from the smart contract */ + data: any; +} +export interface QuerySmartContractStateResponseAminoMsg { + type: "wasm/QuerySmartContractStateResponse"; + value: QuerySmartContractStateResponseAmino; +} +/** QueryCodeRequest is the request type for the Query/Code RPC method */ +export interface QueryCodeRequest { + /** grpc-gateway_out does not support Go style CodID */ + codeId: bigint; +} +export interface QueryCodeRequestProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QueryCodeRequest"; + value: Uint8Array; +} +/** QueryCodeRequest is the request type for the Query/Code RPC method */ +export interface QueryCodeRequestAmino { + /** grpc-gateway_out does not support Go style CodID */ + code_id: string; +} +export interface QueryCodeRequestAminoMsg { + type: "wasm/QueryCodeRequest"; + value: QueryCodeRequestAmino; +} +/** CodeInfoResponse contains code meta data from CodeInfo */ +export interface CodeInfoResponse { + codeId: bigint; + creator: string; + dataHash: Uint8Array; + instantiatePermission: AccessConfig; +} +export interface CodeInfoResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.CodeInfoResponse"; + value: Uint8Array; +} +/** CodeInfoResponse contains code meta data from CodeInfo */ +export interface CodeInfoResponseAmino { + code_id: string; + creator: string; + data_hash: string; + instantiate_permission: AccessConfigAmino; +} +export interface CodeInfoResponseAminoMsg { + type: "wasm/CodeInfoResponse"; + value: CodeInfoResponseAmino; +} +/** QueryCodeResponse is the response type for the Query/Code RPC method */ +export interface QueryCodeResponse { + codeInfo?: CodeInfoResponse; + data: Uint8Array; +} +export interface QueryCodeResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QueryCodeResponse"; + value: Uint8Array; +} +/** QueryCodeResponse is the response type for the Query/Code RPC method */ +export interface QueryCodeResponseAmino { + code_info?: CodeInfoResponseAmino; + data: string; +} +export interface QueryCodeResponseAminoMsg { + type: "wasm/QueryCodeResponse"; + value: QueryCodeResponseAmino; +} +/** QueryCodesRequest is the request type for the Query/Codes RPC method */ +export interface QueryCodesRequest { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryCodesRequestProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QueryCodesRequest"; + value: Uint8Array; +} +/** QueryCodesRequest is the request type for the Query/Codes RPC method */ +export interface QueryCodesRequestAmino { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryCodesRequestAminoMsg { + type: "wasm/QueryCodesRequest"; + value: QueryCodesRequestAmino; +} +/** QueryCodesResponse is the response type for the Query/Codes RPC method */ +export interface QueryCodesResponse { + codeInfos: CodeInfoResponse[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryCodesResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QueryCodesResponse"; + value: Uint8Array; +} +/** QueryCodesResponse is the response type for the Query/Codes RPC method */ +export interface QueryCodesResponseAmino { + code_infos: CodeInfoResponseAmino[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryCodesResponseAminoMsg { + type: "wasm/QueryCodesResponse"; + value: QueryCodesResponseAmino; +} +/** + * QueryPinnedCodesRequest is the request type for the Query/PinnedCodes + * RPC method + */ +export interface QueryPinnedCodesRequest { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryPinnedCodesRequestProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QueryPinnedCodesRequest"; + value: Uint8Array; +} +/** + * QueryPinnedCodesRequest is the request type for the Query/PinnedCodes + * RPC method + */ +export interface QueryPinnedCodesRequestAmino { + /** pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryPinnedCodesRequestAminoMsg { + type: "wasm/QueryPinnedCodesRequest"; + value: QueryPinnedCodesRequestAmino; +} +/** + * QueryPinnedCodesResponse is the response type for the + * Query/PinnedCodes RPC method + */ +export interface QueryPinnedCodesResponse { + codeIds: bigint[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryPinnedCodesResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QueryPinnedCodesResponse"; + value: Uint8Array; +} +/** + * QueryPinnedCodesResponse is the response type for the + * Query/PinnedCodes RPC method + */ +export interface QueryPinnedCodesResponseAmino { + code_ids: string[]; + /** pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryPinnedCodesResponseAminoMsg { + type: "wasm/QueryPinnedCodesResponse"; + value: QueryPinnedCodesResponseAmino; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequest {} +export interface QueryParamsRequestProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QueryParamsRequest"; + value: Uint8Array; +} +/** QueryParamsRequest is the request type for the Query/Params RPC method. */ +export interface QueryParamsRequestAmino {} +export interface QueryParamsRequestAminoMsg { + type: "wasm/QueryParamsRequest"; + value: QueryParamsRequestAmino; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponse { + /** params defines the parameters of the module. */ + params: Params; +} +export interface QueryParamsResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QueryParamsResponse"; + value: Uint8Array; +} +/** QueryParamsResponse is the response type for the Query/Params RPC method. */ +export interface QueryParamsResponseAmino { + /** params defines the parameters of the module. */ + params: ParamsAmino; +} +export interface QueryParamsResponseAminoMsg { + type: "wasm/QueryParamsResponse"; + value: QueryParamsResponseAmino; +} +/** + * QueryContractsByCreatorRequest is the request type for the + * Query/ContractsByCreator RPC method. + */ +export interface QueryContractsByCreatorRequest { + /** CreatorAddress is the address of contract creator */ + creatorAddress: string; + /** Pagination defines an optional pagination for the request. */ + pagination?: PageRequest; +} +export interface QueryContractsByCreatorRequestProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCreatorRequest"; + value: Uint8Array; +} +/** + * QueryContractsByCreatorRequest is the request type for the + * Query/ContractsByCreator RPC method. + */ +export interface QueryContractsByCreatorRequestAmino { + /** CreatorAddress is the address of contract creator */ + creator_address: string; + /** Pagination defines an optional pagination for the request. */ + pagination?: PageRequestAmino; +} +export interface QueryContractsByCreatorRequestAminoMsg { + type: "wasm/QueryContractsByCreatorRequest"; + value: QueryContractsByCreatorRequestAmino; +} +/** + * QueryContractsByCreatorResponse is the response type for the + * Query/ContractsByCreator RPC method. + */ +export interface QueryContractsByCreatorResponse { + /** ContractAddresses result set */ + contractAddresses: string[]; + /** Pagination defines the pagination in the response. */ + pagination?: PageResponse; +} +export interface QueryContractsByCreatorResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCreatorResponse"; + value: Uint8Array; +} +/** + * QueryContractsByCreatorResponse is the response type for the + * Query/ContractsByCreator RPC method. + */ +export interface QueryContractsByCreatorResponseAmino { + /** ContractAddresses result set */ + contract_addresses: string[]; + /** Pagination defines the pagination in the response. */ + pagination?: PageResponseAmino; +} +export interface QueryContractsByCreatorResponseAminoMsg { + type: "wasm/QueryContractsByCreatorResponse"; + value: QueryContractsByCreatorResponseAmino; +} +/** + * QueryBuildAddressRequest is the request type for the Query/BuildAddress RPC + * method. + */ +export interface QueryBuildAddressRequest { + /** CodeHash is the hash of the code */ + codeHash: string; + /** CreatorAddress is the address of the contract instantiator */ + creatorAddress: string; + /** Salt is a hex encoded salt */ + salt: string; + /** + * InitArgs are optional json encoded init args to be used in contract address + * building if provided + */ + initArgs: Uint8Array; +} +export interface QueryBuildAddressRequestProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QueryBuildAddressRequest"; + value: Uint8Array; +} +/** + * QueryBuildAddressRequest is the request type for the Query/BuildAddress RPC + * method. + */ +export interface QueryBuildAddressRequestAmino { + /** CodeHash is the hash of the code */ + code_hash: string; + /** CreatorAddress is the address of the contract instantiator */ + creator_address: string; + /** Salt is a hex encoded salt */ + salt: string; + /** + * InitArgs are optional json encoded init args to be used in contract address + * building if provided + */ + init_args: string; +} +export interface QueryBuildAddressRequestAminoMsg { + type: "wasm/QueryBuildAddressRequest"; + value: QueryBuildAddressRequestAmino; +} +/** + * QueryBuildAddressResponse is the response type for the Query/BuildAddress RPC + * method. + */ +export interface QueryBuildAddressResponse { + /** Address is the contract address */ + address: string; +} +export interface QueryBuildAddressResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.QueryBuildAddressResponse"; + value: Uint8Array; +} +/** + * QueryBuildAddressResponse is the response type for the Query/BuildAddress RPC + * method. + */ +export interface QueryBuildAddressResponseAmino { + /** Address is the contract address */ + address: string; +} +export interface QueryBuildAddressResponseAminoMsg { + type: "wasm/QueryBuildAddressResponse"; + value: QueryBuildAddressResponseAmino; +} +function createBaseQueryContractInfoRequest(): QueryContractInfoRequest { + return { + address: "" + }; +} +export const QueryContractInfoRequest = { + typeUrl: "/cosmwasm.wasm.v1.QueryContractInfoRequest", + aminoType: "wasm/QueryContractInfoRequest", + is(o: any): o is QueryContractInfoRequest { + return o && (o.$typeUrl === QueryContractInfoRequest.typeUrl || typeof o.address === "string"); + }, + isAmino(o: any): o is QueryContractInfoRequestAmino { + return o && (o.$typeUrl === QueryContractInfoRequest.typeUrl || typeof o.address === "string"); + }, + encode(message: QueryContractInfoRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryContractInfoRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryContractInfoRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryContractInfoRequest { + const message = createBaseQueryContractInfoRequest(); + message.address = object.address ?? ""; + return message; + }, + fromAmino(object: QueryContractInfoRequestAmino): QueryContractInfoRequest { + const message = createBaseQueryContractInfoRequest(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + return message; + }, + toAmino(message: QueryContractInfoRequest): QueryContractInfoRequestAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + return obj; + }, + fromAminoMsg(object: QueryContractInfoRequestAminoMsg): QueryContractInfoRequest { + return QueryContractInfoRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryContractInfoRequest): QueryContractInfoRequestAminoMsg { + return { + type: "wasm/QueryContractInfoRequest", + value: QueryContractInfoRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryContractInfoRequestProtoMsg): QueryContractInfoRequest { + return QueryContractInfoRequest.decode(message.value); + }, + toProto(message: QueryContractInfoRequest): Uint8Array { + return QueryContractInfoRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryContractInfoRequest): QueryContractInfoRequestProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QueryContractInfoRequest", + value: QueryContractInfoRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryContractInfoRequest.typeUrl, QueryContractInfoRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryContractInfoRequest.aminoType, QueryContractInfoRequest.typeUrl); +function createBaseQueryContractInfoResponse(): QueryContractInfoResponse { + return { + address: "", + contractInfo: ContractInfo.fromPartial({}) + }; +} +export const QueryContractInfoResponse = { + typeUrl: "/cosmwasm.wasm.v1.QueryContractInfoResponse", + aminoType: "wasm/QueryContractInfoResponse", + is(o: any): o is QueryContractInfoResponse { + return o && (o.$typeUrl === QueryContractInfoResponse.typeUrl || typeof o.address === "string" && ContractInfo.is(o.contractInfo)); + }, + isAmino(o: any): o is QueryContractInfoResponseAmino { + return o && (o.$typeUrl === QueryContractInfoResponse.typeUrl || typeof o.address === "string" && ContractInfo.isAmino(o.contract_info)); + }, + encode(message: QueryContractInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.contractInfo !== undefined) { + ContractInfo.encode(message.contractInfo, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryContractInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryContractInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.contractInfo = ContractInfo.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryContractInfoResponse { + const message = createBaseQueryContractInfoResponse(); + message.address = object.address ?? ""; + message.contractInfo = object.contractInfo !== undefined && object.contractInfo !== null ? ContractInfo.fromPartial(object.contractInfo) : undefined; + return message; + }, + fromAmino(object: QueryContractInfoResponseAmino): QueryContractInfoResponse { + const message = createBaseQueryContractInfoResponse(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.contract_info !== undefined && object.contract_info !== null) { + message.contractInfo = ContractInfo.fromAmino(object.contract_info); + } + return message; + }, + toAmino(message: QueryContractInfoResponse): QueryContractInfoResponseAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + obj.contract_info = message.contractInfo ? ContractInfo.toAmino(message.contractInfo) : ContractInfo.toAmino(ContractInfo.fromPartial({})); + return obj; + }, + fromAminoMsg(object: QueryContractInfoResponseAminoMsg): QueryContractInfoResponse { + return QueryContractInfoResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryContractInfoResponse): QueryContractInfoResponseAminoMsg { + return { + type: "wasm/QueryContractInfoResponse", + value: QueryContractInfoResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryContractInfoResponseProtoMsg): QueryContractInfoResponse { + return QueryContractInfoResponse.decode(message.value); + }, + toProto(message: QueryContractInfoResponse): Uint8Array { + return QueryContractInfoResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryContractInfoResponse): QueryContractInfoResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QueryContractInfoResponse", + value: QueryContractInfoResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryContractInfoResponse.typeUrl, QueryContractInfoResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryContractInfoResponse.aminoType, QueryContractInfoResponse.typeUrl); +function createBaseQueryContractHistoryRequest(): QueryContractHistoryRequest { + return { + address: "", + pagination: undefined + }; +} +export const QueryContractHistoryRequest = { + typeUrl: "/cosmwasm.wasm.v1.QueryContractHistoryRequest", + aminoType: "wasm/QueryContractHistoryRequest", + is(o: any): o is QueryContractHistoryRequest { + return o && (o.$typeUrl === QueryContractHistoryRequest.typeUrl || typeof o.address === "string"); + }, + isAmino(o: any): o is QueryContractHistoryRequestAmino { + return o && (o.$typeUrl === QueryContractHistoryRequest.typeUrl || typeof o.address === "string"); + }, + encode(message: QueryContractHistoryRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryContractHistoryRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryContractHistoryRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryContractHistoryRequest { + const message = createBaseQueryContractHistoryRequest(); + message.address = object.address ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryContractHistoryRequestAmino): QueryContractHistoryRequest { + const message = createBaseQueryContractHistoryRequest(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryContractHistoryRequest): QueryContractHistoryRequestAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryContractHistoryRequestAminoMsg): QueryContractHistoryRequest { + return QueryContractHistoryRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryContractHistoryRequest): QueryContractHistoryRequestAminoMsg { + return { + type: "wasm/QueryContractHistoryRequest", + value: QueryContractHistoryRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryContractHistoryRequestProtoMsg): QueryContractHistoryRequest { + return QueryContractHistoryRequest.decode(message.value); + }, + toProto(message: QueryContractHistoryRequest): Uint8Array { + return QueryContractHistoryRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryContractHistoryRequest): QueryContractHistoryRequestProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QueryContractHistoryRequest", + value: QueryContractHistoryRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryContractHistoryRequest.typeUrl, QueryContractHistoryRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryContractHistoryRequest.aminoType, QueryContractHistoryRequest.typeUrl); +function createBaseQueryContractHistoryResponse(): QueryContractHistoryResponse { + return { + entries: [], + pagination: undefined + }; +} +export const QueryContractHistoryResponse = { + typeUrl: "/cosmwasm.wasm.v1.QueryContractHistoryResponse", + aminoType: "wasm/QueryContractHistoryResponse", + is(o: any): o is QueryContractHistoryResponse { + return o && (o.$typeUrl === QueryContractHistoryResponse.typeUrl || Array.isArray(o.entries) && (!o.entries.length || ContractCodeHistoryEntry.is(o.entries[0]))); + }, + isAmino(o: any): o is QueryContractHistoryResponseAmino { + return o && (o.$typeUrl === QueryContractHistoryResponse.typeUrl || Array.isArray(o.entries) && (!o.entries.length || ContractCodeHistoryEntry.isAmino(o.entries[0]))); + }, + encode(message: QueryContractHistoryResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.entries) { + ContractCodeHistoryEntry.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryContractHistoryResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryContractHistoryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.entries.push(ContractCodeHistoryEntry.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryContractHistoryResponse { + const message = createBaseQueryContractHistoryResponse(); + message.entries = object.entries?.map(e => ContractCodeHistoryEntry.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryContractHistoryResponseAmino): QueryContractHistoryResponse { + const message = createBaseQueryContractHistoryResponse(); + message.entries = object.entries?.map(e => ContractCodeHistoryEntry.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryContractHistoryResponse): QueryContractHistoryResponseAmino { + const obj: any = {}; + if (message.entries) { + obj.entries = message.entries.map(e => e ? ContractCodeHistoryEntry.toAmino(e) : undefined); + } else { + obj.entries = message.entries; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryContractHistoryResponseAminoMsg): QueryContractHistoryResponse { + return QueryContractHistoryResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryContractHistoryResponse): QueryContractHistoryResponseAminoMsg { + return { + type: "wasm/QueryContractHistoryResponse", + value: QueryContractHistoryResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryContractHistoryResponseProtoMsg): QueryContractHistoryResponse { + return QueryContractHistoryResponse.decode(message.value); + }, + toProto(message: QueryContractHistoryResponse): Uint8Array { + return QueryContractHistoryResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryContractHistoryResponse): QueryContractHistoryResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QueryContractHistoryResponse", + value: QueryContractHistoryResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryContractHistoryResponse.typeUrl, QueryContractHistoryResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryContractHistoryResponse.aminoType, QueryContractHistoryResponse.typeUrl); +function createBaseQueryContractsByCodeRequest(): QueryContractsByCodeRequest { + return { + codeId: BigInt(0), + pagination: undefined + }; +} +export const QueryContractsByCodeRequest = { + typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCodeRequest", + aminoType: "wasm/QueryContractsByCodeRequest", + is(o: any): o is QueryContractsByCodeRequest { + return o && (o.$typeUrl === QueryContractsByCodeRequest.typeUrl || typeof o.codeId === "bigint"); + }, + isAmino(o: any): o is QueryContractsByCodeRequestAmino { + return o && (o.$typeUrl === QueryContractsByCodeRequest.typeUrl || typeof o.code_id === "bigint"); + }, + encode(message: QueryContractsByCodeRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.codeId !== BigInt(0)) { + writer.uint32(8).uint64(message.codeId); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryContractsByCodeRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryContractsByCodeRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.codeId = reader.uint64(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryContractsByCodeRequest { + const message = createBaseQueryContractsByCodeRequest(); + message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryContractsByCodeRequestAmino): QueryContractsByCodeRequest { + const message = createBaseQueryContractsByCodeRequest(); + if (object.code_id !== undefined && object.code_id !== null) { + message.codeId = BigInt(object.code_id); + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryContractsByCodeRequest): QueryContractsByCodeRequestAmino { + const obj: any = {}; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId?.toString() : undefined; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryContractsByCodeRequestAminoMsg): QueryContractsByCodeRequest { + return QueryContractsByCodeRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryContractsByCodeRequest): QueryContractsByCodeRequestAminoMsg { + return { + type: "wasm/QueryContractsByCodeRequest", + value: QueryContractsByCodeRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryContractsByCodeRequestProtoMsg): QueryContractsByCodeRequest { + return QueryContractsByCodeRequest.decode(message.value); + }, + toProto(message: QueryContractsByCodeRequest): Uint8Array { + return QueryContractsByCodeRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryContractsByCodeRequest): QueryContractsByCodeRequestProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCodeRequest", + value: QueryContractsByCodeRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryContractsByCodeRequest.typeUrl, QueryContractsByCodeRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryContractsByCodeRequest.aminoType, QueryContractsByCodeRequest.typeUrl); +function createBaseQueryContractsByCodeResponse(): QueryContractsByCodeResponse { + return { + contracts: [], + pagination: undefined + }; +} +export const QueryContractsByCodeResponse = { + typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCodeResponse", + aminoType: "wasm/QueryContractsByCodeResponse", + is(o: any): o is QueryContractsByCodeResponse { + return o && (o.$typeUrl === QueryContractsByCodeResponse.typeUrl || Array.isArray(o.contracts) && (!o.contracts.length || typeof o.contracts[0] === "string")); + }, + isAmino(o: any): o is QueryContractsByCodeResponseAmino { + return o && (o.$typeUrl === QueryContractsByCodeResponse.typeUrl || Array.isArray(o.contracts) && (!o.contracts.length || typeof o.contracts[0] === "string")); + }, + encode(message: QueryContractsByCodeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.contracts) { + writer.uint32(10).string(v!); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryContractsByCodeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryContractsByCodeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.contracts.push(reader.string()); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryContractsByCodeResponse { + const message = createBaseQueryContractsByCodeResponse(); + message.contracts = object.contracts?.map(e => e) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryContractsByCodeResponseAmino): QueryContractsByCodeResponse { + const message = createBaseQueryContractsByCodeResponse(); + message.contracts = object.contracts?.map(e => e) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryContractsByCodeResponse): QueryContractsByCodeResponseAmino { + const obj: any = {}; + if (message.contracts) { + obj.contracts = message.contracts.map(e => e); + } else { + obj.contracts = message.contracts; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryContractsByCodeResponseAminoMsg): QueryContractsByCodeResponse { + return QueryContractsByCodeResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryContractsByCodeResponse): QueryContractsByCodeResponseAminoMsg { + return { + type: "wasm/QueryContractsByCodeResponse", + value: QueryContractsByCodeResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryContractsByCodeResponseProtoMsg): QueryContractsByCodeResponse { + return QueryContractsByCodeResponse.decode(message.value); + }, + toProto(message: QueryContractsByCodeResponse): Uint8Array { + return QueryContractsByCodeResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryContractsByCodeResponse): QueryContractsByCodeResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCodeResponse", + value: QueryContractsByCodeResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryContractsByCodeResponse.typeUrl, QueryContractsByCodeResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryContractsByCodeResponse.aminoType, QueryContractsByCodeResponse.typeUrl); +function createBaseQueryAllContractStateRequest(): QueryAllContractStateRequest { + return { + address: "", + pagination: undefined + }; +} +export const QueryAllContractStateRequest = { + typeUrl: "/cosmwasm.wasm.v1.QueryAllContractStateRequest", + aminoType: "wasm/QueryAllContractStateRequest", + is(o: any): o is QueryAllContractStateRequest { + return o && (o.$typeUrl === QueryAllContractStateRequest.typeUrl || typeof o.address === "string"); + }, + isAmino(o: any): o is QueryAllContractStateRequestAmino { + return o && (o.$typeUrl === QueryAllContractStateRequest.typeUrl || typeof o.address === "string"); + }, + encode(message: QueryAllContractStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllContractStateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllContractStateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryAllContractStateRequest { + const message = createBaseQueryAllContractStateRequest(); + message.address = object.address ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryAllContractStateRequestAmino): QueryAllContractStateRequest { + const message = createBaseQueryAllContractStateRequest(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryAllContractStateRequest): QueryAllContractStateRequestAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryAllContractStateRequestAminoMsg): QueryAllContractStateRequest { + return QueryAllContractStateRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryAllContractStateRequest): QueryAllContractStateRequestAminoMsg { + return { + type: "wasm/QueryAllContractStateRequest", + value: QueryAllContractStateRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAllContractStateRequestProtoMsg): QueryAllContractStateRequest { + return QueryAllContractStateRequest.decode(message.value); + }, + toProto(message: QueryAllContractStateRequest): Uint8Array { + return QueryAllContractStateRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryAllContractStateRequest): QueryAllContractStateRequestProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QueryAllContractStateRequest", + value: QueryAllContractStateRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryAllContractStateRequest.typeUrl, QueryAllContractStateRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryAllContractStateRequest.aminoType, QueryAllContractStateRequest.typeUrl); +function createBaseQueryAllContractStateResponse(): QueryAllContractStateResponse { + return { + models: [], + pagination: undefined + }; +} +export const QueryAllContractStateResponse = { + typeUrl: "/cosmwasm.wasm.v1.QueryAllContractStateResponse", + aminoType: "wasm/QueryAllContractStateResponse", + is(o: any): o is QueryAllContractStateResponse { + return o && (o.$typeUrl === QueryAllContractStateResponse.typeUrl || Array.isArray(o.models) && (!o.models.length || Model.is(o.models[0]))); + }, + isAmino(o: any): o is QueryAllContractStateResponseAmino { + return o && (o.$typeUrl === QueryAllContractStateResponse.typeUrl || Array.isArray(o.models) && (!o.models.length || Model.isAmino(o.models[0]))); + }, + encode(message: QueryAllContractStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.models) { + Model.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryAllContractStateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryAllContractStateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.models.push(Model.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryAllContractStateResponse { + const message = createBaseQueryAllContractStateResponse(); + message.models = object.models?.map(e => Model.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryAllContractStateResponseAmino): QueryAllContractStateResponse { + const message = createBaseQueryAllContractStateResponse(); + message.models = object.models?.map(e => Model.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryAllContractStateResponse): QueryAllContractStateResponseAmino { + const obj: any = {}; + if (message.models) { + obj.models = message.models.map(e => e ? Model.toAmino(e) : undefined); + } else { + obj.models = message.models; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryAllContractStateResponseAminoMsg): QueryAllContractStateResponse { + return QueryAllContractStateResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryAllContractStateResponse): QueryAllContractStateResponseAminoMsg { + return { + type: "wasm/QueryAllContractStateResponse", + value: QueryAllContractStateResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryAllContractStateResponseProtoMsg): QueryAllContractStateResponse { + return QueryAllContractStateResponse.decode(message.value); + }, + toProto(message: QueryAllContractStateResponse): Uint8Array { + return QueryAllContractStateResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryAllContractStateResponse): QueryAllContractStateResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QueryAllContractStateResponse", + value: QueryAllContractStateResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryAllContractStateResponse.typeUrl, QueryAllContractStateResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryAllContractStateResponse.aminoType, QueryAllContractStateResponse.typeUrl); +function createBaseQueryRawContractStateRequest(): QueryRawContractStateRequest { + return { + address: "", + queryData: new Uint8Array() + }; +} +export const QueryRawContractStateRequest = { + typeUrl: "/cosmwasm.wasm.v1.QueryRawContractStateRequest", + aminoType: "wasm/QueryRawContractStateRequest", + is(o: any): o is QueryRawContractStateRequest { + return o && (o.$typeUrl === QueryRawContractStateRequest.typeUrl || typeof o.address === "string" && (o.queryData instanceof Uint8Array || typeof o.queryData === "string")); + }, + isAmino(o: any): o is QueryRawContractStateRequestAmino { + return o && (o.$typeUrl === QueryRawContractStateRequest.typeUrl || typeof o.address === "string" && (o.query_data instanceof Uint8Array || typeof o.query_data === "string")); + }, + encode(message: QueryRawContractStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.queryData.length !== 0) { + writer.uint32(18).bytes(message.queryData); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryRawContractStateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRawContractStateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.queryData = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryRawContractStateRequest { + const message = createBaseQueryRawContractStateRequest(); + message.address = object.address ?? ""; + message.queryData = object.queryData ?? new Uint8Array(); + return message; + }, + fromAmino(object: QueryRawContractStateRequestAmino): QueryRawContractStateRequest { + const message = createBaseQueryRawContractStateRequest(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.query_data !== undefined && object.query_data !== null) { + message.queryData = bytesFromBase64(object.query_data); + } + return message; + }, + toAmino(message: QueryRawContractStateRequest): QueryRawContractStateRequestAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + obj.query_data = message.queryData ? base64FromBytes(message.queryData) : undefined; + return obj; + }, + fromAminoMsg(object: QueryRawContractStateRequestAminoMsg): QueryRawContractStateRequest { + return QueryRawContractStateRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryRawContractStateRequest): QueryRawContractStateRequestAminoMsg { + return { + type: "wasm/QueryRawContractStateRequest", + value: QueryRawContractStateRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryRawContractStateRequestProtoMsg): QueryRawContractStateRequest { + return QueryRawContractStateRequest.decode(message.value); + }, + toProto(message: QueryRawContractStateRequest): Uint8Array { + return QueryRawContractStateRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryRawContractStateRequest): QueryRawContractStateRequestProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QueryRawContractStateRequest", + value: QueryRawContractStateRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryRawContractStateRequest.typeUrl, QueryRawContractStateRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryRawContractStateRequest.aminoType, QueryRawContractStateRequest.typeUrl); +function createBaseQueryRawContractStateResponse(): QueryRawContractStateResponse { + return { + data: new Uint8Array() + }; +} +export const QueryRawContractStateResponse = { + typeUrl: "/cosmwasm.wasm.v1.QueryRawContractStateResponse", + aminoType: "wasm/QueryRawContractStateResponse", + is(o: any): o is QueryRawContractStateResponse { + return o && (o.$typeUrl === QueryRawContractStateResponse.typeUrl || o.data instanceof Uint8Array || typeof o.data === "string"); + }, + isAmino(o: any): o is QueryRawContractStateResponseAmino { + return o && (o.$typeUrl === QueryRawContractStateResponse.typeUrl || o.data instanceof Uint8Array || typeof o.data === "string"); + }, + encode(message: QueryRawContractStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryRawContractStateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryRawContractStateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryRawContractStateResponse { + const message = createBaseQueryRawContractStateResponse(); + message.data = object.data ?? new Uint8Array(); + return message; + }, + fromAmino(object: QueryRawContractStateResponseAmino): QueryRawContractStateResponse { + const message = createBaseQueryRawContractStateResponse(); + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + return message; + }, + toAmino(message: QueryRawContractStateResponse): QueryRawContractStateResponseAmino { + const obj: any = {}; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + return obj; + }, + fromAminoMsg(object: QueryRawContractStateResponseAminoMsg): QueryRawContractStateResponse { + return QueryRawContractStateResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryRawContractStateResponse): QueryRawContractStateResponseAminoMsg { + return { + type: "wasm/QueryRawContractStateResponse", + value: QueryRawContractStateResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryRawContractStateResponseProtoMsg): QueryRawContractStateResponse { + return QueryRawContractStateResponse.decode(message.value); + }, + toProto(message: QueryRawContractStateResponse): Uint8Array { + return QueryRawContractStateResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryRawContractStateResponse): QueryRawContractStateResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QueryRawContractStateResponse", + value: QueryRawContractStateResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryRawContractStateResponse.typeUrl, QueryRawContractStateResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryRawContractStateResponse.aminoType, QueryRawContractStateResponse.typeUrl); +function createBaseQuerySmartContractStateRequest(): QuerySmartContractStateRequest { + return { + address: "", + queryData: new Uint8Array() + }; +} +export const QuerySmartContractStateRequest = { + typeUrl: "/cosmwasm.wasm.v1.QuerySmartContractStateRequest", + aminoType: "wasm/QuerySmartContractStateRequest", + is(o: any): o is QuerySmartContractStateRequest { + return o && (o.$typeUrl === QuerySmartContractStateRequest.typeUrl || typeof o.address === "string" && (o.queryData instanceof Uint8Array || typeof o.queryData === "string")); + }, + isAmino(o: any): o is QuerySmartContractStateRequestAmino { + return o && (o.$typeUrl === QuerySmartContractStateRequest.typeUrl || typeof o.address === "string" && (o.query_data instanceof Uint8Array || typeof o.query_data === "string")); + }, + encode(message: QuerySmartContractStateRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.queryData.length !== 0) { + writer.uint32(18).bytes(message.queryData); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QuerySmartContractStateRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySmartContractStateRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.queryData = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QuerySmartContractStateRequest { + const message = createBaseQuerySmartContractStateRequest(); + message.address = object.address ?? ""; + message.queryData = object.queryData ?? new Uint8Array(); + return message; + }, + fromAmino(object: QuerySmartContractStateRequestAmino): QuerySmartContractStateRequest { + const message = createBaseQuerySmartContractStateRequest(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.query_data !== undefined && object.query_data !== null) { + message.queryData = toUtf8(JSON.stringify(object.query_data)); + } + return message; + }, + toAmino(message: QuerySmartContractStateRequest): QuerySmartContractStateRequestAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + obj.query_data = message.queryData ? JSON.parse(fromUtf8(message.queryData)) : undefined; + return obj; + }, + fromAminoMsg(object: QuerySmartContractStateRequestAminoMsg): QuerySmartContractStateRequest { + return QuerySmartContractStateRequest.fromAmino(object.value); + }, + toAminoMsg(message: QuerySmartContractStateRequest): QuerySmartContractStateRequestAminoMsg { + return { + type: "wasm/QuerySmartContractStateRequest", + value: QuerySmartContractStateRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QuerySmartContractStateRequestProtoMsg): QuerySmartContractStateRequest { + return QuerySmartContractStateRequest.decode(message.value); + }, + toProto(message: QuerySmartContractStateRequest): Uint8Array { + return QuerySmartContractStateRequest.encode(message).finish(); + }, + toProtoMsg(message: QuerySmartContractStateRequest): QuerySmartContractStateRequestProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QuerySmartContractStateRequest", + value: QuerySmartContractStateRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QuerySmartContractStateRequest.typeUrl, QuerySmartContractStateRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QuerySmartContractStateRequest.aminoType, QuerySmartContractStateRequest.typeUrl); +function createBaseQuerySmartContractStateResponse(): QuerySmartContractStateResponse { + return { + data: new Uint8Array() + }; +} +export const QuerySmartContractStateResponse = { + typeUrl: "/cosmwasm.wasm.v1.QuerySmartContractStateResponse", + aminoType: "wasm/QuerySmartContractStateResponse", + is(o: any): o is QuerySmartContractStateResponse { + return o && (o.$typeUrl === QuerySmartContractStateResponse.typeUrl || o.data instanceof Uint8Array || typeof o.data === "string"); + }, + isAmino(o: any): o is QuerySmartContractStateResponseAmino { + return o && (o.$typeUrl === QuerySmartContractStateResponse.typeUrl || o.data instanceof Uint8Array || typeof o.data === "string"); + }, + encode(message: QuerySmartContractStateResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QuerySmartContractStateResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQuerySmartContractStateResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QuerySmartContractStateResponse { + const message = createBaseQuerySmartContractStateResponse(); + message.data = object.data ?? new Uint8Array(); + return message; + }, + fromAmino(object: QuerySmartContractStateResponseAmino): QuerySmartContractStateResponse { + const message = createBaseQuerySmartContractStateResponse(); + if (object.data !== undefined && object.data !== null) { + message.data = toUtf8(JSON.stringify(object.data)); + } + return message; + }, + toAmino(message: QuerySmartContractStateResponse): QuerySmartContractStateResponseAmino { + const obj: any = {}; + obj.data = message.data ? JSON.parse(fromUtf8(message.data)) : undefined; + return obj; + }, + fromAminoMsg(object: QuerySmartContractStateResponseAminoMsg): QuerySmartContractStateResponse { + return QuerySmartContractStateResponse.fromAmino(object.value); + }, + toAminoMsg(message: QuerySmartContractStateResponse): QuerySmartContractStateResponseAminoMsg { + return { + type: "wasm/QuerySmartContractStateResponse", + value: QuerySmartContractStateResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QuerySmartContractStateResponseProtoMsg): QuerySmartContractStateResponse { + return QuerySmartContractStateResponse.decode(message.value); + }, + toProto(message: QuerySmartContractStateResponse): Uint8Array { + return QuerySmartContractStateResponse.encode(message).finish(); + }, + toProtoMsg(message: QuerySmartContractStateResponse): QuerySmartContractStateResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QuerySmartContractStateResponse", + value: QuerySmartContractStateResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QuerySmartContractStateResponse.typeUrl, QuerySmartContractStateResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QuerySmartContractStateResponse.aminoType, QuerySmartContractStateResponse.typeUrl); +function createBaseQueryCodeRequest(): QueryCodeRequest { + return { + codeId: BigInt(0) + }; +} +export const QueryCodeRequest = { + typeUrl: "/cosmwasm.wasm.v1.QueryCodeRequest", + aminoType: "wasm/QueryCodeRequest", + is(o: any): o is QueryCodeRequest { + return o && (o.$typeUrl === QueryCodeRequest.typeUrl || typeof o.codeId === "bigint"); + }, + isAmino(o: any): o is QueryCodeRequestAmino { + return o && (o.$typeUrl === QueryCodeRequest.typeUrl || typeof o.code_id === "bigint"); + }, + encode(message: QueryCodeRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.codeId !== BigInt(0)) { + writer.uint32(8).uint64(message.codeId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryCodeRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCodeRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.codeId = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryCodeRequest { + const message = createBaseQueryCodeRequest(); + message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); + return message; + }, + fromAmino(object: QueryCodeRequestAmino): QueryCodeRequest { + const message = createBaseQueryCodeRequest(); + if (object.code_id !== undefined && object.code_id !== null) { + message.codeId = BigInt(object.code_id); + } + return message; + }, + toAmino(message: QueryCodeRequest): QueryCodeRequestAmino { + const obj: any = {}; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: QueryCodeRequestAminoMsg): QueryCodeRequest { + return QueryCodeRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryCodeRequest): QueryCodeRequestAminoMsg { + return { + type: "wasm/QueryCodeRequest", + value: QueryCodeRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryCodeRequestProtoMsg): QueryCodeRequest { + return QueryCodeRequest.decode(message.value); + }, + toProto(message: QueryCodeRequest): Uint8Array { + return QueryCodeRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryCodeRequest): QueryCodeRequestProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QueryCodeRequest", + value: QueryCodeRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryCodeRequest.typeUrl, QueryCodeRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryCodeRequest.aminoType, QueryCodeRequest.typeUrl); +function createBaseCodeInfoResponse(): CodeInfoResponse { + return { + codeId: BigInt(0), + creator: "", + dataHash: new Uint8Array(), + instantiatePermission: AccessConfig.fromPartial({}) + }; +} +export const CodeInfoResponse = { + typeUrl: "/cosmwasm.wasm.v1.CodeInfoResponse", + aminoType: "wasm/CodeInfoResponse", + is(o: any): o is CodeInfoResponse { + return o && (o.$typeUrl === CodeInfoResponse.typeUrl || typeof o.codeId === "bigint" && typeof o.creator === "string" && (o.dataHash instanceof Uint8Array || typeof o.dataHash === "string") && AccessConfig.is(o.instantiatePermission)); + }, + isAmino(o: any): o is CodeInfoResponseAmino { + return o && (o.$typeUrl === CodeInfoResponse.typeUrl || typeof o.code_id === "bigint" && typeof o.creator === "string" && (o.data_hash instanceof Uint8Array || typeof o.data_hash === "string") && AccessConfig.isAmino(o.instantiate_permission)); + }, + encode(message: CodeInfoResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.codeId !== BigInt(0)) { + writer.uint32(8).uint64(message.codeId); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.dataHash.length !== 0) { + writer.uint32(26).bytes(message.dataHash); + } + if (message.instantiatePermission !== undefined) { + AccessConfig.encode(message.instantiatePermission, writer.uint32(50).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): CodeInfoResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCodeInfoResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.codeId = reader.uint64(); + break; + case 2: + message.creator = reader.string(); + break; + case 3: + message.dataHash = reader.bytes(); + break; + case 6: + message.instantiatePermission = AccessConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): CodeInfoResponse { + const message = createBaseCodeInfoResponse(); + message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); + message.creator = object.creator ?? ""; + message.dataHash = object.dataHash ?? new Uint8Array(); + message.instantiatePermission = object.instantiatePermission !== undefined && object.instantiatePermission !== null ? AccessConfig.fromPartial(object.instantiatePermission) : undefined; + return message; + }, + fromAmino(object: CodeInfoResponseAmino): CodeInfoResponse { + const message = createBaseCodeInfoResponse(); + if (object.code_id !== undefined && object.code_id !== null) { + message.codeId = BigInt(object.code_id); + } + if (object.creator !== undefined && object.creator !== null) { + message.creator = object.creator; + } + if (object.data_hash !== undefined && object.data_hash !== null) { + message.dataHash = bytesFromBase64(object.data_hash); + } + if (object.instantiate_permission !== undefined && object.instantiate_permission !== null) { + message.instantiatePermission = AccessConfig.fromAmino(object.instantiate_permission); + } + return message; + }, + toAmino(message: CodeInfoResponse): CodeInfoResponseAmino { + const obj: any = {}; + obj.code_id = message.codeId ? message.codeId?.toString() : "0"; + obj.creator = message.creator === "" ? undefined : message.creator; + obj.data_hash = message.dataHash ? base64FromBytes(message.dataHash) : undefined; + obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission) : AccessConfig.toAmino(AccessConfig.fromPartial({})); + return obj; + }, + fromAminoMsg(object: CodeInfoResponseAminoMsg): CodeInfoResponse { + return CodeInfoResponse.fromAmino(object.value); + }, + toAminoMsg(message: CodeInfoResponse): CodeInfoResponseAminoMsg { + return { + type: "wasm/CodeInfoResponse", + value: CodeInfoResponse.toAmino(message) + }; + }, + fromProtoMsg(message: CodeInfoResponseProtoMsg): CodeInfoResponse { + return CodeInfoResponse.decode(message.value); + }, + toProto(message: CodeInfoResponse): Uint8Array { + return CodeInfoResponse.encode(message).finish(); + }, + toProtoMsg(message: CodeInfoResponse): CodeInfoResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.CodeInfoResponse", + value: CodeInfoResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(CodeInfoResponse.typeUrl, CodeInfoResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(CodeInfoResponse.aminoType, CodeInfoResponse.typeUrl); +function createBaseQueryCodeResponse(): QueryCodeResponse { + return { + codeInfo: undefined, + data: new Uint8Array() + }; +} +export const QueryCodeResponse = { + typeUrl: "/cosmwasm.wasm.v1.QueryCodeResponse", + aminoType: "wasm/QueryCodeResponse", + is(o: any): o is QueryCodeResponse { + return o && (o.$typeUrl === QueryCodeResponse.typeUrl || o.data instanceof Uint8Array || typeof o.data === "string"); + }, + isAmino(o: any): o is QueryCodeResponseAmino { + return o && (o.$typeUrl === QueryCodeResponse.typeUrl || o.data instanceof Uint8Array || typeof o.data === "string"); + }, + encode(message: QueryCodeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.codeInfo !== undefined) { + CodeInfoResponse.encode(message.codeInfo, writer.uint32(10).fork()).ldelim(); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryCodeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCodeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.codeInfo = CodeInfoResponse.decode(reader, reader.uint32()); + break; + case 2: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryCodeResponse { + const message = createBaseQueryCodeResponse(); + message.codeInfo = object.codeInfo !== undefined && object.codeInfo !== null ? CodeInfoResponse.fromPartial(object.codeInfo) : undefined; + message.data = object.data ?? new Uint8Array(); + return message; + }, + fromAmino(object: QueryCodeResponseAmino): QueryCodeResponse { + const message = createBaseQueryCodeResponse(); + if (object.code_info !== undefined && object.code_info !== null) { + message.codeInfo = CodeInfoResponse.fromAmino(object.code_info); + } + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + return message; + }, + toAmino(message: QueryCodeResponse): QueryCodeResponseAmino { + const obj: any = {}; + obj.code_info = message.codeInfo ? CodeInfoResponse.toAmino(message.codeInfo) : undefined; + obj.data = message.data ? base64FromBytes(message.data) : ""; + return obj; + }, + fromAminoMsg(object: QueryCodeResponseAminoMsg): QueryCodeResponse { + return QueryCodeResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryCodeResponse): QueryCodeResponseAminoMsg { + return { + type: "wasm/QueryCodeResponse", + value: QueryCodeResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryCodeResponseProtoMsg): QueryCodeResponse { + return QueryCodeResponse.decode(message.value); + }, + toProto(message: QueryCodeResponse): Uint8Array { + return QueryCodeResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryCodeResponse): QueryCodeResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QueryCodeResponse", + value: QueryCodeResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryCodeResponse.typeUrl, QueryCodeResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryCodeResponse.aminoType, QueryCodeResponse.typeUrl); +function createBaseQueryCodesRequest(): QueryCodesRequest { + return { + pagination: undefined + }; +} +export const QueryCodesRequest = { + typeUrl: "/cosmwasm.wasm.v1.QueryCodesRequest", + aminoType: "wasm/QueryCodesRequest", + is(o: any): o is QueryCodesRequest { + return o && o.$typeUrl === QueryCodesRequest.typeUrl; + }, + isAmino(o: any): o is QueryCodesRequestAmino { + return o && o.$typeUrl === QueryCodesRequest.typeUrl; + }, + encode(message: QueryCodesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryCodesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCodesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryCodesRequest { + const message = createBaseQueryCodesRequest(); + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryCodesRequestAmino): QueryCodesRequest { + const message = createBaseQueryCodesRequest(); + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryCodesRequest): QueryCodesRequestAmino { + const obj: any = {}; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryCodesRequestAminoMsg): QueryCodesRequest { + return QueryCodesRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryCodesRequest): QueryCodesRequestAminoMsg { + return { + type: "wasm/QueryCodesRequest", + value: QueryCodesRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryCodesRequestProtoMsg): QueryCodesRequest { + return QueryCodesRequest.decode(message.value); + }, + toProto(message: QueryCodesRequest): Uint8Array { + return QueryCodesRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryCodesRequest): QueryCodesRequestProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QueryCodesRequest", + value: QueryCodesRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryCodesRequest.typeUrl, QueryCodesRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryCodesRequest.aminoType, QueryCodesRequest.typeUrl); +function createBaseQueryCodesResponse(): QueryCodesResponse { + return { + codeInfos: [], + pagination: undefined + }; +} +export const QueryCodesResponse = { + typeUrl: "/cosmwasm.wasm.v1.QueryCodesResponse", + aminoType: "wasm/QueryCodesResponse", + is(o: any): o is QueryCodesResponse { + return o && (o.$typeUrl === QueryCodesResponse.typeUrl || Array.isArray(o.codeInfos) && (!o.codeInfos.length || CodeInfoResponse.is(o.codeInfos[0]))); + }, + isAmino(o: any): o is QueryCodesResponseAmino { + return o && (o.$typeUrl === QueryCodesResponse.typeUrl || Array.isArray(o.code_infos) && (!o.code_infos.length || CodeInfoResponse.isAmino(o.code_infos[0]))); + }, + encode(message: QueryCodesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.codeInfos) { + CodeInfoResponse.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryCodesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryCodesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.codeInfos.push(CodeInfoResponse.decode(reader, reader.uint32())); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryCodesResponse { + const message = createBaseQueryCodesResponse(); + message.codeInfos = object.codeInfos?.map(e => CodeInfoResponse.fromPartial(e)) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryCodesResponseAmino): QueryCodesResponse { + const message = createBaseQueryCodesResponse(); + message.codeInfos = object.code_infos?.map(e => CodeInfoResponse.fromAmino(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryCodesResponse): QueryCodesResponseAmino { + const obj: any = {}; + if (message.codeInfos) { + obj.code_infos = message.codeInfos.map(e => e ? CodeInfoResponse.toAmino(e) : undefined); + } else { + obj.code_infos = message.codeInfos; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryCodesResponseAminoMsg): QueryCodesResponse { + return QueryCodesResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryCodesResponse): QueryCodesResponseAminoMsg { + return { + type: "wasm/QueryCodesResponse", + value: QueryCodesResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryCodesResponseProtoMsg): QueryCodesResponse { + return QueryCodesResponse.decode(message.value); + }, + toProto(message: QueryCodesResponse): Uint8Array { + return QueryCodesResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryCodesResponse): QueryCodesResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QueryCodesResponse", + value: QueryCodesResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryCodesResponse.typeUrl, QueryCodesResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryCodesResponse.aminoType, QueryCodesResponse.typeUrl); +function createBaseQueryPinnedCodesRequest(): QueryPinnedCodesRequest { + return { + pagination: undefined + }; +} +export const QueryPinnedCodesRequest = { + typeUrl: "/cosmwasm.wasm.v1.QueryPinnedCodesRequest", + aminoType: "wasm/QueryPinnedCodesRequest", + is(o: any): o is QueryPinnedCodesRequest { + return o && o.$typeUrl === QueryPinnedCodesRequest.typeUrl; + }, + isAmino(o: any): o is QueryPinnedCodesRequestAmino { + return o && o.$typeUrl === QueryPinnedCodesRequest.typeUrl; + }, + encode(message: QueryPinnedCodesRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryPinnedCodesRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPinnedCodesRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryPinnedCodesRequest { + const message = createBaseQueryPinnedCodesRequest(); + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryPinnedCodesRequestAmino): QueryPinnedCodesRequest { + const message = createBaseQueryPinnedCodesRequest(); + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryPinnedCodesRequest): QueryPinnedCodesRequestAmino { + const obj: any = {}; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryPinnedCodesRequestAminoMsg): QueryPinnedCodesRequest { + return QueryPinnedCodesRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryPinnedCodesRequest): QueryPinnedCodesRequestAminoMsg { + return { + type: "wasm/QueryPinnedCodesRequest", + value: QueryPinnedCodesRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryPinnedCodesRequestProtoMsg): QueryPinnedCodesRequest { + return QueryPinnedCodesRequest.decode(message.value); + }, + toProto(message: QueryPinnedCodesRequest): Uint8Array { + return QueryPinnedCodesRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryPinnedCodesRequest): QueryPinnedCodesRequestProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QueryPinnedCodesRequest", + value: QueryPinnedCodesRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryPinnedCodesRequest.typeUrl, QueryPinnedCodesRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryPinnedCodesRequest.aminoType, QueryPinnedCodesRequest.typeUrl); +function createBaseQueryPinnedCodesResponse(): QueryPinnedCodesResponse { + return { + codeIds: [], + pagination: undefined + }; +} +export const QueryPinnedCodesResponse = { + typeUrl: "/cosmwasm.wasm.v1.QueryPinnedCodesResponse", + aminoType: "wasm/QueryPinnedCodesResponse", + is(o: any): o is QueryPinnedCodesResponse { + return o && (o.$typeUrl === QueryPinnedCodesResponse.typeUrl || Array.isArray(o.codeIds) && (!o.codeIds.length || typeof o.codeIds[0] === "bigint")); + }, + isAmino(o: any): o is QueryPinnedCodesResponseAmino { + return o && (o.$typeUrl === QueryPinnedCodesResponse.typeUrl || Array.isArray(o.code_ids) && (!o.code_ids.length || typeof o.code_ids[0] === "bigint")); + }, + encode(message: QueryPinnedCodesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + writer.uint32(10).fork(); + for (const v of message.codeIds) { + writer.uint64(v); + } + writer.ldelim(); + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryPinnedCodesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryPinnedCodesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.codeIds.push(reader.uint64()); + } + } else { + message.codeIds.push(reader.uint64()); + } + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryPinnedCodesResponse { + const message = createBaseQueryPinnedCodesResponse(); + message.codeIds = object.codeIds?.map(e => BigInt(e.toString())) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryPinnedCodesResponseAmino): QueryPinnedCodesResponse { + const message = createBaseQueryPinnedCodesResponse(); + message.codeIds = object.code_ids?.map(e => BigInt(e)) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryPinnedCodesResponse): QueryPinnedCodesResponseAmino { + const obj: any = {}; + if (message.codeIds) { + obj.code_ids = message.codeIds.map(e => e.toString()); + } else { + obj.code_ids = message.codeIds; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryPinnedCodesResponseAminoMsg): QueryPinnedCodesResponse { + return QueryPinnedCodesResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryPinnedCodesResponse): QueryPinnedCodesResponseAminoMsg { + return { + type: "wasm/QueryPinnedCodesResponse", + value: QueryPinnedCodesResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryPinnedCodesResponseProtoMsg): QueryPinnedCodesResponse { + return QueryPinnedCodesResponse.decode(message.value); + }, + toProto(message: QueryPinnedCodesResponse): Uint8Array { + return QueryPinnedCodesResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryPinnedCodesResponse): QueryPinnedCodesResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QueryPinnedCodesResponse", + value: QueryPinnedCodesResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryPinnedCodesResponse.typeUrl, QueryPinnedCodesResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryPinnedCodesResponse.aminoType, QueryPinnedCodesResponse.typeUrl); +function createBaseQueryParamsRequest(): QueryParamsRequest { + return {}; +} +export const QueryParamsRequest = { + typeUrl: "/cosmwasm.wasm.v1.QueryParamsRequest", + aminoType: "wasm/QueryParamsRequest", + is(o: any): o is QueryParamsRequest { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + isAmino(o: any): o is QueryParamsRequestAmino { + return o && o.$typeUrl === QueryParamsRequest.typeUrl; + }, + encode(_: QueryParamsRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, + fromAmino(_: QueryParamsRequestAmino): QueryParamsRequest { + const message = createBaseQueryParamsRequest(); + return message; + }, + toAmino(_: QueryParamsRequest): QueryParamsRequestAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { + return QueryParamsRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsRequest): QueryParamsRequestAminoMsg { + return { + type: "wasm/QueryParamsRequest", + value: QueryParamsRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsRequestProtoMsg): QueryParamsRequest { + return QueryParamsRequest.decode(message.value); + }, + toProto(message: QueryParamsRequest): Uint8Array { + return QueryParamsRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsRequest): QueryParamsRequestProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QueryParamsRequest", + value: QueryParamsRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryParamsRequest.typeUrl, QueryParamsRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryParamsRequest.aminoType, QueryParamsRequest.typeUrl); +function createBaseQueryParamsResponse(): QueryParamsResponse { + return { + params: Params.fromPartial({}) + }; +} +export const QueryParamsResponse = { + typeUrl: "/cosmwasm.wasm.v1.QueryParamsResponse", + aminoType: "wasm/QueryParamsResponse", + is(o: any): o is QueryParamsResponse { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.is(o.params)); + }, + isAmino(o: any): o is QueryParamsResponseAmino { + return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isAmino(o.params)); + }, + encode(message: QueryParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: QueryParamsResponseAmino): QueryParamsResponse { + const message = createBaseQueryParamsResponse(); + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: QueryParamsResponse): QueryParamsResponseAmino { + const obj: any = {}; + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); + return obj; + }, + fromAminoMsg(object: QueryParamsResponseAminoMsg): QueryParamsResponse { + return QueryParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryParamsResponse): QueryParamsResponseAminoMsg { + return { + type: "wasm/QueryParamsResponse", + value: QueryParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryParamsResponseProtoMsg): QueryParamsResponse { + return QueryParamsResponse.decode(message.value); + }, + toProto(message: QueryParamsResponse): Uint8Array { + return QueryParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryParamsResponse): QueryParamsResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QueryParamsResponse", + value: QueryParamsResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryParamsResponse.typeUrl, QueryParamsResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryParamsResponse.aminoType, QueryParamsResponse.typeUrl); +function createBaseQueryContractsByCreatorRequest(): QueryContractsByCreatorRequest { + return { + creatorAddress: "", + pagination: undefined + }; +} +export const QueryContractsByCreatorRequest = { + typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCreatorRequest", + aminoType: "wasm/QueryContractsByCreatorRequest", + is(o: any): o is QueryContractsByCreatorRequest { + return o && (o.$typeUrl === QueryContractsByCreatorRequest.typeUrl || typeof o.creatorAddress === "string"); + }, + isAmino(o: any): o is QueryContractsByCreatorRequestAmino { + return o && (o.$typeUrl === QueryContractsByCreatorRequest.typeUrl || typeof o.creator_address === "string"); + }, + encode(message: QueryContractsByCreatorRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.creatorAddress !== "") { + writer.uint32(10).string(message.creatorAddress); + } + if (message.pagination !== undefined) { + PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryContractsByCreatorRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryContractsByCreatorRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.creatorAddress = reader.string(); + break; + case 2: + message.pagination = PageRequest.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryContractsByCreatorRequest { + const message = createBaseQueryContractsByCreatorRequest(); + message.creatorAddress = object.creatorAddress ?? ""; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryContractsByCreatorRequestAmino): QueryContractsByCreatorRequest { + const message = createBaseQueryContractsByCreatorRequest(); + if (object.creator_address !== undefined && object.creator_address !== null) { + message.creatorAddress = object.creator_address; + } + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageRequest.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryContractsByCreatorRequest): QueryContractsByCreatorRequestAmino { + const obj: any = {}; + obj.creator_address = message.creatorAddress === "" ? undefined : message.creatorAddress; + obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryContractsByCreatorRequestAminoMsg): QueryContractsByCreatorRequest { + return QueryContractsByCreatorRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryContractsByCreatorRequest): QueryContractsByCreatorRequestAminoMsg { + return { + type: "wasm/QueryContractsByCreatorRequest", + value: QueryContractsByCreatorRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryContractsByCreatorRequestProtoMsg): QueryContractsByCreatorRequest { + return QueryContractsByCreatorRequest.decode(message.value); + }, + toProto(message: QueryContractsByCreatorRequest): Uint8Array { + return QueryContractsByCreatorRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryContractsByCreatorRequest): QueryContractsByCreatorRequestProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCreatorRequest", + value: QueryContractsByCreatorRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryContractsByCreatorRequest.typeUrl, QueryContractsByCreatorRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryContractsByCreatorRequest.aminoType, QueryContractsByCreatorRequest.typeUrl); +function createBaseQueryContractsByCreatorResponse(): QueryContractsByCreatorResponse { + return { + contractAddresses: [], + pagination: undefined + }; +} +export const QueryContractsByCreatorResponse = { + typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCreatorResponse", + aminoType: "wasm/QueryContractsByCreatorResponse", + is(o: any): o is QueryContractsByCreatorResponse { + return o && (o.$typeUrl === QueryContractsByCreatorResponse.typeUrl || Array.isArray(o.contractAddresses) && (!o.contractAddresses.length || typeof o.contractAddresses[0] === "string")); + }, + isAmino(o: any): o is QueryContractsByCreatorResponseAmino { + return o && (o.$typeUrl === QueryContractsByCreatorResponse.typeUrl || Array.isArray(o.contract_addresses) && (!o.contract_addresses.length || typeof o.contract_addresses[0] === "string")); + }, + encode(message: QueryContractsByCreatorResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.contractAddresses) { + writer.uint32(10).string(v!); + } + if (message.pagination !== undefined) { + PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryContractsByCreatorResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryContractsByCreatorResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.contractAddresses.push(reader.string()); + break; + case 2: + message.pagination = PageResponse.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryContractsByCreatorResponse { + const message = createBaseQueryContractsByCreatorResponse(); + message.contractAddresses = object.contractAddresses?.map(e => e) || []; + message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; + return message; + }, + fromAmino(object: QueryContractsByCreatorResponseAmino): QueryContractsByCreatorResponse { + const message = createBaseQueryContractsByCreatorResponse(); + message.contractAddresses = object.contract_addresses?.map(e => e) || []; + if (object.pagination !== undefined && object.pagination !== null) { + message.pagination = PageResponse.fromAmino(object.pagination); + } + return message; + }, + toAmino(message: QueryContractsByCreatorResponse): QueryContractsByCreatorResponseAmino { + const obj: any = {}; + if (message.contractAddresses) { + obj.contract_addresses = message.contractAddresses.map(e => e); + } else { + obj.contract_addresses = message.contractAddresses; + } + obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; + return obj; + }, + fromAminoMsg(object: QueryContractsByCreatorResponseAminoMsg): QueryContractsByCreatorResponse { + return QueryContractsByCreatorResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryContractsByCreatorResponse): QueryContractsByCreatorResponseAminoMsg { + return { + type: "wasm/QueryContractsByCreatorResponse", + value: QueryContractsByCreatorResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryContractsByCreatorResponseProtoMsg): QueryContractsByCreatorResponse { + return QueryContractsByCreatorResponse.decode(message.value); + }, + toProto(message: QueryContractsByCreatorResponse): Uint8Array { + return QueryContractsByCreatorResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryContractsByCreatorResponse): QueryContractsByCreatorResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QueryContractsByCreatorResponse", + value: QueryContractsByCreatorResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryContractsByCreatorResponse.typeUrl, QueryContractsByCreatorResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryContractsByCreatorResponse.aminoType, QueryContractsByCreatorResponse.typeUrl); +function createBaseQueryBuildAddressRequest(): QueryBuildAddressRequest { + return { + codeHash: "", + creatorAddress: "", + salt: "", + initArgs: new Uint8Array() + }; +} +export const QueryBuildAddressRequest = { + typeUrl: "/cosmwasm.wasm.v1.QueryBuildAddressRequest", + aminoType: "wasm/QueryBuildAddressRequest", + is(o: any): o is QueryBuildAddressRequest { + return o && (o.$typeUrl === QueryBuildAddressRequest.typeUrl || typeof o.codeHash === "string" && typeof o.creatorAddress === "string" && typeof o.salt === "string" && (o.initArgs instanceof Uint8Array || typeof o.initArgs === "string")); + }, + isAmino(o: any): o is QueryBuildAddressRequestAmino { + return o && (o.$typeUrl === QueryBuildAddressRequest.typeUrl || typeof o.code_hash === "string" && typeof o.creator_address === "string" && typeof o.salt === "string" && (o.init_args instanceof Uint8Array || typeof o.init_args === "string")); + }, + encode(message: QueryBuildAddressRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.codeHash !== "") { + writer.uint32(10).string(message.codeHash); + } + if (message.creatorAddress !== "") { + writer.uint32(18).string(message.creatorAddress); + } + if (message.salt !== "") { + writer.uint32(26).string(message.salt); + } + if (message.initArgs.length !== 0) { + writer.uint32(34).bytes(message.initArgs); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryBuildAddressRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBuildAddressRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.codeHash = reader.string(); + break; + case 2: + message.creatorAddress = reader.string(); + break; + case 3: + message.salt = reader.string(); + break; + case 4: + message.initArgs = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryBuildAddressRequest { + const message = createBaseQueryBuildAddressRequest(); + message.codeHash = object.codeHash ?? ""; + message.creatorAddress = object.creatorAddress ?? ""; + message.salt = object.salt ?? ""; + message.initArgs = object.initArgs ?? new Uint8Array(); + return message; + }, + fromAmino(object: QueryBuildAddressRequestAmino): QueryBuildAddressRequest { + const message = createBaseQueryBuildAddressRequest(); + if (object.code_hash !== undefined && object.code_hash !== null) { + message.codeHash = object.code_hash; + } + if (object.creator_address !== undefined && object.creator_address !== null) { + message.creatorAddress = object.creator_address; + } + if (object.salt !== undefined && object.salt !== null) { + message.salt = object.salt; + } + if (object.init_args !== undefined && object.init_args !== null) { + message.initArgs = bytesFromBase64(object.init_args); + } + return message; + }, + toAmino(message: QueryBuildAddressRequest): QueryBuildAddressRequestAmino { + const obj: any = {}; + obj.code_hash = message.codeHash === "" ? undefined : message.codeHash; + obj.creator_address = message.creatorAddress === "" ? undefined : message.creatorAddress; + obj.salt = message.salt === "" ? undefined : message.salt; + obj.init_args = message.initArgs ? base64FromBytes(message.initArgs) : undefined; + return obj; + }, + fromAminoMsg(object: QueryBuildAddressRequestAminoMsg): QueryBuildAddressRequest { + return QueryBuildAddressRequest.fromAmino(object.value); + }, + toAminoMsg(message: QueryBuildAddressRequest): QueryBuildAddressRequestAminoMsg { + return { + type: "wasm/QueryBuildAddressRequest", + value: QueryBuildAddressRequest.toAmino(message) + }; + }, + fromProtoMsg(message: QueryBuildAddressRequestProtoMsg): QueryBuildAddressRequest { + return QueryBuildAddressRequest.decode(message.value); + }, + toProto(message: QueryBuildAddressRequest): Uint8Array { + return QueryBuildAddressRequest.encode(message).finish(); + }, + toProtoMsg(message: QueryBuildAddressRequest): QueryBuildAddressRequestProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QueryBuildAddressRequest", + value: QueryBuildAddressRequest.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryBuildAddressRequest.typeUrl, QueryBuildAddressRequest); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryBuildAddressRequest.aminoType, QueryBuildAddressRequest.typeUrl); +function createBaseQueryBuildAddressResponse(): QueryBuildAddressResponse { + return { + address: "" + }; +} +export const QueryBuildAddressResponse = { + typeUrl: "/cosmwasm.wasm.v1.QueryBuildAddressResponse", + aminoType: "wasm/QueryBuildAddressResponse", + is(o: any): o is QueryBuildAddressResponse { + return o && (o.$typeUrl === QueryBuildAddressResponse.typeUrl || typeof o.address === "string"); + }, + isAmino(o: any): o is QueryBuildAddressResponseAmino { + return o && (o.$typeUrl === QueryBuildAddressResponse.typeUrl || typeof o.address === "string"); + }, + encode(message: QueryBuildAddressResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): QueryBuildAddressResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseQueryBuildAddressResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): QueryBuildAddressResponse { + const message = createBaseQueryBuildAddressResponse(); + message.address = object.address ?? ""; + return message; + }, + fromAmino(object: QueryBuildAddressResponseAmino): QueryBuildAddressResponse { + const message = createBaseQueryBuildAddressResponse(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + return message; + }, + toAmino(message: QueryBuildAddressResponse): QueryBuildAddressResponseAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + return obj; + }, + fromAminoMsg(object: QueryBuildAddressResponseAminoMsg): QueryBuildAddressResponse { + return QueryBuildAddressResponse.fromAmino(object.value); + }, + toAminoMsg(message: QueryBuildAddressResponse): QueryBuildAddressResponseAminoMsg { + return { + type: "wasm/QueryBuildAddressResponse", + value: QueryBuildAddressResponse.toAmino(message) + }; + }, + fromProtoMsg(message: QueryBuildAddressResponseProtoMsg): QueryBuildAddressResponse { + return QueryBuildAddressResponse.decode(message.value); + }, + toProto(message: QueryBuildAddressResponse): Uint8Array { + return QueryBuildAddressResponse.encode(message).finish(); + }, + toProtoMsg(message: QueryBuildAddressResponse): QueryBuildAddressResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.QueryBuildAddressResponse", + value: QueryBuildAddressResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(QueryBuildAddressResponse.typeUrl, QueryBuildAddressResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(QueryBuildAddressResponse.aminoType, QueryBuildAddressResponse.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmwasm/wasm/v1/tx.rpc.func.ts b/libs/interchain-query/src/cosmwasm/wasm/v1/tx.rpc.func.ts new file mode 100644 index 00000000..82a34fc7 --- /dev/null +++ b/libs/interchain-query/src/cosmwasm/wasm/v1/tx.rpc.func.ts @@ -0,0 +1,157 @@ +import { buildTx, SigningClientResolver } from "../../../helper-func-types"; +import { buildUseMutation } from "../../../react-query"; +import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; +import { MsgStoreCode, MsgInstantiateContract, MsgInstantiateContract2, MsgExecuteContract, MsgMigrateContract, MsgUpdateAdmin, MsgClearAdmin, MsgUpdateInstantiateConfig, MsgUpdateParams, MsgSudoContract, MsgPinCodes, MsgUnpinCodes, MsgStoreAndInstantiateContract, MsgRemoveCodeUploadParamsAddresses, MsgAddCodeUploadParamsAddresses, MsgStoreAndMigrateContract, MsgUpdateContractLabel } from "./tx"; +export const createStoreCode = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgStoreCode.typeUrl, + encoders: toEncoders(MsgStoreCode), + converters: toConverters(MsgStoreCode) +}); +export const useStoreCode = buildUseMutation({ + builderMutationFn: createStoreCode +}); +export const createInstantiateContract = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgInstantiateContract.typeUrl, + encoders: toEncoders(MsgInstantiateContract), + converters: toConverters(MsgInstantiateContract) +}); +export const useInstantiateContract = buildUseMutation({ + builderMutationFn: createInstantiateContract +}); +export const createInstantiateContract2 = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgInstantiateContract2.typeUrl, + encoders: toEncoders(MsgInstantiateContract2), + converters: toConverters(MsgInstantiateContract2) +}); +export const useInstantiateContract2 = buildUseMutation({ + builderMutationFn: createInstantiateContract2 +}); +export const createExecuteContract = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgExecuteContract.typeUrl, + encoders: toEncoders(MsgExecuteContract), + converters: toConverters(MsgExecuteContract) +}); +export const useExecuteContract = buildUseMutation({ + builderMutationFn: createExecuteContract +}); +export const createMigrateContract = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgMigrateContract.typeUrl, + encoders: toEncoders(MsgMigrateContract), + converters: toConverters(MsgMigrateContract) +}); +export const useMigrateContract = buildUseMutation({ + builderMutationFn: createMigrateContract +}); +export const createUpdateAdmin = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgUpdateAdmin.typeUrl, + encoders: toEncoders(MsgUpdateAdmin), + converters: toConverters(MsgUpdateAdmin) +}); +export const useUpdateAdmin = buildUseMutation({ + builderMutationFn: createUpdateAdmin +}); +export const createClearAdmin = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgClearAdmin.typeUrl, + encoders: toEncoders(MsgClearAdmin), + converters: toConverters(MsgClearAdmin) +}); +export const useClearAdmin = buildUseMutation({ + builderMutationFn: createClearAdmin +}); +export const createUpdateInstantiateConfig = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgUpdateInstantiateConfig.typeUrl, + encoders: toEncoders(MsgUpdateInstantiateConfig), + converters: toConverters(MsgUpdateInstantiateConfig) +}); +export const useUpdateInstantiateConfig = buildUseMutation({ + builderMutationFn: createUpdateInstantiateConfig +}); +export const createUpdateParams = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgUpdateParams.typeUrl, + encoders: toEncoders(MsgUpdateParams), + converters: toConverters(MsgUpdateParams) +}); +export const useUpdateParams = buildUseMutation({ + builderMutationFn: createUpdateParams +}); +export const createSudoContract = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgSudoContract.typeUrl, + encoders: toEncoders(MsgSudoContract), + converters: toConverters(MsgSudoContract) +}); +export const useSudoContract = buildUseMutation({ + builderMutationFn: createSudoContract +}); +export const createPinCodes = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgPinCodes.typeUrl, + encoders: toEncoders(MsgPinCodes), + converters: toConverters(MsgPinCodes) +}); +export const usePinCodes = buildUseMutation({ + builderMutationFn: createPinCodes +}); +export const createUnpinCodes = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgUnpinCodes.typeUrl, + encoders: toEncoders(MsgUnpinCodes), + converters: toConverters(MsgUnpinCodes) +}); +export const useUnpinCodes = buildUseMutation({ + builderMutationFn: createUnpinCodes +}); +export const createStoreAndInstantiateContract = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgStoreAndInstantiateContract.typeUrl, + encoders: toEncoders(MsgStoreAndInstantiateContract), + converters: toConverters(MsgStoreAndInstantiateContract) +}); +export const useStoreAndInstantiateContract = buildUseMutation({ + builderMutationFn: createStoreAndInstantiateContract +}); +export const createRemoveCodeUploadParamsAddresses = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgRemoveCodeUploadParamsAddresses.typeUrl, + encoders: toEncoders(MsgRemoveCodeUploadParamsAddresses), + converters: toConverters(MsgRemoveCodeUploadParamsAddresses) +}); +export const useRemoveCodeUploadParamsAddresses = buildUseMutation({ + builderMutationFn: createRemoveCodeUploadParamsAddresses +}); +export const createAddCodeUploadParamsAddresses = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgAddCodeUploadParamsAddresses.typeUrl, + encoders: toEncoders(MsgAddCodeUploadParamsAddresses), + converters: toConverters(MsgAddCodeUploadParamsAddresses) +}); +export const useAddCodeUploadParamsAddresses = buildUseMutation({ + builderMutationFn: createAddCodeUploadParamsAddresses +}); +export const createStoreAndMigrateContract = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgStoreAndMigrateContract.typeUrl, + encoders: toEncoders(MsgStoreAndMigrateContract), + converters: toConverters(MsgStoreAndMigrateContract) +}); +export const useStoreAndMigrateContract = buildUseMutation({ + builderMutationFn: createStoreAndMigrateContract +}); +export const createUpdateContractLabel = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgUpdateContractLabel.typeUrl, + encoders: toEncoders(MsgUpdateContractLabel), + converters: toConverters(MsgUpdateContractLabel) +}); +export const useUpdateContractLabel = buildUseMutation({ + builderMutationFn: createUpdateContractLabel +}); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmwasm/wasm/v1/tx.ts b/libs/interchain-query/src/cosmwasm/wasm/v1/tx.ts new file mode 100644 index 00000000..78d085b9 --- /dev/null +++ b/libs/interchain-query/src/cosmwasm/wasm/v1/tx.ts @@ -0,0 +1,4191 @@ +import { AccessConfig, AccessConfigAmino, Params, ParamsAmino } from "./types"; +import { Coin, CoinAmino } from "../../../cosmos/base/v1beta1/coin"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@cosmjs/encoding"; +import { GlobalDecoderRegistry } from "../../../registry"; +/** MsgStoreCode submit Wasm code to the system */ +export interface MsgStoreCode { + /** Sender is the actor that signed the messages */ + sender: string; + /** WASMByteCode can be raw or gzip compressed */ + wasmByteCode: Uint8Array; + /** + * InstantiatePermission access control to apply on contract creation, + * optional + */ + instantiatePermission?: AccessConfig; +} +export interface MsgStoreCodeProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreCode"; + value: Uint8Array; +} +/** MsgStoreCode submit Wasm code to the system */ +export interface MsgStoreCodeAmino { + /** Sender is the actor that signed the messages */ + sender: string; + /** WASMByteCode can be raw or gzip compressed */ + wasm_byte_code: string; + /** + * InstantiatePermission access control to apply on contract creation, + * optional + */ + instantiate_permission?: AccessConfigAmino; +} +export interface MsgStoreCodeAminoMsg { + type: "wasm/MsgStoreCode"; + value: MsgStoreCodeAmino; +} +/** MsgStoreCodeResponse returns store result data. */ +export interface MsgStoreCodeResponse { + /** CodeID is the reference to the stored WASM code */ + codeId: bigint; + /** Checksum is the sha256 hash of the stored code */ + checksum: Uint8Array; +} +export interface MsgStoreCodeResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreCodeResponse"; + value: Uint8Array; +} +/** MsgStoreCodeResponse returns store result data. */ +export interface MsgStoreCodeResponseAmino { + /** CodeID is the reference to the stored WASM code */ + code_id: string; + /** Checksum is the sha256 hash of the stored code */ + checksum: string; +} +export interface MsgStoreCodeResponseAminoMsg { + type: "wasm/MsgStoreCodeResponse"; + value: MsgStoreCodeResponseAmino; +} +/** + * MsgInstantiateContract create a new smart contract instance for the given + * code id. + */ +export interface MsgInstantiateContract { + /** Sender is the that actor that signed the messages */ + sender: string; + /** Admin is an optional address that can execute migrations */ + admin: string; + /** CodeID is the reference to the stored WASM code */ + codeId: bigint; + /** Label is optional metadata to be stored with a contract instance. */ + label: string; + /** Msg json encoded message to be passed to the contract on instantiation */ + msg: Uint8Array; + /** Funds coins that are transferred to the contract on instantiation */ + funds: Coin[]; +} +export interface MsgInstantiateContractProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract"; + value: Uint8Array; +} +/** + * MsgInstantiateContract create a new smart contract instance for the given + * code id. + */ +export interface MsgInstantiateContractAmino { + /** Sender is the that actor that signed the messages */ + sender: string; + /** Admin is an optional address that can execute migrations */ + admin: string; + /** CodeID is the reference to the stored WASM code */ + code_id: string; + /** Label is optional metadata to be stored with a contract instance. */ + label: string; + /** Msg json encoded message to be passed to the contract on instantiation */ + msg: any; + /** Funds coins that are transferred to the contract on instantiation */ + funds: CoinAmino[]; +} +export interface MsgInstantiateContractAminoMsg { + type: "wasm/MsgInstantiateContract"; + value: MsgInstantiateContractAmino; +} +/** MsgInstantiateContractResponse return instantiation result data */ +export interface MsgInstantiateContractResponse { + /** Address is the bech32 address of the new contract instance. */ + address: string; + /** Data contains bytes to returned from the contract */ + data: Uint8Array; +} +export interface MsgInstantiateContractResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContractResponse"; + value: Uint8Array; +} +/** MsgInstantiateContractResponse return instantiation result data */ +export interface MsgInstantiateContractResponseAmino { + /** Address is the bech32 address of the new contract instance. */ + address: string; + /** Data contains bytes to returned from the contract */ + data: string; +} +export interface MsgInstantiateContractResponseAminoMsg { + type: "wasm/MsgInstantiateContractResponse"; + value: MsgInstantiateContractResponseAmino; +} +/** + * MsgInstantiateContract2 create a new smart contract instance for the given + * code id with a predicable address. + */ +export interface MsgInstantiateContract2 { + /** Sender is the that actor that signed the messages */ + sender: string; + /** Admin is an optional address that can execute migrations */ + admin: string; + /** CodeID is the reference to the stored WASM code */ + codeId: bigint; + /** Label is optional metadata to be stored with a contract instance. */ + label: string; + /** Msg json encoded message to be passed to the contract on instantiation */ + msg: Uint8Array; + /** Funds coins that are transferred to the contract on instantiation */ + funds: Coin[]; + /** Salt is an arbitrary value provided by the sender. Size can be 1 to 64. */ + salt: Uint8Array; + /** + * FixMsg include the msg value into the hash for the predictable address. + * Default is false + */ + fixMsg: boolean; +} +export interface MsgInstantiateContract2ProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract2"; + value: Uint8Array; +} +/** + * MsgInstantiateContract2 create a new smart contract instance for the given + * code id with a predicable address. + */ +export interface MsgInstantiateContract2Amino { + /** Sender is the that actor that signed the messages */ + sender: string; + /** Admin is an optional address that can execute migrations */ + admin: string; + /** CodeID is the reference to the stored WASM code */ + code_id: string; + /** Label is optional metadata to be stored with a contract instance. */ + label: string; + /** Msg json encoded message to be passed to the contract on instantiation */ + msg: any; + /** Funds coins that are transferred to the contract on instantiation */ + funds: CoinAmino[]; + /** Salt is an arbitrary value provided by the sender. Size can be 1 to 64. */ + salt: string; + /** + * FixMsg include the msg value into the hash for the predictable address. + * Default is false + */ + fix_msg: boolean; +} +export interface MsgInstantiateContract2AminoMsg { + type: "wasm/MsgInstantiateContract2"; + value: MsgInstantiateContract2Amino; +} +/** MsgInstantiateContract2Response return instantiation result data */ +export interface MsgInstantiateContract2Response { + /** Address is the bech32 address of the new contract instance. */ + address: string; + /** Data contains bytes to returned from the contract */ + data: Uint8Array; +} +export interface MsgInstantiateContract2ResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract2Response"; + value: Uint8Array; +} +/** MsgInstantiateContract2Response return instantiation result data */ +export interface MsgInstantiateContract2ResponseAmino { + /** Address is the bech32 address of the new contract instance. */ + address: string; + /** Data contains bytes to returned from the contract */ + data: string; +} +export interface MsgInstantiateContract2ResponseAminoMsg { + type: "wasm/MsgInstantiateContract2Response"; + value: MsgInstantiateContract2ResponseAmino; +} +/** MsgExecuteContract submits the given message data to a smart contract */ +export interface MsgExecuteContract { + /** Sender is the that actor that signed the messages */ + sender: string; + /** Contract is the address of the smart contract */ + contract: string; + /** Msg json encoded message to be passed to the contract */ + msg: Uint8Array; + /** Funds coins that are transferred to the contract on execution */ + funds: Coin[]; +} +export interface MsgExecuteContractProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract"; + value: Uint8Array; +} +/** MsgExecuteContract submits the given message data to a smart contract */ +export interface MsgExecuteContractAmino { + /** Sender is the that actor that signed the messages */ + sender: string; + /** Contract is the address of the smart contract */ + contract: string; + /** Msg json encoded message to be passed to the contract */ + msg: any; + /** Funds coins that are transferred to the contract on execution */ + funds: CoinAmino[]; +} +export interface MsgExecuteContractAminoMsg { + type: "wasm/MsgExecuteContract"; + value: MsgExecuteContractAmino; +} +/** MsgExecuteContractResponse returns execution result data. */ +export interface MsgExecuteContractResponse { + /** Data contains bytes to returned from the contract */ + data: Uint8Array; +} +export interface MsgExecuteContractResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContractResponse"; + value: Uint8Array; +} +/** MsgExecuteContractResponse returns execution result data. */ +export interface MsgExecuteContractResponseAmino { + /** Data contains bytes to returned from the contract */ + data: string; +} +export interface MsgExecuteContractResponseAminoMsg { + type: "wasm/MsgExecuteContractResponse"; + value: MsgExecuteContractResponseAmino; +} +/** MsgMigrateContract runs a code upgrade/ downgrade for a smart contract */ +export interface MsgMigrateContract { + /** Sender is the that actor that signed the messages */ + sender: string; + /** Contract is the address of the smart contract */ + contract: string; + /** CodeID references the new WASM code */ + codeId: bigint; + /** Msg json encoded message to be passed to the contract on migration */ + msg: Uint8Array; +} +export interface MsgMigrateContractProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgMigrateContract"; + value: Uint8Array; +} +/** MsgMigrateContract runs a code upgrade/ downgrade for a smart contract */ +export interface MsgMigrateContractAmino { + /** Sender is the that actor that signed the messages */ + sender: string; + /** Contract is the address of the smart contract */ + contract: string; + /** CodeID references the new WASM code */ + code_id: string; + /** Msg json encoded message to be passed to the contract on migration */ + msg: any; +} +export interface MsgMigrateContractAminoMsg { + type: "wasm/MsgMigrateContract"; + value: MsgMigrateContractAmino; +} +/** MsgMigrateContractResponse returns contract migration result data. */ +export interface MsgMigrateContractResponse { + /** + * Data contains same raw bytes returned as data from the wasm contract. + * (May be empty) + */ + data: Uint8Array; +} +export interface MsgMigrateContractResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgMigrateContractResponse"; + value: Uint8Array; +} +/** MsgMigrateContractResponse returns contract migration result data. */ +export interface MsgMigrateContractResponseAmino { + /** + * Data contains same raw bytes returned as data from the wasm contract. + * (May be empty) + */ + data: string; +} +export interface MsgMigrateContractResponseAminoMsg { + type: "wasm/MsgMigrateContractResponse"; + value: MsgMigrateContractResponseAmino; +} +/** MsgUpdateAdmin sets a new admin for a smart contract */ +export interface MsgUpdateAdmin { + /** Sender is the that actor that signed the messages */ + sender: string; + /** NewAdmin address to be set */ + newAdmin: string; + /** Contract is the address of the smart contract */ + contract: string; +} +export interface MsgUpdateAdminProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateAdmin"; + value: Uint8Array; +} +/** MsgUpdateAdmin sets a new admin for a smart contract */ +export interface MsgUpdateAdminAmino { + /** Sender is the that actor that signed the messages */ + sender: string; + /** NewAdmin address to be set */ + new_admin: string; + /** Contract is the address of the smart contract */ + contract: string; +} +export interface MsgUpdateAdminAminoMsg { + type: "wasm/MsgUpdateAdmin"; + value: MsgUpdateAdminAmino; +} +/** MsgUpdateAdminResponse returns empty data */ +export interface MsgUpdateAdminResponse {} +export interface MsgUpdateAdminResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateAdminResponse"; + value: Uint8Array; +} +/** MsgUpdateAdminResponse returns empty data */ +export interface MsgUpdateAdminResponseAmino {} +export interface MsgUpdateAdminResponseAminoMsg { + type: "wasm/MsgUpdateAdminResponse"; + value: MsgUpdateAdminResponseAmino; +} +/** MsgClearAdmin removes any admin stored for a smart contract */ +export interface MsgClearAdmin { + /** Sender is the actor that signed the messages */ + sender: string; + /** Contract is the address of the smart contract */ + contract: string; +} +export interface MsgClearAdminProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgClearAdmin"; + value: Uint8Array; +} +/** MsgClearAdmin removes any admin stored for a smart contract */ +export interface MsgClearAdminAmino { + /** Sender is the actor that signed the messages */ + sender: string; + /** Contract is the address of the smart contract */ + contract: string; +} +export interface MsgClearAdminAminoMsg { + type: "wasm/MsgClearAdmin"; + value: MsgClearAdminAmino; +} +/** MsgClearAdminResponse returns empty data */ +export interface MsgClearAdminResponse {} +export interface MsgClearAdminResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgClearAdminResponse"; + value: Uint8Array; +} +/** MsgClearAdminResponse returns empty data */ +export interface MsgClearAdminResponseAmino {} +export interface MsgClearAdminResponseAminoMsg { + type: "wasm/MsgClearAdminResponse"; + value: MsgClearAdminResponseAmino; +} +/** MsgUpdateInstantiateConfig updates instantiate config for a smart contract */ +export interface MsgUpdateInstantiateConfig { + /** Sender is the that actor that signed the messages */ + sender: string; + /** CodeID references the stored WASM code */ + codeId: bigint; + /** NewInstantiatePermission is the new access control */ + newInstantiatePermission?: AccessConfig; +} +export interface MsgUpdateInstantiateConfigProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateInstantiateConfig"; + value: Uint8Array; +} +/** MsgUpdateInstantiateConfig updates instantiate config for a smart contract */ +export interface MsgUpdateInstantiateConfigAmino { + /** Sender is the that actor that signed the messages */ + sender: string; + /** CodeID references the stored WASM code */ + code_id: string; + /** NewInstantiatePermission is the new access control */ + new_instantiate_permission?: AccessConfigAmino; +} +export interface MsgUpdateInstantiateConfigAminoMsg { + type: "wasm/MsgUpdateInstantiateConfig"; + value: MsgUpdateInstantiateConfigAmino; +} +/** MsgUpdateInstantiateConfigResponse returns empty data */ +export interface MsgUpdateInstantiateConfigResponse {} +export interface MsgUpdateInstantiateConfigResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateInstantiateConfigResponse"; + value: Uint8Array; +} +/** MsgUpdateInstantiateConfigResponse returns empty data */ +export interface MsgUpdateInstantiateConfigResponseAmino {} +export interface MsgUpdateInstantiateConfigResponseAminoMsg { + type: "wasm/MsgUpdateInstantiateConfigResponse"; + value: MsgUpdateInstantiateConfigResponseAmino; +} +/** + * MsgUpdateParams is the MsgUpdateParams request type. + * + * Since: 0.40 + */ +export interface MsgUpdateParams { + /** Authority is the address of the governance account. */ + authority: string; + /** + * params defines the x/wasm parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params; +} +export interface MsgUpdateParamsProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateParams"; + value: Uint8Array; +} +/** + * MsgUpdateParams is the MsgUpdateParams request type. + * + * Since: 0.40 + */ +export interface MsgUpdateParamsAmino { + /** Authority is the address of the governance account. */ + authority: string; + /** + * params defines the x/wasm parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: ParamsAmino; +} +export interface MsgUpdateParamsAminoMsg { + type: "wasm/MsgUpdateParams"; + value: MsgUpdateParamsAmino; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: 0.40 + */ +export interface MsgUpdateParamsResponse {} +export interface MsgUpdateParamsResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateParamsResponse"; + value: Uint8Array; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + * + * Since: 0.40 + */ +export interface MsgUpdateParamsResponseAmino {} +export interface MsgUpdateParamsResponseAminoMsg { + type: "wasm/MsgUpdateParamsResponse"; + value: MsgUpdateParamsResponseAmino; +} +/** + * MsgSudoContract is the MsgSudoContract request type. + * + * Since: 0.40 + */ +export interface MsgSudoContract { + /** Authority is the address of the governance account. */ + authority: string; + /** Contract is the address of the smart contract */ + contract: string; + /** Msg json encoded message to be passed to the contract as sudo */ + msg: Uint8Array; +} +export interface MsgSudoContractProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgSudoContract"; + value: Uint8Array; +} +/** + * MsgSudoContract is the MsgSudoContract request type. + * + * Since: 0.40 + */ +export interface MsgSudoContractAmino { + /** Authority is the address of the governance account. */ + authority: string; + /** Contract is the address of the smart contract */ + contract: string; + /** Msg json encoded message to be passed to the contract as sudo */ + msg: any; +} +export interface MsgSudoContractAminoMsg { + type: "wasm/MsgSudoContract"; + value: MsgSudoContractAmino; +} +/** + * MsgSudoContractResponse defines the response structure for executing a + * MsgSudoContract message. + * + * Since: 0.40 + */ +export interface MsgSudoContractResponse { + /** Data contains bytes to returned from the contract */ + data: Uint8Array; +} +export interface MsgSudoContractResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgSudoContractResponse"; + value: Uint8Array; +} +/** + * MsgSudoContractResponse defines the response structure for executing a + * MsgSudoContract message. + * + * Since: 0.40 + */ +export interface MsgSudoContractResponseAmino { + /** Data contains bytes to returned from the contract */ + data: string; +} +export interface MsgSudoContractResponseAminoMsg { + type: "wasm/MsgSudoContractResponse"; + value: MsgSudoContractResponseAmino; +} +/** + * MsgPinCodes is the MsgPinCodes request type. + * + * Since: 0.40 + */ +export interface MsgPinCodes { + /** Authority is the address of the governance account. */ + authority: string; + /** CodeIDs references the new WASM codes */ + codeIds: bigint[]; +} +export interface MsgPinCodesProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgPinCodes"; + value: Uint8Array; +} +/** + * MsgPinCodes is the MsgPinCodes request type. + * + * Since: 0.40 + */ +export interface MsgPinCodesAmino { + /** Authority is the address of the governance account. */ + authority: string; + /** CodeIDs references the new WASM codes */ + code_ids: string[]; +} +export interface MsgPinCodesAminoMsg { + type: "wasm/MsgPinCodes"; + value: MsgPinCodesAmino; +} +/** + * MsgPinCodesResponse defines the response structure for executing a + * MsgPinCodes message. + * + * Since: 0.40 + */ +export interface MsgPinCodesResponse {} +export interface MsgPinCodesResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgPinCodesResponse"; + value: Uint8Array; +} +/** + * MsgPinCodesResponse defines the response structure for executing a + * MsgPinCodes message. + * + * Since: 0.40 + */ +export interface MsgPinCodesResponseAmino {} +export interface MsgPinCodesResponseAminoMsg { + type: "wasm/MsgPinCodesResponse"; + value: MsgPinCodesResponseAmino; +} +/** + * MsgUnpinCodes is the MsgUnpinCodes request type. + * + * Since: 0.40 + */ +export interface MsgUnpinCodes { + /** Authority is the address of the governance account. */ + authority: string; + /** CodeIDs references the WASM codes */ + codeIds: bigint[]; +} +export interface MsgUnpinCodesProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgUnpinCodes"; + value: Uint8Array; +} +/** + * MsgUnpinCodes is the MsgUnpinCodes request type. + * + * Since: 0.40 + */ +export interface MsgUnpinCodesAmino { + /** Authority is the address of the governance account. */ + authority: string; + /** CodeIDs references the WASM codes */ + code_ids: string[]; +} +export interface MsgUnpinCodesAminoMsg { + type: "wasm/MsgUnpinCodes"; + value: MsgUnpinCodesAmino; +} +/** + * MsgUnpinCodesResponse defines the response structure for executing a + * MsgUnpinCodes message. + * + * Since: 0.40 + */ +export interface MsgUnpinCodesResponse {} +export interface MsgUnpinCodesResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgUnpinCodesResponse"; + value: Uint8Array; +} +/** + * MsgUnpinCodesResponse defines the response structure for executing a + * MsgUnpinCodes message. + * + * Since: 0.40 + */ +export interface MsgUnpinCodesResponseAmino {} +export interface MsgUnpinCodesResponseAminoMsg { + type: "wasm/MsgUnpinCodesResponse"; + value: MsgUnpinCodesResponseAmino; +} +/** + * MsgStoreAndInstantiateContract is the MsgStoreAndInstantiateContract + * request type. + * + * Since: 0.40 + */ +export interface MsgStoreAndInstantiateContract { + /** Authority is the address of the governance account. */ + authority: string; + /** WASMByteCode can be raw or gzip compressed */ + wasmByteCode: Uint8Array; + /** InstantiatePermission to apply on contract creation, optional */ + instantiatePermission?: AccessConfig; + /** + * UnpinCode code on upload, optional. As default the uploaded contract is + * pinned to cache. + */ + unpinCode: boolean; + /** Admin is an optional address that can execute migrations */ + admin: string; + /** Label is optional metadata to be stored with a constract instance. */ + label: string; + /** Msg json encoded message to be passed to the contract on instantiation */ + msg: Uint8Array; + /** + * Funds coins that are transferred from the authority account to the contract + * on instantiation + */ + funds: Coin[]; + /** Source is the URL where the code is hosted */ + source: string; + /** + * Builder is the docker image used to build the code deterministically, used + * for smart contract verification + */ + builder: string; + /** + * CodeHash is the SHA256 sum of the code outputted by builder, used for smart + * contract verification + */ + codeHash: Uint8Array; +} +export interface MsgStoreAndInstantiateContractProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreAndInstantiateContract"; + value: Uint8Array; +} +/** + * MsgStoreAndInstantiateContract is the MsgStoreAndInstantiateContract + * request type. + * + * Since: 0.40 + */ +export interface MsgStoreAndInstantiateContractAmino { + /** Authority is the address of the governance account. */ + authority: string; + /** WASMByteCode can be raw or gzip compressed */ + wasm_byte_code: string; + /** InstantiatePermission to apply on contract creation, optional */ + instantiate_permission?: AccessConfigAmino; + /** + * UnpinCode code on upload, optional. As default the uploaded contract is + * pinned to cache. + */ + unpin_code: boolean; + /** Admin is an optional address that can execute migrations */ + admin: string; + /** Label is optional metadata to be stored with a constract instance. */ + label: string; + /** Msg json encoded message to be passed to the contract on instantiation */ + msg: any; + /** + * Funds coins that are transferred from the authority account to the contract + * on instantiation + */ + funds: CoinAmino[]; + /** Source is the URL where the code is hosted */ + source: string; + /** + * Builder is the docker image used to build the code deterministically, used + * for smart contract verification + */ + builder: string; + /** + * CodeHash is the SHA256 sum of the code outputted by builder, used for smart + * contract verification + */ + code_hash: string; +} +export interface MsgStoreAndInstantiateContractAminoMsg { + type: "wasm/MsgStoreAndInstantiateContract"; + value: MsgStoreAndInstantiateContractAmino; +} +/** + * MsgStoreAndInstantiateContractResponse defines the response structure + * for executing a MsgStoreAndInstantiateContract message. + * + * Since: 0.40 + */ +export interface MsgStoreAndInstantiateContractResponse { + /** Address is the bech32 address of the new contract instance. */ + address: string; + /** Data contains bytes to returned from the contract */ + data: Uint8Array; +} +export interface MsgStoreAndInstantiateContractResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreAndInstantiateContractResponse"; + value: Uint8Array; +} +/** + * MsgStoreAndInstantiateContractResponse defines the response structure + * for executing a MsgStoreAndInstantiateContract message. + * + * Since: 0.40 + */ +export interface MsgStoreAndInstantiateContractResponseAmino { + /** Address is the bech32 address of the new contract instance. */ + address: string; + /** Data contains bytes to returned from the contract */ + data: string; +} +export interface MsgStoreAndInstantiateContractResponseAminoMsg { + type: "wasm/MsgStoreAndInstantiateContractResponse"; + value: MsgStoreAndInstantiateContractResponseAmino; +} +/** + * MsgAddCodeUploadParamsAddresses is the + * MsgAddCodeUploadParamsAddresses request type. + */ +export interface MsgAddCodeUploadParamsAddresses { + /** Authority is the address of the governance account. */ + authority: string; + addresses: string[]; +} +export interface MsgAddCodeUploadParamsAddressesProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddresses"; + value: Uint8Array; +} +/** + * MsgAddCodeUploadParamsAddresses is the + * MsgAddCodeUploadParamsAddresses request type. + */ +export interface MsgAddCodeUploadParamsAddressesAmino { + /** Authority is the address of the governance account. */ + authority: string; + addresses: string[]; +} +export interface MsgAddCodeUploadParamsAddressesAminoMsg { + type: "wasm/MsgAddCodeUploadParamsAddresses"; + value: MsgAddCodeUploadParamsAddressesAmino; +} +/** + * MsgAddCodeUploadParamsAddressesResponse defines the response + * structure for executing a MsgAddCodeUploadParamsAddresses message. + */ +export interface MsgAddCodeUploadParamsAddressesResponse {} +export interface MsgAddCodeUploadParamsAddressesResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddressesResponse"; + value: Uint8Array; +} +/** + * MsgAddCodeUploadParamsAddressesResponse defines the response + * structure for executing a MsgAddCodeUploadParamsAddresses message. + */ +export interface MsgAddCodeUploadParamsAddressesResponseAmino {} +export interface MsgAddCodeUploadParamsAddressesResponseAminoMsg { + type: "wasm/MsgAddCodeUploadParamsAddressesResponse"; + value: MsgAddCodeUploadParamsAddressesResponseAmino; +} +/** + * MsgRemoveCodeUploadParamsAddresses is the + * MsgRemoveCodeUploadParamsAddresses request type. + */ +export interface MsgRemoveCodeUploadParamsAddresses { + /** Authority is the address of the governance account. */ + authority: string; + addresses: string[]; +} +export interface MsgRemoveCodeUploadParamsAddressesProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddresses"; + value: Uint8Array; +} +/** + * MsgRemoveCodeUploadParamsAddresses is the + * MsgRemoveCodeUploadParamsAddresses request type. + */ +export interface MsgRemoveCodeUploadParamsAddressesAmino { + /** Authority is the address of the governance account. */ + authority: string; + addresses: string[]; +} +export interface MsgRemoveCodeUploadParamsAddressesAminoMsg { + type: "wasm/MsgRemoveCodeUploadParamsAddresses"; + value: MsgRemoveCodeUploadParamsAddressesAmino; +} +/** + * MsgRemoveCodeUploadParamsAddressesResponse defines the response + * structure for executing a MsgRemoveCodeUploadParamsAddresses message. + */ +export interface MsgRemoveCodeUploadParamsAddressesResponse {} +export interface MsgRemoveCodeUploadParamsAddressesResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddressesResponse"; + value: Uint8Array; +} +/** + * MsgRemoveCodeUploadParamsAddressesResponse defines the response + * structure for executing a MsgRemoveCodeUploadParamsAddresses message. + */ +export interface MsgRemoveCodeUploadParamsAddressesResponseAmino {} +export interface MsgRemoveCodeUploadParamsAddressesResponseAminoMsg { + type: "wasm/MsgRemoveCodeUploadParamsAddressesResponse"; + value: MsgRemoveCodeUploadParamsAddressesResponseAmino; +} +/** + * MsgStoreAndMigrateContract is the MsgStoreAndMigrateContract + * request type. + * + * Since: 0.42 + */ +export interface MsgStoreAndMigrateContract { + /** Authority is the address of the governance account. */ + authority: string; + /** WASMByteCode can be raw or gzip compressed */ + wasmByteCode: Uint8Array; + /** InstantiatePermission to apply on contract creation, optional */ + instantiatePermission?: AccessConfig; + /** Contract is the address of the smart contract */ + contract: string; + /** Msg json encoded message to be passed to the contract on migration */ + msg: Uint8Array; +} +export interface MsgStoreAndMigrateContractProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreAndMigrateContract"; + value: Uint8Array; +} +/** + * MsgStoreAndMigrateContract is the MsgStoreAndMigrateContract + * request type. + * + * Since: 0.42 + */ +export interface MsgStoreAndMigrateContractAmino { + /** Authority is the address of the governance account. */ + authority: string; + /** WASMByteCode can be raw or gzip compressed */ + wasm_byte_code: string; + /** InstantiatePermission to apply on contract creation, optional */ + instantiate_permission?: AccessConfigAmino; + /** Contract is the address of the smart contract */ + contract: string; + /** Msg json encoded message to be passed to the contract on migration */ + msg: any; +} +export interface MsgStoreAndMigrateContractAminoMsg { + type: "wasm/MsgStoreAndMigrateContract"; + value: MsgStoreAndMigrateContractAmino; +} +/** + * MsgStoreAndMigrateContractResponse defines the response structure + * for executing a MsgStoreAndMigrateContract message. + * + * Since: 0.42 + */ +export interface MsgStoreAndMigrateContractResponse { + /** CodeID is the reference to the stored WASM code */ + codeId: bigint; + /** Checksum is the sha256 hash of the stored code */ + checksum: Uint8Array; + /** Data contains bytes to returned from the contract */ + data: Uint8Array; +} +export interface MsgStoreAndMigrateContractResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreAndMigrateContractResponse"; + value: Uint8Array; +} +/** + * MsgStoreAndMigrateContractResponse defines the response structure + * for executing a MsgStoreAndMigrateContract message. + * + * Since: 0.42 + */ +export interface MsgStoreAndMigrateContractResponseAmino { + /** CodeID is the reference to the stored WASM code */ + code_id: string; + /** Checksum is the sha256 hash of the stored code */ + checksum: string; + /** Data contains bytes to returned from the contract */ + data: string; +} +export interface MsgStoreAndMigrateContractResponseAminoMsg { + type: "wasm/MsgStoreAndMigrateContractResponse"; + value: MsgStoreAndMigrateContractResponseAmino; +} +/** MsgUpdateContractLabel sets a new label for a smart contract */ +export interface MsgUpdateContractLabel { + /** Sender is the that actor that signed the messages */ + sender: string; + /** NewLabel string to be set */ + newLabel: string; + /** Contract is the address of the smart contract */ + contract: string; +} +export interface MsgUpdateContractLabelProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateContractLabel"; + value: Uint8Array; +} +/** MsgUpdateContractLabel sets a new label for a smart contract */ +export interface MsgUpdateContractLabelAmino { + /** Sender is the that actor that signed the messages */ + sender: string; + /** NewLabel string to be set */ + new_label: string; + /** Contract is the address of the smart contract */ + contract: string; +} +export interface MsgUpdateContractLabelAminoMsg { + type: "wasm/MsgUpdateContractLabel"; + value: MsgUpdateContractLabelAmino; +} +/** MsgUpdateContractLabelResponse returns empty data */ +export interface MsgUpdateContractLabelResponse {} +export interface MsgUpdateContractLabelResponseProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateContractLabelResponse"; + value: Uint8Array; +} +/** MsgUpdateContractLabelResponse returns empty data */ +export interface MsgUpdateContractLabelResponseAmino {} +export interface MsgUpdateContractLabelResponseAminoMsg { + type: "wasm/MsgUpdateContractLabelResponse"; + value: MsgUpdateContractLabelResponseAmino; +} +function createBaseMsgStoreCode(): MsgStoreCode { + return { + sender: "", + wasmByteCode: new Uint8Array(), + instantiatePermission: undefined + }; +} +export const MsgStoreCode = { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreCode", + aminoType: "wasm/MsgStoreCode", + is(o: any): o is MsgStoreCode { + return o && (o.$typeUrl === MsgStoreCode.typeUrl || typeof o.sender === "string" && (o.wasmByteCode instanceof Uint8Array || typeof o.wasmByteCode === "string")); + }, + isAmino(o: any): o is MsgStoreCodeAmino { + return o && (o.$typeUrl === MsgStoreCode.typeUrl || typeof o.sender === "string" && (o.wasm_byte_code instanceof Uint8Array || typeof o.wasm_byte_code === "string")); + }, + encode(message: MsgStoreCode, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.wasmByteCode.length !== 0) { + writer.uint32(18).bytes(message.wasmByteCode); + } + if (message.instantiatePermission !== undefined) { + AccessConfig.encode(message.instantiatePermission, writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgStoreCode { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgStoreCode(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sender = reader.string(); + break; + case 2: + message.wasmByteCode = reader.bytes(); + break; + case 5: + message.instantiatePermission = AccessConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgStoreCode { + const message = createBaseMsgStoreCode(); + message.sender = object.sender ?? ""; + message.wasmByteCode = object.wasmByteCode ?? new Uint8Array(); + message.instantiatePermission = object.instantiatePermission !== undefined && object.instantiatePermission !== null ? AccessConfig.fromPartial(object.instantiatePermission) : undefined; + return message; + }, + fromAmino(object: MsgStoreCodeAmino): MsgStoreCode { + const message = createBaseMsgStoreCode(); + if (object.sender !== undefined && object.sender !== null) { + message.sender = object.sender; + } + if (object.wasm_byte_code !== undefined && object.wasm_byte_code !== null) { + message.wasmByteCode = fromBase64(object.wasm_byte_code); + } + if (object.instantiate_permission !== undefined && object.instantiate_permission !== null) { + message.instantiatePermission = AccessConfig.fromAmino(object.instantiate_permission); + } + return message; + }, + toAmino(message: MsgStoreCode): MsgStoreCodeAmino { + const obj: any = {}; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.wasm_byte_code = message.wasmByteCode ? toBase64(message.wasmByteCode) : undefined; + obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission) : undefined; + return obj; + }, + fromAminoMsg(object: MsgStoreCodeAminoMsg): MsgStoreCode { + return MsgStoreCode.fromAmino(object.value); + }, + toAminoMsg(message: MsgStoreCode): MsgStoreCodeAminoMsg { + return { + type: "wasm/MsgStoreCode", + value: MsgStoreCode.toAmino(message) + }; + }, + fromProtoMsg(message: MsgStoreCodeProtoMsg): MsgStoreCode { + return MsgStoreCode.decode(message.value); + }, + toProto(message: MsgStoreCode): Uint8Array { + return MsgStoreCode.encode(message).finish(); + }, + toProtoMsg(message: MsgStoreCode): MsgStoreCodeProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreCode", + value: MsgStoreCode.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgStoreCode.typeUrl, MsgStoreCode); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgStoreCode.aminoType, MsgStoreCode.typeUrl); +function createBaseMsgStoreCodeResponse(): MsgStoreCodeResponse { + return { + codeId: BigInt(0), + checksum: new Uint8Array() + }; +} +export const MsgStoreCodeResponse = { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreCodeResponse", + aminoType: "wasm/MsgStoreCodeResponse", + is(o: any): o is MsgStoreCodeResponse { + return o && (o.$typeUrl === MsgStoreCodeResponse.typeUrl || typeof o.codeId === "bigint" && (o.checksum instanceof Uint8Array || typeof o.checksum === "string")); + }, + isAmino(o: any): o is MsgStoreCodeResponseAmino { + return o && (o.$typeUrl === MsgStoreCodeResponse.typeUrl || typeof o.code_id === "bigint" && (o.checksum instanceof Uint8Array || typeof o.checksum === "string")); + }, + encode(message: MsgStoreCodeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.codeId !== BigInt(0)) { + writer.uint32(8).uint64(message.codeId); + } + if (message.checksum.length !== 0) { + writer.uint32(18).bytes(message.checksum); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgStoreCodeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgStoreCodeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.codeId = reader.uint64(); + break; + case 2: + message.checksum = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgStoreCodeResponse { + const message = createBaseMsgStoreCodeResponse(); + message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); + message.checksum = object.checksum ?? new Uint8Array(); + return message; + }, + fromAmino(object: MsgStoreCodeResponseAmino): MsgStoreCodeResponse { + const message = createBaseMsgStoreCodeResponse(); + if (object.code_id !== undefined && object.code_id !== null) { + message.codeId = BigInt(object.code_id); + } + if (object.checksum !== undefined && object.checksum !== null) { + message.checksum = bytesFromBase64(object.checksum); + } + return message; + }, + toAmino(message: MsgStoreCodeResponse): MsgStoreCodeResponseAmino { + const obj: any = {}; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId?.toString() : undefined; + obj.checksum = message.checksum ? base64FromBytes(message.checksum) : undefined; + return obj; + }, + fromAminoMsg(object: MsgStoreCodeResponseAminoMsg): MsgStoreCodeResponse { + return MsgStoreCodeResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgStoreCodeResponse): MsgStoreCodeResponseAminoMsg { + return { + type: "wasm/MsgStoreCodeResponse", + value: MsgStoreCodeResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgStoreCodeResponseProtoMsg): MsgStoreCodeResponse { + return MsgStoreCodeResponse.decode(message.value); + }, + toProto(message: MsgStoreCodeResponse): Uint8Array { + return MsgStoreCodeResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgStoreCodeResponse): MsgStoreCodeResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreCodeResponse", + value: MsgStoreCodeResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgStoreCodeResponse.typeUrl, MsgStoreCodeResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgStoreCodeResponse.aminoType, MsgStoreCodeResponse.typeUrl); +function createBaseMsgInstantiateContract(): MsgInstantiateContract { + return { + sender: "", + admin: "", + codeId: BigInt(0), + label: "", + msg: new Uint8Array(), + funds: [] + }; +} +export const MsgInstantiateContract = { + typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract", + aminoType: "wasm/MsgInstantiateContract", + is(o: any): o is MsgInstantiateContract { + return o && (o.$typeUrl === MsgInstantiateContract.typeUrl || typeof o.sender === "string" && typeof o.admin === "string" && typeof o.codeId === "bigint" && typeof o.label === "string" && (o.msg instanceof Uint8Array || typeof o.msg === "string") && Array.isArray(o.funds) && (!o.funds.length || Coin.is(o.funds[0]))); + }, + isAmino(o: any): o is MsgInstantiateContractAmino { + return o && (o.$typeUrl === MsgInstantiateContract.typeUrl || typeof o.sender === "string" && typeof o.admin === "string" && typeof o.code_id === "bigint" && typeof o.label === "string" && (o.msg instanceof Uint8Array || typeof o.msg === "string") && Array.isArray(o.funds) && (!o.funds.length || Coin.isAmino(o.funds[0]))); + }, + encode(message: MsgInstantiateContract, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.admin !== "") { + writer.uint32(18).string(message.admin); + } + if (message.codeId !== BigInt(0)) { + writer.uint32(24).uint64(message.codeId); + } + if (message.label !== "") { + writer.uint32(34).string(message.label); + } + if (message.msg.length !== 0) { + writer.uint32(42).bytes(message.msg); + } + for (const v of message.funds) { + Coin.encode(v!, writer.uint32(50).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgInstantiateContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgInstantiateContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sender = reader.string(); + break; + case 2: + message.admin = reader.string(); + break; + case 3: + message.codeId = reader.uint64(); + break; + case 4: + message.label = reader.string(); + break; + case 5: + message.msg = reader.bytes(); + break; + case 6: + message.funds.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgInstantiateContract { + const message = createBaseMsgInstantiateContract(); + message.sender = object.sender ?? ""; + message.admin = object.admin ?? ""; + message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); + message.label = object.label ?? ""; + message.msg = object.msg ?? new Uint8Array(); + message.funds = object.funds?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MsgInstantiateContractAmino): MsgInstantiateContract { + const message = createBaseMsgInstantiateContract(); + if (object.sender !== undefined && object.sender !== null) { + message.sender = object.sender; + } + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + if (object.code_id !== undefined && object.code_id !== null) { + message.codeId = BigInt(object.code_id); + } + if (object.label !== undefined && object.label !== null) { + message.label = object.label; + } + if (object.msg !== undefined && object.msg !== null) { + message.msg = toUtf8(JSON.stringify(object.msg)); + } + message.funds = object.funds?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgInstantiateContract): MsgInstantiateContractAmino { + const obj: any = {}; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId?.toString() : undefined; + obj.label = message.label === "" ? undefined : message.label; + obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; + if (message.funds) { + obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.funds = message.funds; + } + return obj; + }, + fromAminoMsg(object: MsgInstantiateContractAminoMsg): MsgInstantiateContract { + return MsgInstantiateContract.fromAmino(object.value); + }, + toAminoMsg(message: MsgInstantiateContract): MsgInstantiateContractAminoMsg { + return { + type: "wasm/MsgInstantiateContract", + value: MsgInstantiateContract.toAmino(message) + }; + }, + fromProtoMsg(message: MsgInstantiateContractProtoMsg): MsgInstantiateContract { + return MsgInstantiateContract.decode(message.value); + }, + toProto(message: MsgInstantiateContract): Uint8Array { + return MsgInstantiateContract.encode(message).finish(); + }, + toProtoMsg(message: MsgInstantiateContract): MsgInstantiateContractProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract", + value: MsgInstantiateContract.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgInstantiateContract.typeUrl, MsgInstantiateContract); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgInstantiateContract.aminoType, MsgInstantiateContract.typeUrl); +function createBaseMsgInstantiateContractResponse(): MsgInstantiateContractResponse { + return { + address: "", + data: new Uint8Array() + }; +} +export const MsgInstantiateContractResponse = { + typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContractResponse", + aminoType: "wasm/MsgInstantiateContractResponse", + is(o: any): o is MsgInstantiateContractResponse { + return o && (o.$typeUrl === MsgInstantiateContractResponse.typeUrl || typeof o.address === "string" && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + isAmino(o: any): o is MsgInstantiateContractResponseAmino { + return o && (o.$typeUrl === MsgInstantiateContractResponse.typeUrl || typeof o.address === "string" && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + encode(message: MsgInstantiateContractResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgInstantiateContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgInstantiateContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgInstantiateContractResponse { + const message = createBaseMsgInstantiateContractResponse(); + message.address = object.address ?? ""; + message.data = object.data ?? new Uint8Array(); + return message; + }, + fromAmino(object: MsgInstantiateContractResponseAmino): MsgInstantiateContractResponse { + const message = createBaseMsgInstantiateContractResponse(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + return message; + }, + toAmino(message: MsgInstantiateContractResponse): MsgInstantiateContractResponseAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + return obj; + }, + fromAminoMsg(object: MsgInstantiateContractResponseAminoMsg): MsgInstantiateContractResponse { + return MsgInstantiateContractResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgInstantiateContractResponse): MsgInstantiateContractResponseAminoMsg { + return { + type: "wasm/MsgInstantiateContractResponse", + value: MsgInstantiateContractResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgInstantiateContractResponseProtoMsg): MsgInstantiateContractResponse { + return MsgInstantiateContractResponse.decode(message.value); + }, + toProto(message: MsgInstantiateContractResponse): Uint8Array { + return MsgInstantiateContractResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgInstantiateContractResponse): MsgInstantiateContractResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContractResponse", + value: MsgInstantiateContractResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgInstantiateContractResponse.typeUrl, MsgInstantiateContractResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgInstantiateContractResponse.aminoType, MsgInstantiateContractResponse.typeUrl); +function createBaseMsgInstantiateContract2(): MsgInstantiateContract2 { + return { + sender: "", + admin: "", + codeId: BigInt(0), + label: "", + msg: new Uint8Array(), + funds: [], + salt: new Uint8Array(), + fixMsg: false + }; +} +export const MsgInstantiateContract2 = { + typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract2", + aminoType: "wasm/MsgInstantiateContract2", + is(o: any): o is MsgInstantiateContract2 { + return o && (o.$typeUrl === MsgInstantiateContract2.typeUrl || typeof o.sender === "string" && typeof o.admin === "string" && typeof o.codeId === "bigint" && typeof o.label === "string" && (o.msg instanceof Uint8Array || typeof o.msg === "string") && Array.isArray(o.funds) && (!o.funds.length || Coin.is(o.funds[0])) && (o.salt instanceof Uint8Array || typeof o.salt === "string") && typeof o.fixMsg === "boolean"); + }, + isAmino(o: any): o is MsgInstantiateContract2Amino { + return o && (o.$typeUrl === MsgInstantiateContract2.typeUrl || typeof o.sender === "string" && typeof o.admin === "string" && typeof o.code_id === "bigint" && typeof o.label === "string" && (o.msg instanceof Uint8Array || typeof o.msg === "string") && Array.isArray(o.funds) && (!o.funds.length || Coin.isAmino(o.funds[0])) && (o.salt instanceof Uint8Array || typeof o.salt === "string") && typeof o.fix_msg === "boolean"); + }, + encode(message: MsgInstantiateContract2, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.admin !== "") { + writer.uint32(18).string(message.admin); + } + if (message.codeId !== BigInt(0)) { + writer.uint32(24).uint64(message.codeId); + } + if (message.label !== "") { + writer.uint32(34).string(message.label); + } + if (message.msg.length !== 0) { + writer.uint32(42).bytes(message.msg); + } + for (const v of message.funds) { + Coin.encode(v!, writer.uint32(50).fork()).ldelim(); + } + if (message.salt.length !== 0) { + writer.uint32(58).bytes(message.salt); + } + if (message.fixMsg === true) { + writer.uint32(64).bool(message.fixMsg); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgInstantiateContract2 { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgInstantiateContract2(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sender = reader.string(); + break; + case 2: + message.admin = reader.string(); + break; + case 3: + message.codeId = reader.uint64(); + break; + case 4: + message.label = reader.string(); + break; + case 5: + message.msg = reader.bytes(); + break; + case 6: + message.funds.push(Coin.decode(reader, reader.uint32())); + break; + case 7: + message.salt = reader.bytes(); + break; + case 8: + message.fixMsg = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgInstantiateContract2 { + const message = createBaseMsgInstantiateContract2(); + message.sender = object.sender ?? ""; + message.admin = object.admin ?? ""; + message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); + message.label = object.label ?? ""; + message.msg = object.msg ?? new Uint8Array(); + message.funds = object.funds?.map(e => Coin.fromPartial(e)) || []; + message.salt = object.salt ?? new Uint8Array(); + message.fixMsg = object.fixMsg ?? false; + return message; + }, + fromAmino(object: MsgInstantiateContract2Amino): MsgInstantiateContract2 { + const message = createBaseMsgInstantiateContract2(); + if (object.sender !== undefined && object.sender !== null) { + message.sender = object.sender; + } + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + if (object.code_id !== undefined && object.code_id !== null) { + message.codeId = BigInt(object.code_id); + } + if (object.label !== undefined && object.label !== null) { + message.label = object.label; + } + if (object.msg !== undefined && object.msg !== null) { + message.msg = toUtf8(JSON.stringify(object.msg)); + } + message.funds = object.funds?.map(e => Coin.fromAmino(e)) || []; + if (object.salt !== undefined && object.salt !== null) { + message.salt = bytesFromBase64(object.salt); + } + if (object.fix_msg !== undefined && object.fix_msg !== null) { + message.fixMsg = object.fix_msg; + } + return message; + }, + toAmino(message: MsgInstantiateContract2): MsgInstantiateContract2Amino { + const obj: any = {}; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId?.toString() : undefined; + obj.label = message.label === "" ? undefined : message.label; + obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; + if (message.funds) { + obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.funds = message.funds; + } + obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; + obj.fix_msg = message.fixMsg === false ? undefined : message.fixMsg; + return obj; + }, + fromAminoMsg(object: MsgInstantiateContract2AminoMsg): MsgInstantiateContract2 { + return MsgInstantiateContract2.fromAmino(object.value); + }, + toAminoMsg(message: MsgInstantiateContract2): MsgInstantiateContract2AminoMsg { + return { + type: "wasm/MsgInstantiateContract2", + value: MsgInstantiateContract2.toAmino(message) + }; + }, + fromProtoMsg(message: MsgInstantiateContract2ProtoMsg): MsgInstantiateContract2 { + return MsgInstantiateContract2.decode(message.value); + }, + toProto(message: MsgInstantiateContract2): Uint8Array { + return MsgInstantiateContract2.encode(message).finish(); + }, + toProtoMsg(message: MsgInstantiateContract2): MsgInstantiateContract2ProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract2", + value: MsgInstantiateContract2.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgInstantiateContract2.typeUrl, MsgInstantiateContract2); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgInstantiateContract2.aminoType, MsgInstantiateContract2.typeUrl); +function createBaseMsgInstantiateContract2Response(): MsgInstantiateContract2Response { + return { + address: "", + data: new Uint8Array() + }; +} +export const MsgInstantiateContract2Response = { + typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract2Response", + aminoType: "wasm/MsgInstantiateContract2Response", + is(o: any): o is MsgInstantiateContract2Response { + return o && (o.$typeUrl === MsgInstantiateContract2Response.typeUrl || typeof o.address === "string" && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + isAmino(o: any): o is MsgInstantiateContract2ResponseAmino { + return o && (o.$typeUrl === MsgInstantiateContract2Response.typeUrl || typeof o.address === "string" && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + encode(message: MsgInstantiateContract2Response, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgInstantiateContract2Response { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgInstantiateContract2Response(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgInstantiateContract2Response { + const message = createBaseMsgInstantiateContract2Response(); + message.address = object.address ?? ""; + message.data = object.data ?? new Uint8Array(); + return message; + }, + fromAmino(object: MsgInstantiateContract2ResponseAmino): MsgInstantiateContract2Response { + const message = createBaseMsgInstantiateContract2Response(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + return message; + }, + toAmino(message: MsgInstantiateContract2Response): MsgInstantiateContract2ResponseAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + return obj; + }, + fromAminoMsg(object: MsgInstantiateContract2ResponseAminoMsg): MsgInstantiateContract2Response { + return MsgInstantiateContract2Response.fromAmino(object.value); + }, + toAminoMsg(message: MsgInstantiateContract2Response): MsgInstantiateContract2ResponseAminoMsg { + return { + type: "wasm/MsgInstantiateContract2Response", + value: MsgInstantiateContract2Response.toAmino(message) + }; + }, + fromProtoMsg(message: MsgInstantiateContract2ResponseProtoMsg): MsgInstantiateContract2Response { + return MsgInstantiateContract2Response.decode(message.value); + }, + toProto(message: MsgInstantiateContract2Response): Uint8Array { + return MsgInstantiateContract2Response.encode(message).finish(); + }, + toProtoMsg(message: MsgInstantiateContract2Response): MsgInstantiateContract2ResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract2Response", + value: MsgInstantiateContract2Response.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgInstantiateContract2Response.typeUrl, MsgInstantiateContract2Response); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgInstantiateContract2Response.aminoType, MsgInstantiateContract2Response.typeUrl); +function createBaseMsgExecuteContract(): MsgExecuteContract { + return { + sender: "", + contract: "", + msg: new Uint8Array(), + funds: [] + }; +} +export const MsgExecuteContract = { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + aminoType: "wasm/MsgExecuteContract", + is(o: any): o is MsgExecuteContract { + return o && (o.$typeUrl === MsgExecuteContract.typeUrl || typeof o.sender === "string" && typeof o.contract === "string" && (o.msg instanceof Uint8Array || typeof o.msg === "string") && Array.isArray(o.funds) && (!o.funds.length || Coin.is(o.funds[0]))); + }, + isAmino(o: any): o is MsgExecuteContractAmino { + return o && (o.$typeUrl === MsgExecuteContract.typeUrl || typeof o.sender === "string" && typeof o.contract === "string" && (o.msg instanceof Uint8Array || typeof o.msg === "string") && Array.isArray(o.funds) && (!o.funds.length || Coin.isAmino(o.funds[0]))); + }, + encode(message: MsgExecuteContract, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.contract !== "") { + writer.uint32(18).string(message.contract); + } + if (message.msg.length !== 0) { + writer.uint32(26).bytes(message.msg); + } + for (const v of message.funds) { + Coin.encode(v!, writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgExecuteContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExecuteContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sender = reader.string(); + break; + case 2: + message.contract = reader.string(); + break; + case 3: + message.msg = reader.bytes(); + break; + case 5: + message.funds.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgExecuteContract { + const message = createBaseMsgExecuteContract(); + message.sender = object.sender ?? ""; + message.contract = object.contract ?? ""; + message.msg = object.msg ?? new Uint8Array(); + message.funds = object.funds?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MsgExecuteContractAmino): MsgExecuteContract { + const message = createBaseMsgExecuteContract(); + if (object.sender !== undefined && object.sender !== null) { + message.sender = object.sender; + } + if (object.contract !== undefined && object.contract !== null) { + message.contract = object.contract; + } + if (object.msg !== undefined && object.msg !== null) { + message.msg = toUtf8(JSON.stringify(object.msg)); + } + message.funds = object.funds?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgExecuteContract): MsgExecuteContractAmino { + const obj: any = {}; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.contract = message.contract === "" ? undefined : message.contract; + obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; + if (message.funds) { + obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.funds = message.funds; + } + return obj; + }, + fromAminoMsg(object: MsgExecuteContractAminoMsg): MsgExecuteContract { + return MsgExecuteContract.fromAmino(object.value); + }, + toAminoMsg(message: MsgExecuteContract): MsgExecuteContractAminoMsg { + return { + type: "wasm/MsgExecuteContract", + value: MsgExecuteContract.toAmino(message) + }; + }, + fromProtoMsg(message: MsgExecuteContractProtoMsg): MsgExecuteContract { + return MsgExecuteContract.decode(message.value); + }, + toProto(message: MsgExecuteContract): Uint8Array { + return MsgExecuteContract.encode(message).finish(); + }, + toProtoMsg(message: MsgExecuteContract): MsgExecuteContractProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", + value: MsgExecuteContract.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgExecuteContract.typeUrl, MsgExecuteContract); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgExecuteContract.aminoType, MsgExecuteContract.typeUrl); +function createBaseMsgExecuteContractResponse(): MsgExecuteContractResponse { + return { + data: new Uint8Array() + }; +} +export const MsgExecuteContractResponse = { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContractResponse", + aminoType: "wasm/MsgExecuteContractResponse", + is(o: any): o is MsgExecuteContractResponse { + return o && (o.$typeUrl === MsgExecuteContractResponse.typeUrl || o.data instanceof Uint8Array || typeof o.data === "string"); + }, + isAmino(o: any): o is MsgExecuteContractResponseAmino { + return o && (o.$typeUrl === MsgExecuteContractResponse.typeUrl || o.data instanceof Uint8Array || typeof o.data === "string"); + }, + encode(message: MsgExecuteContractResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgExecuteContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExecuteContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgExecuteContractResponse { + const message = createBaseMsgExecuteContractResponse(); + message.data = object.data ?? new Uint8Array(); + return message; + }, + fromAmino(object: MsgExecuteContractResponseAmino): MsgExecuteContractResponse { + const message = createBaseMsgExecuteContractResponse(); + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + return message; + }, + toAmino(message: MsgExecuteContractResponse): MsgExecuteContractResponseAmino { + const obj: any = {}; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + return obj; + }, + fromAminoMsg(object: MsgExecuteContractResponseAminoMsg): MsgExecuteContractResponse { + return MsgExecuteContractResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgExecuteContractResponse): MsgExecuteContractResponseAminoMsg { + return { + type: "wasm/MsgExecuteContractResponse", + value: MsgExecuteContractResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgExecuteContractResponseProtoMsg): MsgExecuteContractResponse { + return MsgExecuteContractResponse.decode(message.value); + }, + toProto(message: MsgExecuteContractResponse): Uint8Array { + return MsgExecuteContractResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgExecuteContractResponse): MsgExecuteContractResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContractResponse", + value: MsgExecuteContractResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgExecuteContractResponse.typeUrl, MsgExecuteContractResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgExecuteContractResponse.aminoType, MsgExecuteContractResponse.typeUrl); +function createBaseMsgMigrateContract(): MsgMigrateContract { + return { + sender: "", + contract: "", + codeId: BigInt(0), + msg: new Uint8Array() + }; +} +export const MsgMigrateContract = { + typeUrl: "/cosmwasm.wasm.v1.MsgMigrateContract", + aminoType: "wasm/MsgMigrateContract", + is(o: any): o is MsgMigrateContract { + return o && (o.$typeUrl === MsgMigrateContract.typeUrl || typeof o.sender === "string" && typeof o.contract === "string" && typeof o.codeId === "bigint" && (o.msg instanceof Uint8Array || typeof o.msg === "string")); + }, + isAmino(o: any): o is MsgMigrateContractAmino { + return o && (o.$typeUrl === MsgMigrateContract.typeUrl || typeof o.sender === "string" && typeof o.contract === "string" && typeof o.code_id === "bigint" && (o.msg instanceof Uint8Array || typeof o.msg === "string")); + }, + encode(message: MsgMigrateContract, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.contract !== "") { + writer.uint32(18).string(message.contract); + } + if (message.codeId !== BigInt(0)) { + writer.uint32(24).uint64(message.codeId); + } + if (message.msg.length !== 0) { + writer.uint32(34).bytes(message.msg); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgMigrateContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgMigrateContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sender = reader.string(); + break; + case 2: + message.contract = reader.string(); + break; + case 3: + message.codeId = reader.uint64(); + break; + case 4: + message.msg = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgMigrateContract { + const message = createBaseMsgMigrateContract(); + message.sender = object.sender ?? ""; + message.contract = object.contract ?? ""; + message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); + message.msg = object.msg ?? new Uint8Array(); + return message; + }, + fromAmino(object: MsgMigrateContractAmino): MsgMigrateContract { + const message = createBaseMsgMigrateContract(); + if (object.sender !== undefined && object.sender !== null) { + message.sender = object.sender; + } + if (object.contract !== undefined && object.contract !== null) { + message.contract = object.contract; + } + if (object.code_id !== undefined && object.code_id !== null) { + message.codeId = BigInt(object.code_id); + } + if (object.msg !== undefined && object.msg !== null) { + message.msg = toUtf8(JSON.stringify(object.msg)); + } + return message; + }, + toAmino(message: MsgMigrateContract): MsgMigrateContractAmino { + const obj: any = {}; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.contract = message.contract === "" ? undefined : message.contract; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId?.toString() : undefined; + obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; + return obj; + }, + fromAminoMsg(object: MsgMigrateContractAminoMsg): MsgMigrateContract { + return MsgMigrateContract.fromAmino(object.value); + }, + toAminoMsg(message: MsgMigrateContract): MsgMigrateContractAminoMsg { + return { + type: "wasm/MsgMigrateContract", + value: MsgMigrateContract.toAmino(message) + }; + }, + fromProtoMsg(message: MsgMigrateContractProtoMsg): MsgMigrateContract { + return MsgMigrateContract.decode(message.value); + }, + toProto(message: MsgMigrateContract): Uint8Array { + return MsgMigrateContract.encode(message).finish(); + }, + toProtoMsg(message: MsgMigrateContract): MsgMigrateContractProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgMigrateContract", + value: MsgMigrateContract.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgMigrateContract.typeUrl, MsgMigrateContract); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgMigrateContract.aminoType, MsgMigrateContract.typeUrl); +function createBaseMsgMigrateContractResponse(): MsgMigrateContractResponse { + return { + data: new Uint8Array() + }; +} +export const MsgMigrateContractResponse = { + typeUrl: "/cosmwasm.wasm.v1.MsgMigrateContractResponse", + aminoType: "wasm/MsgMigrateContractResponse", + is(o: any): o is MsgMigrateContractResponse { + return o && (o.$typeUrl === MsgMigrateContractResponse.typeUrl || o.data instanceof Uint8Array || typeof o.data === "string"); + }, + isAmino(o: any): o is MsgMigrateContractResponseAmino { + return o && (o.$typeUrl === MsgMigrateContractResponse.typeUrl || o.data instanceof Uint8Array || typeof o.data === "string"); + }, + encode(message: MsgMigrateContractResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgMigrateContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgMigrateContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgMigrateContractResponse { + const message = createBaseMsgMigrateContractResponse(); + message.data = object.data ?? new Uint8Array(); + return message; + }, + fromAmino(object: MsgMigrateContractResponseAmino): MsgMigrateContractResponse { + const message = createBaseMsgMigrateContractResponse(); + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + return message; + }, + toAmino(message: MsgMigrateContractResponse): MsgMigrateContractResponseAmino { + const obj: any = {}; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + return obj; + }, + fromAminoMsg(object: MsgMigrateContractResponseAminoMsg): MsgMigrateContractResponse { + return MsgMigrateContractResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgMigrateContractResponse): MsgMigrateContractResponseAminoMsg { + return { + type: "wasm/MsgMigrateContractResponse", + value: MsgMigrateContractResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgMigrateContractResponseProtoMsg): MsgMigrateContractResponse { + return MsgMigrateContractResponse.decode(message.value); + }, + toProto(message: MsgMigrateContractResponse): Uint8Array { + return MsgMigrateContractResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgMigrateContractResponse): MsgMigrateContractResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgMigrateContractResponse", + value: MsgMigrateContractResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgMigrateContractResponse.typeUrl, MsgMigrateContractResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgMigrateContractResponse.aminoType, MsgMigrateContractResponse.typeUrl); +function createBaseMsgUpdateAdmin(): MsgUpdateAdmin { + return { + sender: "", + newAdmin: "", + contract: "" + }; +} +export const MsgUpdateAdmin = { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateAdmin", + aminoType: "wasm/MsgUpdateAdmin", + is(o: any): o is MsgUpdateAdmin { + return o && (o.$typeUrl === MsgUpdateAdmin.typeUrl || typeof o.sender === "string" && typeof o.newAdmin === "string" && typeof o.contract === "string"); + }, + isAmino(o: any): o is MsgUpdateAdminAmino { + return o && (o.$typeUrl === MsgUpdateAdmin.typeUrl || typeof o.sender === "string" && typeof o.new_admin === "string" && typeof o.contract === "string"); + }, + encode(message: MsgUpdateAdmin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.newAdmin !== "") { + writer.uint32(18).string(message.newAdmin); + } + if (message.contract !== "") { + writer.uint32(26).string(message.contract); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAdmin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAdmin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sender = reader.string(); + break; + case 2: + message.newAdmin = reader.string(); + break; + case 3: + message.contract = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUpdateAdmin { + const message = createBaseMsgUpdateAdmin(); + message.sender = object.sender ?? ""; + message.newAdmin = object.newAdmin ?? ""; + message.contract = object.contract ?? ""; + return message; + }, + fromAmino(object: MsgUpdateAdminAmino): MsgUpdateAdmin { + const message = createBaseMsgUpdateAdmin(); + if (object.sender !== undefined && object.sender !== null) { + message.sender = object.sender; + } + if (object.new_admin !== undefined && object.new_admin !== null) { + message.newAdmin = object.new_admin; + } + if (object.contract !== undefined && object.contract !== null) { + message.contract = object.contract; + } + return message; + }, + toAmino(message: MsgUpdateAdmin): MsgUpdateAdminAmino { + const obj: any = {}; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.new_admin = message.newAdmin === "" ? undefined : message.newAdmin; + obj.contract = message.contract === "" ? undefined : message.contract; + return obj; + }, + fromAminoMsg(object: MsgUpdateAdminAminoMsg): MsgUpdateAdmin { + return MsgUpdateAdmin.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateAdmin): MsgUpdateAdminAminoMsg { + return { + type: "wasm/MsgUpdateAdmin", + value: MsgUpdateAdmin.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateAdminProtoMsg): MsgUpdateAdmin { + return MsgUpdateAdmin.decode(message.value); + }, + toProto(message: MsgUpdateAdmin): Uint8Array { + return MsgUpdateAdmin.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateAdmin): MsgUpdateAdminProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateAdmin", + value: MsgUpdateAdmin.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgUpdateAdmin.typeUrl, MsgUpdateAdmin); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgUpdateAdmin.aminoType, MsgUpdateAdmin.typeUrl); +function createBaseMsgUpdateAdminResponse(): MsgUpdateAdminResponse { + return {}; +} +export const MsgUpdateAdminResponse = { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateAdminResponse", + aminoType: "wasm/MsgUpdateAdminResponse", + is(o: any): o is MsgUpdateAdminResponse { + return o && o.$typeUrl === MsgUpdateAdminResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateAdminResponseAmino { + return o && o.$typeUrl === MsgUpdateAdminResponse.typeUrl; + }, + encode(_: MsgUpdateAdminResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateAdminResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateAdminResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgUpdateAdminResponse { + const message = createBaseMsgUpdateAdminResponse(); + return message; + }, + fromAmino(_: MsgUpdateAdminResponseAmino): MsgUpdateAdminResponse { + const message = createBaseMsgUpdateAdminResponse(); + return message; + }, + toAmino(_: MsgUpdateAdminResponse): MsgUpdateAdminResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateAdminResponseAminoMsg): MsgUpdateAdminResponse { + return MsgUpdateAdminResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateAdminResponse): MsgUpdateAdminResponseAminoMsg { + return { + type: "wasm/MsgUpdateAdminResponse", + value: MsgUpdateAdminResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateAdminResponseProtoMsg): MsgUpdateAdminResponse { + return MsgUpdateAdminResponse.decode(message.value); + }, + toProto(message: MsgUpdateAdminResponse): Uint8Array { + return MsgUpdateAdminResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateAdminResponse): MsgUpdateAdminResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateAdminResponse", + value: MsgUpdateAdminResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgUpdateAdminResponse.typeUrl, MsgUpdateAdminResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgUpdateAdminResponse.aminoType, MsgUpdateAdminResponse.typeUrl); +function createBaseMsgClearAdmin(): MsgClearAdmin { + return { + sender: "", + contract: "" + }; +} +export const MsgClearAdmin = { + typeUrl: "/cosmwasm.wasm.v1.MsgClearAdmin", + aminoType: "wasm/MsgClearAdmin", + is(o: any): o is MsgClearAdmin { + return o && (o.$typeUrl === MsgClearAdmin.typeUrl || typeof o.sender === "string" && typeof o.contract === "string"); + }, + isAmino(o: any): o is MsgClearAdminAmino { + return o && (o.$typeUrl === MsgClearAdmin.typeUrl || typeof o.sender === "string" && typeof o.contract === "string"); + }, + encode(message: MsgClearAdmin, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.contract !== "") { + writer.uint32(26).string(message.contract); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgClearAdmin { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgClearAdmin(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sender = reader.string(); + break; + case 3: + message.contract = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgClearAdmin { + const message = createBaseMsgClearAdmin(); + message.sender = object.sender ?? ""; + message.contract = object.contract ?? ""; + return message; + }, + fromAmino(object: MsgClearAdminAmino): MsgClearAdmin { + const message = createBaseMsgClearAdmin(); + if (object.sender !== undefined && object.sender !== null) { + message.sender = object.sender; + } + if (object.contract !== undefined && object.contract !== null) { + message.contract = object.contract; + } + return message; + }, + toAmino(message: MsgClearAdmin): MsgClearAdminAmino { + const obj: any = {}; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.contract = message.contract === "" ? undefined : message.contract; + return obj; + }, + fromAminoMsg(object: MsgClearAdminAminoMsg): MsgClearAdmin { + return MsgClearAdmin.fromAmino(object.value); + }, + toAminoMsg(message: MsgClearAdmin): MsgClearAdminAminoMsg { + return { + type: "wasm/MsgClearAdmin", + value: MsgClearAdmin.toAmino(message) + }; + }, + fromProtoMsg(message: MsgClearAdminProtoMsg): MsgClearAdmin { + return MsgClearAdmin.decode(message.value); + }, + toProto(message: MsgClearAdmin): Uint8Array { + return MsgClearAdmin.encode(message).finish(); + }, + toProtoMsg(message: MsgClearAdmin): MsgClearAdminProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgClearAdmin", + value: MsgClearAdmin.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgClearAdmin.typeUrl, MsgClearAdmin); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgClearAdmin.aminoType, MsgClearAdmin.typeUrl); +function createBaseMsgClearAdminResponse(): MsgClearAdminResponse { + return {}; +} +export const MsgClearAdminResponse = { + typeUrl: "/cosmwasm.wasm.v1.MsgClearAdminResponse", + aminoType: "wasm/MsgClearAdminResponse", + is(o: any): o is MsgClearAdminResponse { + return o && o.$typeUrl === MsgClearAdminResponse.typeUrl; + }, + isAmino(o: any): o is MsgClearAdminResponseAmino { + return o && o.$typeUrl === MsgClearAdminResponse.typeUrl; + }, + encode(_: MsgClearAdminResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgClearAdminResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgClearAdminResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgClearAdminResponse { + const message = createBaseMsgClearAdminResponse(); + return message; + }, + fromAmino(_: MsgClearAdminResponseAmino): MsgClearAdminResponse { + const message = createBaseMsgClearAdminResponse(); + return message; + }, + toAmino(_: MsgClearAdminResponse): MsgClearAdminResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgClearAdminResponseAminoMsg): MsgClearAdminResponse { + return MsgClearAdminResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgClearAdminResponse): MsgClearAdminResponseAminoMsg { + return { + type: "wasm/MsgClearAdminResponse", + value: MsgClearAdminResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgClearAdminResponseProtoMsg): MsgClearAdminResponse { + return MsgClearAdminResponse.decode(message.value); + }, + toProto(message: MsgClearAdminResponse): Uint8Array { + return MsgClearAdminResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgClearAdminResponse): MsgClearAdminResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgClearAdminResponse", + value: MsgClearAdminResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgClearAdminResponse.typeUrl, MsgClearAdminResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgClearAdminResponse.aminoType, MsgClearAdminResponse.typeUrl); +function createBaseMsgUpdateInstantiateConfig(): MsgUpdateInstantiateConfig { + return { + sender: "", + codeId: BigInt(0), + newInstantiatePermission: undefined + }; +} +export const MsgUpdateInstantiateConfig = { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateInstantiateConfig", + aminoType: "wasm/MsgUpdateInstantiateConfig", + is(o: any): o is MsgUpdateInstantiateConfig { + return o && (o.$typeUrl === MsgUpdateInstantiateConfig.typeUrl || typeof o.sender === "string" && typeof o.codeId === "bigint"); + }, + isAmino(o: any): o is MsgUpdateInstantiateConfigAmino { + return o && (o.$typeUrl === MsgUpdateInstantiateConfig.typeUrl || typeof o.sender === "string" && typeof o.code_id === "bigint"); + }, + encode(message: MsgUpdateInstantiateConfig, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.codeId !== BigInt(0)) { + writer.uint32(16).uint64(message.codeId); + } + if (message.newInstantiatePermission !== undefined) { + AccessConfig.encode(message.newInstantiatePermission, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateInstantiateConfig { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateInstantiateConfig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sender = reader.string(); + break; + case 2: + message.codeId = reader.uint64(); + break; + case 3: + message.newInstantiatePermission = AccessConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUpdateInstantiateConfig { + const message = createBaseMsgUpdateInstantiateConfig(); + message.sender = object.sender ?? ""; + message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); + message.newInstantiatePermission = object.newInstantiatePermission !== undefined && object.newInstantiatePermission !== null ? AccessConfig.fromPartial(object.newInstantiatePermission) : undefined; + return message; + }, + fromAmino(object: MsgUpdateInstantiateConfigAmino): MsgUpdateInstantiateConfig { + const message = createBaseMsgUpdateInstantiateConfig(); + if (object.sender !== undefined && object.sender !== null) { + message.sender = object.sender; + } + if (object.code_id !== undefined && object.code_id !== null) { + message.codeId = BigInt(object.code_id); + } + if (object.new_instantiate_permission !== undefined && object.new_instantiate_permission !== null) { + message.newInstantiatePermission = AccessConfig.fromAmino(object.new_instantiate_permission); + } + return message; + }, + toAmino(message: MsgUpdateInstantiateConfig): MsgUpdateInstantiateConfigAmino { + const obj: any = {}; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId?.toString() : undefined; + obj.new_instantiate_permission = message.newInstantiatePermission ? AccessConfig.toAmino(message.newInstantiatePermission) : undefined; + return obj; + }, + fromAminoMsg(object: MsgUpdateInstantiateConfigAminoMsg): MsgUpdateInstantiateConfig { + return MsgUpdateInstantiateConfig.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateInstantiateConfig): MsgUpdateInstantiateConfigAminoMsg { + return { + type: "wasm/MsgUpdateInstantiateConfig", + value: MsgUpdateInstantiateConfig.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateInstantiateConfigProtoMsg): MsgUpdateInstantiateConfig { + return MsgUpdateInstantiateConfig.decode(message.value); + }, + toProto(message: MsgUpdateInstantiateConfig): Uint8Array { + return MsgUpdateInstantiateConfig.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateInstantiateConfig): MsgUpdateInstantiateConfigProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateInstantiateConfig", + value: MsgUpdateInstantiateConfig.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgUpdateInstantiateConfig.typeUrl, MsgUpdateInstantiateConfig); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgUpdateInstantiateConfig.aminoType, MsgUpdateInstantiateConfig.typeUrl); +function createBaseMsgUpdateInstantiateConfigResponse(): MsgUpdateInstantiateConfigResponse { + return {}; +} +export const MsgUpdateInstantiateConfigResponse = { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateInstantiateConfigResponse", + aminoType: "wasm/MsgUpdateInstantiateConfigResponse", + is(o: any): o is MsgUpdateInstantiateConfigResponse { + return o && o.$typeUrl === MsgUpdateInstantiateConfigResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateInstantiateConfigResponseAmino { + return o && o.$typeUrl === MsgUpdateInstantiateConfigResponse.typeUrl; + }, + encode(_: MsgUpdateInstantiateConfigResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateInstantiateConfigResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateInstantiateConfigResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgUpdateInstantiateConfigResponse { + const message = createBaseMsgUpdateInstantiateConfigResponse(); + return message; + }, + fromAmino(_: MsgUpdateInstantiateConfigResponseAmino): MsgUpdateInstantiateConfigResponse { + const message = createBaseMsgUpdateInstantiateConfigResponse(); + return message; + }, + toAmino(_: MsgUpdateInstantiateConfigResponse): MsgUpdateInstantiateConfigResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateInstantiateConfigResponseAminoMsg): MsgUpdateInstantiateConfigResponse { + return MsgUpdateInstantiateConfigResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateInstantiateConfigResponse): MsgUpdateInstantiateConfigResponseAminoMsg { + return { + type: "wasm/MsgUpdateInstantiateConfigResponse", + value: MsgUpdateInstantiateConfigResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateInstantiateConfigResponseProtoMsg): MsgUpdateInstantiateConfigResponse { + return MsgUpdateInstantiateConfigResponse.decode(message.value); + }, + toProto(message: MsgUpdateInstantiateConfigResponse): Uint8Array { + return MsgUpdateInstantiateConfigResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateInstantiateConfigResponse): MsgUpdateInstantiateConfigResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateInstantiateConfigResponse", + value: MsgUpdateInstantiateConfigResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgUpdateInstantiateConfigResponse.typeUrl, MsgUpdateInstantiateConfigResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgUpdateInstantiateConfigResponse.aminoType, MsgUpdateInstantiateConfigResponse.typeUrl); +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { + authority: "", + params: Params.fromPartial({}) + }; +} +export const MsgUpdateParams = { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateParams", + aminoType: "wasm/MsgUpdateParams", + is(o: any): o is MsgUpdateParams { + return o && (o.$typeUrl === MsgUpdateParams.typeUrl || typeof o.authority === "string" && Params.is(o.params)); + }, + isAmino(o: any): o is MsgUpdateParamsAmino { + return o && (o.$typeUrl === MsgUpdateParams.typeUrl || typeof o.authority === "string" && Params.isAmino(o.params)); + }, + encode(message: MsgUpdateParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + message.authority = object.authority ?? ""; + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: MsgUpdateParamsAmino): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: MsgUpdateParams): MsgUpdateParamsAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsAminoMsg): MsgUpdateParams { + return MsgUpdateParams.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParams): MsgUpdateParamsAminoMsg { + return { + type: "wasm/MsgUpdateParams", + value: MsgUpdateParams.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsProtoMsg): MsgUpdateParams { + return MsgUpdateParams.decode(message.value); + }, + toProto(message: MsgUpdateParams): Uint8Array { + return MsgUpdateParams.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParams): MsgUpdateParamsProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateParams", + value: MsgUpdateParams.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgUpdateParams.typeUrl, MsgUpdateParams); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgUpdateParams.aminoType, MsgUpdateParams.typeUrl); +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} +export const MsgUpdateParamsResponse = { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateParamsResponse", + aminoType: "wasm/MsgUpdateParamsResponse", + is(o: any): o is MsgUpdateParamsResponse { + return o && o.$typeUrl === MsgUpdateParamsResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateParamsResponseAmino { + return o && o.$typeUrl === MsgUpdateParamsResponse.typeUrl; + }, + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + fromAmino(_: MsgUpdateParamsResponseAmino): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + toAmino(_: MsgUpdateParamsResponse): MsgUpdateParamsResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsResponseAminoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseAminoMsg { + return { + type: "wasm/MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsResponseProtoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.decode(message.value); + }, + toProto(message: MsgUpdateParamsResponse): Uint8Array { + return MsgUpdateParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgUpdateParamsResponse.typeUrl, MsgUpdateParamsResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgUpdateParamsResponse.aminoType, MsgUpdateParamsResponse.typeUrl); +function createBaseMsgSudoContract(): MsgSudoContract { + return { + authority: "", + contract: "", + msg: new Uint8Array() + }; +} +export const MsgSudoContract = { + typeUrl: "/cosmwasm.wasm.v1.MsgSudoContract", + aminoType: "wasm/MsgSudoContract", + is(o: any): o is MsgSudoContract { + return o && (o.$typeUrl === MsgSudoContract.typeUrl || typeof o.authority === "string" && typeof o.contract === "string" && (o.msg instanceof Uint8Array || typeof o.msg === "string")); + }, + isAmino(o: any): o is MsgSudoContractAmino { + return o && (o.$typeUrl === MsgSudoContract.typeUrl || typeof o.authority === "string" && typeof o.contract === "string" && (o.msg instanceof Uint8Array || typeof o.msg === "string")); + }, + encode(message: MsgSudoContract, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.contract !== "") { + writer.uint32(18).string(message.contract); + } + if (message.msg.length !== 0) { + writer.uint32(26).bytes(message.msg); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSudoContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSudoContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.contract = reader.string(); + break; + case 3: + message.msg = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgSudoContract { + const message = createBaseMsgSudoContract(); + message.authority = object.authority ?? ""; + message.contract = object.contract ?? ""; + message.msg = object.msg ?? new Uint8Array(); + return message; + }, + fromAmino(object: MsgSudoContractAmino): MsgSudoContract { + const message = createBaseMsgSudoContract(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.contract !== undefined && object.contract !== null) { + message.contract = object.contract; + } + if (object.msg !== undefined && object.msg !== null) { + message.msg = toUtf8(JSON.stringify(object.msg)); + } + return message; + }, + toAmino(message: MsgSudoContract): MsgSudoContractAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + obj.contract = message.contract === "" ? undefined : message.contract; + obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; + return obj; + }, + fromAminoMsg(object: MsgSudoContractAminoMsg): MsgSudoContract { + return MsgSudoContract.fromAmino(object.value); + }, + toAminoMsg(message: MsgSudoContract): MsgSudoContractAminoMsg { + return { + type: "wasm/MsgSudoContract", + value: MsgSudoContract.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSudoContractProtoMsg): MsgSudoContract { + return MsgSudoContract.decode(message.value); + }, + toProto(message: MsgSudoContract): Uint8Array { + return MsgSudoContract.encode(message).finish(); + }, + toProtoMsg(message: MsgSudoContract): MsgSudoContractProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgSudoContract", + value: MsgSudoContract.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgSudoContract.typeUrl, MsgSudoContract); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgSudoContract.aminoType, MsgSudoContract.typeUrl); +function createBaseMsgSudoContractResponse(): MsgSudoContractResponse { + return { + data: new Uint8Array() + }; +} +export const MsgSudoContractResponse = { + typeUrl: "/cosmwasm.wasm.v1.MsgSudoContractResponse", + aminoType: "wasm/MsgSudoContractResponse", + is(o: any): o is MsgSudoContractResponse { + return o && (o.$typeUrl === MsgSudoContractResponse.typeUrl || o.data instanceof Uint8Array || typeof o.data === "string"); + }, + isAmino(o: any): o is MsgSudoContractResponseAmino { + return o && (o.$typeUrl === MsgSudoContractResponse.typeUrl || o.data instanceof Uint8Array || typeof o.data === "string"); + }, + encode(message: MsgSudoContractResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSudoContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSudoContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgSudoContractResponse { + const message = createBaseMsgSudoContractResponse(); + message.data = object.data ?? new Uint8Array(); + return message; + }, + fromAmino(object: MsgSudoContractResponseAmino): MsgSudoContractResponse { + const message = createBaseMsgSudoContractResponse(); + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + return message; + }, + toAmino(message: MsgSudoContractResponse): MsgSudoContractResponseAmino { + const obj: any = {}; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + return obj; + }, + fromAminoMsg(object: MsgSudoContractResponseAminoMsg): MsgSudoContractResponse { + return MsgSudoContractResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgSudoContractResponse): MsgSudoContractResponseAminoMsg { + return { + type: "wasm/MsgSudoContractResponse", + value: MsgSudoContractResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSudoContractResponseProtoMsg): MsgSudoContractResponse { + return MsgSudoContractResponse.decode(message.value); + }, + toProto(message: MsgSudoContractResponse): Uint8Array { + return MsgSudoContractResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgSudoContractResponse): MsgSudoContractResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgSudoContractResponse", + value: MsgSudoContractResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgSudoContractResponse.typeUrl, MsgSudoContractResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgSudoContractResponse.aminoType, MsgSudoContractResponse.typeUrl); +function createBaseMsgPinCodes(): MsgPinCodes { + return { + authority: "", + codeIds: [] + }; +} +export const MsgPinCodes = { + typeUrl: "/cosmwasm.wasm.v1.MsgPinCodes", + aminoType: "wasm/MsgPinCodes", + is(o: any): o is MsgPinCodes { + return o && (o.$typeUrl === MsgPinCodes.typeUrl || typeof o.authority === "string" && Array.isArray(o.codeIds) && (!o.codeIds.length || typeof o.codeIds[0] === "bigint")); + }, + isAmino(o: any): o is MsgPinCodesAmino { + return o && (o.$typeUrl === MsgPinCodes.typeUrl || typeof o.authority === "string" && Array.isArray(o.code_ids) && (!o.code_ids.length || typeof o.code_ids[0] === "bigint")); + }, + encode(message: MsgPinCodes, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + writer.uint32(18).fork(); + for (const v of message.codeIds) { + writer.uint64(v); + } + writer.ldelim(); + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgPinCodes { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgPinCodes(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.codeIds.push(reader.uint64()); + } + } else { + message.codeIds.push(reader.uint64()); + } + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgPinCodes { + const message = createBaseMsgPinCodes(); + message.authority = object.authority ?? ""; + message.codeIds = object.codeIds?.map(e => BigInt(e.toString())) || []; + return message; + }, + fromAmino(object: MsgPinCodesAmino): MsgPinCodes { + const message = createBaseMsgPinCodes(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + message.codeIds = object.code_ids?.map(e => BigInt(e)) || []; + return message; + }, + toAmino(message: MsgPinCodes): MsgPinCodesAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + if (message.codeIds) { + obj.code_ids = message.codeIds.map(e => e.toString()); + } else { + obj.code_ids = message.codeIds; + } + return obj; + }, + fromAminoMsg(object: MsgPinCodesAminoMsg): MsgPinCodes { + return MsgPinCodes.fromAmino(object.value); + }, + toAminoMsg(message: MsgPinCodes): MsgPinCodesAminoMsg { + return { + type: "wasm/MsgPinCodes", + value: MsgPinCodes.toAmino(message) + }; + }, + fromProtoMsg(message: MsgPinCodesProtoMsg): MsgPinCodes { + return MsgPinCodes.decode(message.value); + }, + toProto(message: MsgPinCodes): Uint8Array { + return MsgPinCodes.encode(message).finish(); + }, + toProtoMsg(message: MsgPinCodes): MsgPinCodesProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgPinCodes", + value: MsgPinCodes.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgPinCodes.typeUrl, MsgPinCodes); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgPinCodes.aminoType, MsgPinCodes.typeUrl); +function createBaseMsgPinCodesResponse(): MsgPinCodesResponse { + return {}; +} +export const MsgPinCodesResponse = { + typeUrl: "/cosmwasm.wasm.v1.MsgPinCodesResponse", + aminoType: "wasm/MsgPinCodesResponse", + is(o: any): o is MsgPinCodesResponse { + return o && o.$typeUrl === MsgPinCodesResponse.typeUrl; + }, + isAmino(o: any): o is MsgPinCodesResponseAmino { + return o && o.$typeUrl === MsgPinCodesResponse.typeUrl; + }, + encode(_: MsgPinCodesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgPinCodesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgPinCodesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgPinCodesResponse { + const message = createBaseMsgPinCodesResponse(); + return message; + }, + fromAmino(_: MsgPinCodesResponseAmino): MsgPinCodesResponse { + const message = createBaseMsgPinCodesResponse(); + return message; + }, + toAmino(_: MsgPinCodesResponse): MsgPinCodesResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgPinCodesResponseAminoMsg): MsgPinCodesResponse { + return MsgPinCodesResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgPinCodesResponse): MsgPinCodesResponseAminoMsg { + return { + type: "wasm/MsgPinCodesResponse", + value: MsgPinCodesResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgPinCodesResponseProtoMsg): MsgPinCodesResponse { + return MsgPinCodesResponse.decode(message.value); + }, + toProto(message: MsgPinCodesResponse): Uint8Array { + return MsgPinCodesResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgPinCodesResponse): MsgPinCodesResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgPinCodesResponse", + value: MsgPinCodesResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgPinCodesResponse.typeUrl, MsgPinCodesResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgPinCodesResponse.aminoType, MsgPinCodesResponse.typeUrl); +function createBaseMsgUnpinCodes(): MsgUnpinCodes { + return { + authority: "", + codeIds: [] + }; +} +export const MsgUnpinCodes = { + typeUrl: "/cosmwasm.wasm.v1.MsgUnpinCodes", + aminoType: "wasm/MsgUnpinCodes", + is(o: any): o is MsgUnpinCodes { + return o && (o.$typeUrl === MsgUnpinCodes.typeUrl || typeof o.authority === "string" && Array.isArray(o.codeIds) && (!o.codeIds.length || typeof o.codeIds[0] === "bigint")); + }, + isAmino(o: any): o is MsgUnpinCodesAmino { + return o && (o.$typeUrl === MsgUnpinCodes.typeUrl || typeof o.authority === "string" && Array.isArray(o.code_ids) && (!o.code_ids.length || typeof o.code_ids[0] === "bigint")); + }, + encode(message: MsgUnpinCodes, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + writer.uint32(18).fork(); + for (const v of message.codeIds) { + writer.uint64(v); + } + writer.ldelim(); + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnpinCodes { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnpinCodes(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.codeIds.push(reader.uint64()); + } + } else { + message.codeIds.push(reader.uint64()); + } + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUnpinCodes { + const message = createBaseMsgUnpinCodes(); + message.authority = object.authority ?? ""; + message.codeIds = object.codeIds?.map(e => BigInt(e.toString())) || []; + return message; + }, + fromAmino(object: MsgUnpinCodesAmino): MsgUnpinCodes { + const message = createBaseMsgUnpinCodes(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + message.codeIds = object.code_ids?.map(e => BigInt(e)) || []; + return message; + }, + toAmino(message: MsgUnpinCodes): MsgUnpinCodesAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + if (message.codeIds) { + obj.code_ids = message.codeIds.map(e => e.toString()); + } else { + obj.code_ids = message.codeIds; + } + return obj; + }, + fromAminoMsg(object: MsgUnpinCodesAminoMsg): MsgUnpinCodes { + return MsgUnpinCodes.fromAmino(object.value); + }, + toAminoMsg(message: MsgUnpinCodes): MsgUnpinCodesAminoMsg { + return { + type: "wasm/MsgUnpinCodes", + value: MsgUnpinCodes.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUnpinCodesProtoMsg): MsgUnpinCodes { + return MsgUnpinCodes.decode(message.value); + }, + toProto(message: MsgUnpinCodes): Uint8Array { + return MsgUnpinCodes.encode(message).finish(); + }, + toProtoMsg(message: MsgUnpinCodes): MsgUnpinCodesProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgUnpinCodes", + value: MsgUnpinCodes.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgUnpinCodes.typeUrl, MsgUnpinCodes); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgUnpinCodes.aminoType, MsgUnpinCodes.typeUrl); +function createBaseMsgUnpinCodesResponse(): MsgUnpinCodesResponse { + return {}; +} +export const MsgUnpinCodesResponse = { + typeUrl: "/cosmwasm.wasm.v1.MsgUnpinCodesResponse", + aminoType: "wasm/MsgUnpinCodesResponse", + is(o: any): o is MsgUnpinCodesResponse { + return o && o.$typeUrl === MsgUnpinCodesResponse.typeUrl; + }, + isAmino(o: any): o is MsgUnpinCodesResponseAmino { + return o && o.$typeUrl === MsgUnpinCodesResponse.typeUrl; + }, + encode(_: MsgUnpinCodesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUnpinCodesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUnpinCodesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgUnpinCodesResponse { + const message = createBaseMsgUnpinCodesResponse(); + return message; + }, + fromAmino(_: MsgUnpinCodesResponseAmino): MsgUnpinCodesResponse { + const message = createBaseMsgUnpinCodesResponse(); + return message; + }, + toAmino(_: MsgUnpinCodesResponse): MsgUnpinCodesResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUnpinCodesResponseAminoMsg): MsgUnpinCodesResponse { + return MsgUnpinCodesResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUnpinCodesResponse): MsgUnpinCodesResponseAminoMsg { + return { + type: "wasm/MsgUnpinCodesResponse", + value: MsgUnpinCodesResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUnpinCodesResponseProtoMsg): MsgUnpinCodesResponse { + return MsgUnpinCodesResponse.decode(message.value); + }, + toProto(message: MsgUnpinCodesResponse): Uint8Array { + return MsgUnpinCodesResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUnpinCodesResponse): MsgUnpinCodesResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgUnpinCodesResponse", + value: MsgUnpinCodesResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgUnpinCodesResponse.typeUrl, MsgUnpinCodesResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgUnpinCodesResponse.aminoType, MsgUnpinCodesResponse.typeUrl); +function createBaseMsgStoreAndInstantiateContract(): MsgStoreAndInstantiateContract { + return { + authority: "", + wasmByteCode: new Uint8Array(), + instantiatePermission: undefined, + unpinCode: false, + admin: "", + label: "", + msg: new Uint8Array(), + funds: [], + source: "", + builder: "", + codeHash: new Uint8Array() + }; +} +export const MsgStoreAndInstantiateContract = { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreAndInstantiateContract", + aminoType: "wasm/MsgStoreAndInstantiateContract", + is(o: any): o is MsgStoreAndInstantiateContract { + return o && (o.$typeUrl === MsgStoreAndInstantiateContract.typeUrl || typeof o.authority === "string" && (o.wasmByteCode instanceof Uint8Array || typeof o.wasmByteCode === "string") && typeof o.unpinCode === "boolean" && typeof o.admin === "string" && typeof o.label === "string" && (o.msg instanceof Uint8Array || typeof o.msg === "string") && Array.isArray(o.funds) && (!o.funds.length || Coin.is(o.funds[0])) && typeof o.source === "string" && typeof o.builder === "string" && (o.codeHash instanceof Uint8Array || typeof o.codeHash === "string")); + }, + isAmino(o: any): o is MsgStoreAndInstantiateContractAmino { + return o && (o.$typeUrl === MsgStoreAndInstantiateContract.typeUrl || typeof o.authority === "string" && (o.wasm_byte_code instanceof Uint8Array || typeof o.wasm_byte_code === "string") && typeof o.unpin_code === "boolean" && typeof o.admin === "string" && typeof o.label === "string" && (o.msg instanceof Uint8Array || typeof o.msg === "string") && Array.isArray(o.funds) && (!o.funds.length || Coin.isAmino(o.funds[0])) && typeof o.source === "string" && typeof o.builder === "string" && (o.code_hash instanceof Uint8Array || typeof o.code_hash === "string")); + }, + encode(message: MsgStoreAndInstantiateContract, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.wasmByteCode.length !== 0) { + writer.uint32(26).bytes(message.wasmByteCode); + } + if (message.instantiatePermission !== undefined) { + AccessConfig.encode(message.instantiatePermission, writer.uint32(34).fork()).ldelim(); + } + if (message.unpinCode === true) { + writer.uint32(40).bool(message.unpinCode); + } + if (message.admin !== "") { + writer.uint32(50).string(message.admin); + } + if (message.label !== "") { + writer.uint32(58).string(message.label); + } + if (message.msg.length !== 0) { + writer.uint32(66).bytes(message.msg); + } + for (const v of message.funds) { + Coin.encode(v!, writer.uint32(74).fork()).ldelim(); + } + if (message.source !== "") { + writer.uint32(82).string(message.source); + } + if (message.builder !== "") { + writer.uint32(90).string(message.builder); + } + if (message.codeHash.length !== 0) { + writer.uint32(98).bytes(message.codeHash); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgStoreAndInstantiateContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgStoreAndInstantiateContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 3: + message.wasmByteCode = reader.bytes(); + break; + case 4: + message.instantiatePermission = AccessConfig.decode(reader, reader.uint32()); + break; + case 5: + message.unpinCode = reader.bool(); + break; + case 6: + message.admin = reader.string(); + break; + case 7: + message.label = reader.string(); + break; + case 8: + message.msg = reader.bytes(); + break; + case 9: + message.funds.push(Coin.decode(reader, reader.uint32())); + break; + case 10: + message.source = reader.string(); + break; + case 11: + message.builder = reader.string(); + break; + case 12: + message.codeHash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgStoreAndInstantiateContract { + const message = createBaseMsgStoreAndInstantiateContract(); + message.authority = object.authority ?? ""; + message.wasmByteCode = object.wasmByteCode ?? new Uint8Array(); + message.instantiatePermission = object.instantiatePermission !== undefined && object.instantiatePermission !== null ? AccessConfig.fromPartial(object.instantiatePermission) : undefined; + message.unpinCode = object.unpinCode ?? false; + message.admin = object.admin ?? ""; + message.label = object.label ?? ""; + message.msg = object.msg ?? new Uint8Array(); + message.funds = object.funds?.map(e => Coin.fromPartial(e)) || []; + message.source = object.source ?? ""; + message.builder = object.builder ?? ""; + message.codeHash = object.codeHash ?? new Uint8Array(); + return message; + }, + fromAmino(object: MsgStoreAndInstantiateContractAmino): MsgStoreAndInstantiateContract { + const message = createBaseMsgStoreAndInstantiateContract(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.wasm_byte_code !== undefined && object.wasm_byte_code !== null) { + message.wasmByteCode = fromBase64(object.wasm_byte_code); + } + if (object.instantiate_permission !== undefined && object.instantiate_permission !== null) { + message.instantiatePermission = AccessConfig.fromAmino(object.instantiate_permission); + } + if (object.unpin_code !== undefined && object.unpin_code !== null) { + message.unpinCode = object.unpin_code; + } + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + if (object.label !== undefined && object.label !== null) { + message.label = object.label; + } + if (object.msg !== undefined && object.msg !== null) { + message.msg = toUtf8(JSON.stringify(object.msg)); + } + message.funds = object.funds?.map(e => Coin.fromAmino(e)) || []; + if (object.source !== undefined && object.source !== null) { + message.source = object.source; + } + if (object.builder !== undefined && object.builder !== null) { + message.builder = object.builder; + } + if (object.code_hash !== undefined && object.code_hash !== null) { + message.codeHash = bytesFromBase64(object.code_hash); + } + return message; + }, + toAmino(message: MsgStoreAndInstantiateContract): MsgStoreAndInstantiateContractAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + obj.wasm_byte_code = message.wasmByteCode ? toBase64(message.wasmByteCode) : undefined; + obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission) : undefined; + obj.unpin_code = message.unpinCode === false ? undefined : message.unpinCode; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.label = message.label === "" ? undefined : message.label; + obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; + if (message.funds) { + obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.funds = message.funds; + } + obj.source = message.source === "" ? undefined : message.source; + obj.builder = message.builder === "" ? undefined : message.builder; + obj.code_hash = message.codeHash ? base64FromBytes(message.codeHash) : undefined; + return obj; + }, + fromAminoMsg(object: MsgStoreAndInstantiateContractAminoMsg): MsgStoreAndInstantiateContract { + return MsgStoreAndInstantiateContract.fromAmino(object.value); + }, + toAminoMsg(message: MsgStoreAndInstantiateContract): MsgStoreAndInstantiateContractAminoMsg { + return { + type: "wasm/MsgStoreAndInstantiateContract", + value: MsgStoreAndInstantiateContract.toAmino(message) + }; + }, + fromProtoMsg(message: MsgStoreAndInstantiateContractProtoMsg): MsgStoreAndInstantiateContract { + return MsgStoreAndInstantiateContract.decode(message.value); + }, + toProto(message: MsgStoreAndInstantiateContract): Uint8Array { + return MsgStoreAndInstantiateContract.encode(message).finish(); + }, + toProtoMsg(message: MsgStoreAndInstantiateContract): MsgStoreAndInstantiateContractProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreAndInstantiateContract", + value: MsgStoreAndInstantiateContract.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgStoreAndInstantiateContract.typeUrl, MsgStoreAndInstantiateContract); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgStoreAndInstantiateContract.aminoType, MsgStoreAndInstantiateContract.typeUrl); +function createBaseMsgStoreAndInstantiateContractResponse(): MsgStoreAndInstantiateContractResponse { + return { + address: "", + data: new Uint8Array() + }; +} +export const MsgStoreAndInstantiateContractResponse = { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreAndInstantiateContractResponse", + aminoType: "wasm/MsgStoreAndInstantiateContractResponse", + is(o: any): o is MsgStoreAndInstantiateContractResponse { + return o && (o.$typeUrl === MsgStoreAndInstantiateContractResponse.typeUrl || typeof o.address === "string" && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + isAmino(o: any): o is MsgStoreAndInstantiateContractResponseAmino { + return o && (o.$typeUrl === MsgStoreAndInstantiateContractResponse.typeUrl || typeof o.address === "string" && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + encode(message: MsgStoreAndInstantiateContractResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address !== "") { + writer.uint32(10).string(message.address); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgStoreAndInstantiateContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgStoreAndInstantiateContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.string(); + break; + case 2: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgStoreAndInstantiateContractResponse { + const message = createBaseMsgStoreAndInstantiateContractResponse(); + message.address = object.address ?? ""; + message.data = object.data ?? new Uint8Array(); + return message; + }, + fromAmino(object: MsgStoreAndInstantiateContractResponseAmino): MsgStoreAndInstantiateContractResponse { + const message = createBaseMsgStoreAndInstantiateContractResponse(); + if (object.address !== undefined && object.address !== null) { + message.address = object.address; + } + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + return message; + }, + toAmino(message: MsgStoreAndInstantiateContractResponse): MsgStoreAndInstantiateContractResponseAmino { + const obj: any = {}; + obj.address = message.address === "" ? undefined : message.address; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + return obj; + }, + fromAminoMsg(object: MsgStoreAndInstantiateContractResponseAminoMsg): MsgStoreAndInstantiateContractResponse { + return MsgStoreAndInstantiateContractResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgStoreAndInstantiateContractResponse): MsgStoreAndInstantiateContractResponseAminoMsg { + return { + type: "wasm/MsgStoreAndInstantiateContractResponse", + value: MsgStoreAndInstantiateContractResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgStoreAndInstantiateContractResponseProtoMsg): MsgStoreAndInstantiateContractResponse { + return MsgStoreAndInstantiateContractResponse.decode(message.value); + }, + toProto(message: MsgStoreAndInstantiateContractResponse): Uint8Array { + return MsgStoreAndInstantiateContractResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgStoreAndInstantiateContractResponse): MsgStoreAndInstantiateContractResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreAndInstantiateContractResponse", + value: MsgStoreAndInstantiateContractResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgStoreAndInstantiateContractResponse.typeUrl, MsgStoreAndInstantiateContractResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgStoreAndInstantiateContractResponse.aminoType, MsgStoreAndInstantiateContractResponse.typeUrl); +function createBaseMsgAddCodeUploadParamsAddresses(): MsgAddCodeUploadParamsAddresses { + return { + authority: "", + addresses: [] + }; +} +export const MsgAddCodeUploadParamsAddresses = { + typeUrl: "/cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddresses", + aminoType: "wasm/MsgAddCodeUploadParamsAddresses", + is(o: any): o is MsgAddCodeUploadParamsAddresses { + return o && (o.$typeUrl === MsgAddCodeUploadParamsAddresses.typeUrl || typeof o.authority === "string" && Array.isArray(o.addresses) && (!o.addresses.length || typeof o.addresses[0] === "string")); + }, + isAmino(o: any): o is MsgAddCodeUploadParamsAddressesAmino { + return o && (o.$typeUrl === MsgAddCodeUploadParamsAddresses.typeUrl || typeof o.authority === "string" && Array.isArray(o.addresses) && (!o.addresses.length || typeof o.addresses[0] === "string")); + }, + encode(message: MsgAddCodeUploadParamsAddresses, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + for (const v of message.addresses) { + writer.uint32(18).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgAddCodeUploadParamsAddresses { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAddCodeUploadParamsAddresses(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.addresses.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgAddCodeUploadParamsAddresses { + const message = createBaseMsgAddCodeUploadParamsAddresses(); + message.authority = object.authority ?? ""; + message.addresses = object.addresses?.map(e => e) || []; + return message; + }, + fromAmino(object: MsgAddCodeUploadParamsAddressesAmino): MsgAddCodeUploadParamsAddresses { + const message = createBaseMsgAddCodeUploadParamsAddresses(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + message.addresses = object.addresses?.map(e => e) || []; + return message; + }, + toAmino(message: MsgAddCodeUploadParamsAddresses): MsgAddCodeUploadParamsAddressesAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + if (message.addresses) { + obj.addresses = message.addresses.map(e => e); + } else { + obj.addresses = message.addresses; + } + return obj; + }, + fromAminoMsg(object: MsgAddCodeUploadParamsAddressesAminoMsg): MsgAddCodeUploadParamsAddresses { + return MsgAddCodeUploadParamsAddresses.fromAmino(object.value); + }, + toAminoMsg(message: MsgAddCodeUploadParamsAddresses): MsgAddCodeUploadParamsAddressesAminoMsg { + return { + type: "wasm/MsgAddCodeUploadParamsAddresses", + value: MsgAddCodeUploadParamsAddresses.toAmino(message) + }; + }, + fromProtoMsg(message: MsgAddCodeUploadParamsAddressesProtoMsg): MsgAddCodeUploadParamsAddresses { + return MsgAddCodeUploadParamsAddresses.decode(message.value); + }, + toProto(message: MsgAddCodeUploadParamsAddresses): Uint8Array { + return MsgAddCodeUploadParamsAddresses.encode(message).finish(); + }, + toProtoMsg(message: MsgAddCodeUploadParamsAddresses): MsgAddCodeUploadParamsAddressesProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddresses", + value: MsgAddCodeUploadParamsAddresses.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgAddCodeUploadParamsAddresses.typeUrl, MsgAddCodeUploadParamsAddresses); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgAddCodeUploadParamsAddresses.aminoType, MsgAddCodeUploadParamsAddresses.typeUrl); +function createBaseMsgAddCodeUploadParamsAddressesResponse(): MsgAddCodeUploadParamsAddressesResponse { + return {}; +} +export const MsgAddCodeUploadParamsAddressesResponse = { + typeUrl: "/cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddressesResponse", + aminoType: "wasm/MsgAddCodeUploadParamsAddressesResponse", + is(o: any): o is MsgAddCodeUploadParamsAddressesResponse { + return o && o.$typeUrl === MsgAddCodeUploadParamsAddressesResponse.typeUrl; + }, + isAmino(o: any): o is MsgAddCodeUploadParamsAddressesResponseAmino { + return o && o.$typeUrl === MsgAddCodeUploadParamsAddressesResponse.typeUrl; + }, + encode(_: MsgAddCodeUploadParamsAddressesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgAddCodeUploadParamsAddressesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAddCodeUploadParamsAddressesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgAddCodeUploadParamsAddressesResponse { + const message = createBaseMsgAddCodeUploadParamsAddressesResponse(); + return message; + }, + fromAmino(_: MsgAddCodeUploadParamsAddressesResponseAmino): MsgAddCodeUploadParamsAddressesResponse { + const message = createBaseMsgAddCodeUploadParamsAddressesResponse(); + return message; + }, + toAmino(_: MsgAddCodeUploadParamsAddressesResponse): MsgAddCodeUploadParamsAddressesResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgAddCodeUploadParamsAddressesResponseAminoMsg): MsgAddCodeUploadParamsAddressesResponse { + return MsgAddCodeUploadParamsAddressesResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgAddCodeUploadParamsAddressesResponse): MsgAddCodeUploadParamsAddressesResponseAminoMsg { + return { + type: "wasm/MsgAddCodeUploadParamsAddressesResponse", + value: MsgAddCodeUploadParamsAddressesResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgAddCodeUploadParamsAddressesResponseProtoMsg): MsgAddCodeUploadParamsAddressesResponse { + return MsgAddCodeUploadParamsAddressesResponse.decode(message.value); + }, + toProto(message: MsgAddCodeUploadParamsAddressesResponse): Uint8Array { + return MsgAddCodeUploadParamsAddressesResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgAddCodeUploadParamsAddressesResponse): MsgAddCodeUploadParamsAddressesResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgAddCodeUploadParamsAddressesResponse", + value: MsgAddCodeUploadParamsAddressesResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgAddCodeUploadParamsAddressesResponse.typeUrl, MsgAddCodeUploadParamsAddressesResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgAddCodeUploadParamsAddressesResponse.aminoType, MsgAddCodeUploadParamsAddressesResponse.typeUrl); +function createBaseMsgRemoveCodeUploadParamsAddresses(): MsgRemoveCodeUploadParamsAddresses { + return { + authority: "", + addresses: [] + }; +} +export const MsgRemoveCodeUploadParamsAddresses = { + typeUrl: "/cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddresses", + aminoType: "wasm/MsgRemoveCodeUploadParamsAddresses", + is(o: any): o is MsgRemoveCodeUploadParamsAddresses { + return o && (o.$typeUrl === MsgRemoveCodeUploadParamsAddresses.typeUrl || typeof o.authority === "string" && Array.isArray(o.addresses) && (!o.addresses.length || typeof o.addresses[0] === "string")); + }, + isAmino(o: any): o is MsgRemoveCodeUploadParamsAddressesAmino { + return o && (o.$typeUrl === MsgRemoveCodeUploadParamsAddresses.typeUrl || typeof o.authority === "string" && Array.isArray(o.addresses) && (!o.addresses.length || typeof o.addresses[0] === "string")); + }, + encode(message: MsgRemoveCodeUploadParamsAddresses, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + for (const v of message.addresses) { + writer.uint32(18).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgRemoveCodeUploadParamsAddresses { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRemoveCodeUploadParamsAddresses(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.addresses.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgRemoveCodeUploadParamsAddresses { + const message = createBaseMsgRemoveCodeUploadParamsAddresses(); + message.authority = object.authority ?? ""; + message.addresses = object.addresses?.map(e => e) || []; + return message; + }, + fromAmino(object: MsgRemoveCodeUploadParamsAddressesAmino): MsgRemoveCodeUploadParamsAddresses { + const message = createBaseMsgRemoveCodeUploadParamsAddresses(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + message.addresses = object.addresses?.map(e => e) || []; + return message; + }, + toAmino(message: MsgRemoveCodeUploadParamsAddresses): MsgRemoveCodeUploadParamsAddressesAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + if (message.addresses) { + obj.addresses = message.addresses.map(e => e); + } else { + obj.addresses = message.addresses; + } + return obj; + }, + fromAminoMsg(object: MsgRemoveCodeUploadParamsAddressesAminoMsg): MsgRemoveCodeUploadParamsAddresses { + return MsgRemoveCodeUploadParamsAddresses.fromAmino(object.value); + }, + toAminoMsg(message: MsgRemoveCodeUploadParamsAddresses): MsgRemoveCodeUploadParamsAddressesAminoMsg { + return { + type: "wasm/MsgRemoveCodeUploadParamsAddresses", + value: MsgRemoveCodeUploadParamsAddresses.toAmino(message) + }; + }, + fromProtoMsg(message: MsgRemoveCodeUploadParamsAddressesProtoMsg): MsgRemoveCodeUploadParamsAddresses { + return MsgRemoveCodeUploadParamsAddresses.decode(message.value); + }, + toProto(message: MsgRemoveCodeUploadParamsAddresses): Uint8Array { + return MsgRemoveCodeUploadParamsAddresses.encode(message).finish(); + }, + toProtoMsg(message: MsgRemoveCodeUploadParamsAddresses): MsgRemoveCodeUploadParamsAddressesProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddresses", + value: MsgRemoveCodeUploadParamsAddresses.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgRemoveCodeUploadParamsAddresses.typeUrl, MsgRemoveCodeUploadParamsAddresses); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgRemoveCodeUploadParamsAddresses.aminoType, MsgRemoveCodeUploadParamsAddresses.typeUrl); +function createBaseMsgRemoveCodeUploadParamsAddressesResponse(): MsgRemoveCodeUploadParamsAddressesResponse { + return {}; +} +export const MsgRemoveCodeUploadParamsAddressesResponse = { + typeUrl: "/cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddressesResponse", + aminoType: "wasm/MsgRemoveCodeUploadParamsAddressesResponse", + is(o: any): o is MsgRemoveCodeUploadParamsAddressesResponse { + return o && o.$typeUrl === MsgRemoveCodeUploadParamsAddressesResponse.typeUrl; + }, + isAmino(o: any): o is MsgRemoveCodeUploadParamsAddressesResponseAmino { + return o && o.$typeUrl === MsgRemoveCodeUploadParamsAddressesResponse.typeUrl; + }, + encode(_: MsgRemoveCodeUploadParamsAddressesResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgRemoveCodeUploadParamsAddressesResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRemoveCodeUploadParamsAddressesResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgRemoveCodeUploadParamsAddressesResponse { + const message = createBaseMsgRemoveCodeUploadParamsAddressesResponse(); + return message; + }, + fromAmino(_: MsgRemoveCodeUploadParamsAddressesResponseAmino): MsgRemoveCodeUploadParamsAddressesResponse { + const message = createBaseMsgRemoveCodeUploadParamsAddressesResponse(); + return message; + }, + toAmino(_: MsgRemoveCodeUploadParamsAddressesResponse): MsgRemoveCodeUploadParamsAddressesResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgRemoveCodeUploadParamsAddressesResponseAminoMsg): MsgRemoveCodeUploadParamsAddressesResponse { + return MsgRemoveCodeUploadParamsAddressesResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgRemoveCodeUploadParamsAddressesResponse): MsgRemoveCodeUploadParamsAddressesResponseAminoMsg { + return { + type: "wasm/MsgRemoveCodeUploadParamsAddressesResponse", + value: MsgRemoveCodeUploadParamsAddressesResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgRemoveCodeUploadParamsAddressesResponseProtoMsg): MsgRemoveCodeUploadParamsAddressesResponse { + return MsgRemoveCodeUploadParamsAddressesResponse.decode(message.value); + }, + toProto(message: MsgRemoveCodeUploadParamsAddressesResponse): Uint8Array { + return MsgRemoveCodeUploadParamsAddressesResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgRemoveCodeUploadParamsAddressesResponse): MsgRemoveCodeUploadParamsAddressesResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgRemoveCodeUploadParamsAddressesResponse", + value: MsgRemoveCodeUploadParamsAddressesResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgRemoveCodeUploadParamsAddressesResponse.typeUrl, MsgRemoveCodeUploadParamsAddressesResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgRemoveCodeUploadParamsAddressesResponse.aminoType, MsgRemoveCodeUploadParamsAddressesResponse.typeUrl); +function createBaseMsgStoreAndMigrateContract(): MsgStoreAndMigrateContract { + return { + authority: "", + wasmByteCode: new Uint8Array(), + instantiatePermission: undefined, + contract: "", + msg: new Uint8Array() + }; +} +export const MsgStoreAndMigrateContract = { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreAndMigrateContract", + aminoType: "wasm/MsgStoreAndMigrateContract", + is(o: any): o is MsgStoreAndMigrateContract { + return o && (o.$typeUrl === MsgStoreAndMigrateContract.typeUrl || typeof o.authority === "string" && (o.wasmByteCode instanceof Uint8Array || typeof o.wasmByteCode === "string") && typeof o.contract === "string" && (o.msg instanceof Uint8Array || typeof o.msg === "string")); + }, + isAmino(o: any): o is MsgStoreAndMigrateContractAmino { + return o && (o.$typeUrl === MsgStoreAndMigrateContract.typeUrl || typeof o.authority === "string" && (o.wasm_byte_code instanceof Uint8Array || typeof o.wasm_byte_code === "string") && typeof o.contract === "string" && (o.msg instanceof Uint8Array || typeof o.msg === "string")); + }, + encode(message: MsgStoreAndMigrateContract, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.wasmByteCode.length !== 0) { + writer.uint32(18).bytes(message.wasmByteCode); + } + if (message.instantiatePermission !== undefined) { + AccessConfig.encode(message.instantiatePermission, writer.uint32(26).fork()).ldelim(); + } + if (message.contract !== "") { + writer.uint32(34).string(message.contract); + } + if (message.msg.length !== 0) { + writer.uint32(42).bytes(message.msg); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgStoreAndMigrateContract { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgStoreAndMigrateContract(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.wasmByteCode = reader.bytes(); + break; + case 3: + message.instantiatePermission = AccessConfig.decode(reader, reader.uint32()); + break; + case 4: + message.contract = reader.string(); + break; + case 5: + message.msg = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgStoreAndMigrateContract { + const message = createBaseMsgStoreAndMigrateContract(); + message.authority = object.authority ?? ""; + message.wasmByteCode = object.wasmByteCode ?? new Uint8Array(); + message.instantiatePermission = object.instantiatePermission !== undefined && object.instantiatePermission !== null ? AccessConfig.fromPartial(object.instantiatePermission) : undefined; + message.contract = object.contract ?? ""; + message.msg = object.msg ?? new Uint8Array(); + return message; + }, + fromAmino(object: MsgStoreAndMigrateContractAmino): MsgStoreAndMigrateContract { + const message = createBaseMsgStoreAndMigrateContract(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.wasm_byte_code !== undefined && object.wasm_byte_code !== null) { + message.wasmByteCode = fromBase64(object.wasm_byte_code); + } + if (object.instantiate_permission !== undefined && object.instantiate_permission !== null) { + message.instantiatePermission = AccessConfig.fromAmino(object.instantiate_permission); + } + if (object.contract !== undefined && object.contract !== null) { + message.contract = object.contract; + } + if (object.msg !== undefined && object.msg !== null) { + message.msg = toUtf8(JSON.stringify(object.msg)); + } + return message; + }, + toAmino(message: MsgStoreAndMigrateContract): MsgStoreAndMigrateContractAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + obj.wasm_byte_code = message.wasmByteCode ? toBase64(message.wasmByteCode) : undefined; + obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission) : undefined; + obj.contract = message.contract === "" ? undefined : message.contract; + obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; + return obj; + }, + fromAminoMsg(object: MsgStoreAndMigrateContractAminoMsg): MsgStoreAndMigrateContract { + return MsgStoreAndMigrateContract.fromAmino(object.value); + }, + toAminoMsg(message: MsgStoreAndMigrateContract): MsgStoreAndMigrateContractAminoMsg { + return { + type: "wasm/MsgStoreAndMigrateContract", + value: MsgStoreAndMigrateContract.toAmino(message) + }; + }, + fromProtoMsg(message: MsgStoreAndMigrateContractProtoMsg): MsgStoreAndMigrateContract { + return MsgStoreAndMigrateContract.decode(message.value); + }, + toProto(message: MsgStoreAndMigrateContract): Uint8Array { + return MsgStoreAndMigrateContract.encode(message).finish(); + }, + toProtoMsg(message: MsgStoreAndMigrateContract): MsgStoreAndMigrateContractProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreAndMigrateContract", + value: MsgStoreAndMigrateContract.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgStoreAndMigrateContract.typeUrl, MsgStoreAndMigrateContract); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgStoreAndMigrateContract.aminoType, MsgStoreAndMigrateContract.typeUrl); +function createBaseMsgStoreAndMigrateContractResponse(): MsgStoreAndMigrateContractResponse { + return { + codeId: BigInt(0), + checksum: new Uint8Array(), + data: new Uint8Array() + }; +} +export const MsgStoreAndMigrateContractResponse = { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreAndMigrateContractResponse", + aminoType: "wasm/MsgStoreAndMigrateContractResponse", + is(o: any): o is MsgStoreAndMigrateContractResponse { + return o && (o.$typeUrl === MsgStoreAndMigrateContractResponse.typeUrl || typeof o.codeId === "bigint" && (o.checksum instanceof Uint8Array || typeof o.checksum === "string") && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + isAmino(o: any): o is MsgStoreAndMigrateContractResponseAmino { + return o && (o.$typeUrl === MsgStoreAndMigrateContractResponse.typeUrl || typeof o.code_id === "bigint" && (o.checksum instanceof Uint8Array || typeof o.checksum === "string") && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + encode(message: MsgStoreAndMigrateContractResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.codeId !== BigInt(0)) { + writer.uint32(8).uint64(message.codeId); + } + if (message.checksum.length !== 0) { + writer.uint32(18).bytes(message.checksum); + } + if (message.data.length !== 0) { + writer.uint32(26).bytes(message.data); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgStoreAndMigrateContractResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgStoreAndMigrateContractResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.codeId = reader.uint64(); + break; + case 2: + message.checksum = reader.bytes(); + break; + case 3: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgStoreAndMigrateContractResponse { + const message = createBaseMsgStoreAndMigrateContractResponse(); + message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); + message.checksum = object.checksum ?? new Uint8Array(); + message.data = object.data ?? new Uint8Array(); + return message; + }, + fromAmino(object: MsgStoreAndMigrateContractResponseAmino): MsgStoreAndMigrateContractResponse { + const message = createBaseMsgStoreAndMigrateContractResponse(); + if (object.code_id !== undefined && object.code_id !== null) { + message.codeId = BigInt(object.code_id); + } + if (object.checksum !== undefined && object.checksum !== null) { + message.checksum = bytesFromBase64(object.checksum); + } + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + return message; + }, + toAmino(message: MsgStoreAndMigrateContractResponse): MsgStoreAndMigrateContractResponseAmino { + const obj: any = {}; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId?.toString() : undefined; + obj.checksum = message.checksum ? base64FromBytes(message.checksum) : undefined; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + return obj; + }, + fromAminoMsg(object: MsgStoreAndMigrateContractResponseAminoMsg): MsgStoreAndMigrateContractResponse { + return MsgStoreAndMigrateContractResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgStoreAndMigrateContractResponse): MsgStoreAndMigrateContractResponseAminoMsg { + return { + type: "wasm/MsgStoreAndMigrateContractResponse", + value: MsgStoreAndMigrateContractResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgStoreAndMigrateContractResponseProtoMsg): MsgStoreAndMigrateContractResponse { + return MsgStoreAndMigrateContractResponse.decode(message.value); + }, + toProto(message: MsgStoreAndMigrateContractResponse): Uint8Array { + return MsgStoreAndMigrateContractResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgStoreAndMigrateContractResponse): MsgStoreAndMigrateContractResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgStoreAndMigrateContractResponse", + value: MsgStoreAndMigrateContractResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgStoreAndMigrateContractResponse.typeUrl, MsgStoreAndMigrateContractResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgStoreAndMigrateContractResponse.aminoType, MsgStoreAndMigrateContractResponse.typeUrl); +function createBaseMsgUpdateContractLabel(): MsgUpdateContractLabel { + return { + sender: "", + newLabel: "", + contract: "" + }; +} +export const MsgUpdateContractLabel = { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateContractLabel", + aminoType: "wasm/MsgUpdateContractLabel", + is(o: any): o is MsgUpdateContractLabel { + return o && (o.$typeUrl === MsgUpdateContractLabel.typeUrl || typeof o.sender === "string" && typeof o.newLabel === "string" && typeof o.contract === "string"); + }, + isAmino(o: any): o is MsgUpdateContractLabelAmino { + return o && (o.$typeUrl === MsgUpdateContractLabel.typeUrl || typeof o.sender === "string" && typeof o.new_label === "string" && typeof o.contract === "string"); + }, + encode(message: MsgUpdateContractLabel, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + if (message.newLabel !== "") { + writer.uint32(18).string(message.newLabel); + } + if (message.contract !== "") { + writer.uint32(26).string(message.contract); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateContractLabel { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateContractLabel(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sender = reader.string(); + break; + case 2: + message.newLabel = reader.string(); + break; + case 3: + message.contract = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUpdateContractLabel { + const message = createBaseMsgUpdateContractLabel(); + message.sender = object.sender ?? ""; + message.newLabel = object.newLabel ?? ""; + message.contract = object.contract ?? ""; + return message; + }, + fromAmino(object: MsgUpdateContractLabelAmino): MsgUpdateContractLabel { + const message = createBaseMsgUpdateContractLabel(); + if (object.sender !== undefined && object.sender !== null) { + message.sender = object.sender; + } + if (object.new_label !== undefined && object.new_label !== null) { + message.newLabel = object.new_label; + } + if (object.contract !== undefined && object.contract !== null) { + message.contract = object.contract; + } + return message; + }, + toAmino(message: MsgUpdateContractLabel): MsgUpdateContractLabelAmino { + const obj: any = {}; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.new_label = message.newLabel === "" ? undefined : message.newLabel; + obj.contract = message.contract === "" ? undefined : message.contract; + return obj; + }, + fromAminoMsg(object: MsgUpdateContractLabelAminoMsg): MsgUpdateContractLabel { + return MsgUpdateContractLabel.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateContractLabel): MsgUpdateContractLabelAminoMsg { + return { + type: "wasm/MsgUpdateContractLabel", + value: MsgUpdateContractLabel.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateContractLabelProtoMsg): MsgUpdateContractLabel { + return MsgUpdateContractLabel.decode(message.value); + }, + toProto(message: MsgUpdateContractLabel): Uint8Array { + return MsgUpdateContractLabel.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateContractLabel): MsgUpdateContractLabelProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateContractLabel", + value: MsgUpdateContractLabel.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgUpdateContractLabel.typeUrl, MsgUpdateContractLabel); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgUpdateContractLabel.aminoType, MsgUpdateContractLabel.typeUrl); +function createBaseMsgUpdateContractLabelResponse(): MsgUpdateContractLabelResponse { + return {}; +} +export const MsgUpdateContractLabelResponse = { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateContractLabelResponse", + aminoType: "wasm/MsgUpdateContractLabelResponse", + is(o: any): o is MsgUpdateContractLabelResponse { + return o && o.$typeUrl === MsgUpdateContractLabelResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateContractLabelResponseAmino { + return o && o.$typeUrl === MsgUpdateContractLabelResponse.typeUrl; + }, + encode(_: MsgUpdateContractLabelResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateContractLabelResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateContractLabelResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgUpdateContractLabelResponse { + const message = createBaseMsgUpdateContractLabelResponse(); + return message; + }, + fromAmino(_: MsgUpdateContractLabelResponseAmino): MsgUpdateContractLabelResponse { + const message = createBaseMsgUpdateContractLabelResponse(); + return message; + }, + toAmino(_: MsgUpdateContractLabelResponse): MsgUpdateContractLabelResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateContractLabelResponseAminoMsg): MsgUpdateContractLabelResponse { + return MsgUpdateContractLabelResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateContractLabelResponse): MsgUpdateContractLabelResponseAminoMsg { + return { + type: "wasm/MsgUpdateContractLabelResponse", + value: MsgUpdateContractLabelResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateContractLabelResponseProtoMsg): MsgUpdateContractLabelResponse { + return MsgUpdateContractLabelResponse.decode(message.value); + }, + toProto(message: MsgUpdateContractLabelResponse): Uint8Array { + return MsgUpdateContractLabelResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateContractLabelResponse): MsgUpdateContractLabelResponseProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.MsgUpdateContractLabelResponse", + value: MsgUpdateContractLabelResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgUpdateContractLabelResponse.typeUrl, MsgUpdateContractLabelResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgUpdateContractLabelResponse.aminoType, MsgUpdateContractLabelResponse.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/cosmwasm/wasm/v1/types.ts b/libs/interchain-query/src/cosmwasm/wasm/v1/types.ts new file mode 100644 index 00000000..3dccb816 --- /dev/null +++ b/libs/interchain-query/src/cosmwasm/wasm/v1/types.ts @@ -0,0 +1,1120 @@ +import { Any, AnyProtoMsg, AnyAmino } from "../../../google/protobuf/any"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { GlobalDecoderRegistry } from "../../../registry"; +import { toUtf8, fromUtf8 } from "@cosmjs/encoding"; +/** AccessType permission types */ +export enum AccessType { + /** ACCESS_TYPE_UNSPECIFIED - AccessTypeUnspecified placeholder for empty value */ + ACCESS_TYPE_UNSPECIFIED = 0, + /** ACCESS_TYPE_NOBODY - AccessTypeNobody forbidden */ + ACCESS_TYPE_NOBODY = 1, + /** ACCESS_TYPE_EVERYBODY - AccessTypeEverybody unrestricted */ + ACCESS_TYPE_EVERYBODY = 3, + /** ACCESS_TYPE_ANY_OF_ADDRESSES - AccessTypeAnyOfAddresses allow any of the addresses */ + ACCESS_TYPE_ANY_OF_ADDRESSES = 4, + UNRECOGNIZED = -1, +} +export const AccessTypeAmino = AccessType; +export function accessTypeFromJSON(object: any): AccessType { + switch (object) { + case 0: + case "ACCESS_TYPE_UNSPECIFIED": + return AccessType.ACCESS_TYPE_UNSPECIFIED; + case 1: + case "ACCESS_TYPE_NOBODY": + return AccessType.ACCESS_TYPE_NOBODY; + case 3: + case "ACCESS_TYPE_EVERYBODY": + return AccessType.ACCESS_TYPE_EVERYBODY; + case 4: + case "ACCESS_TYPE_ANY_OF_ADDRESSES": + return AccessType.ACCESS_TYPE_ANY_OF_ADDRESSES; + case -1: + case "UNRECOGNIZED": + default: + return AccessType.UNRECOGNIZED; + } +} +export function accessTypeToJSON(object: AccessType): string { + switch (object) { + case AccessType.ACCESS_TYPE_UNSPECIFIED: + return "ACCESS_TYPE_UNSPECIFIED"; + case AccessType.ACCESS_TYPE_NOBODY: + return "ACCESS_TYPE_NOBODY"; + case AccessType.ACCESS_TYPE_EVERYBODY: + return "ACCESS_TYPE_EVERYBODY"; + case AccessType.ACCESS_TYPE_ANY_OF_ADDRESSES: + return "ACCESS_TYPE_ANY_OF_ADDRESSES"; + case AccessType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** ContractCodeHistoryOperationType actions that caused a code change */ +export enum ContractCodeHistoryOperationType { + /** CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED - ContractCodeHistoryOperationTypeUnspecified placeholder for empty value */ + CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED = 0, + /** CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT - ContractCodeHistoryOperationTypeInit on chain contract instantiation */ + CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT = 1, + /** CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE - ContractCodeHistoryOperationTypeMigrate code migration */ + CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE = 2, + /** CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS - ContractCodeHistoryOperationTypeGenesis based on genesis data */ + CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS = 3, + UNRECOGNIZED = -1, +} +export const ContractCodeHistoryOperationTypeAmino = ContractCodeHistoryOperationType; +export function contractCodeHistoryOperationTypeFromJSON(object: any): ContractCodeHistoryOperationType { + switch (object) { + case 0: + case "CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED": + return ContractCodeHistoryOperationType.CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED; + case 1: + case "CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT": + return ContractCodeHistoryOperationType.CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT; + case 2: + case "CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE": + return ContractCodeHistoryOperationType.CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE; + case 3: + case "CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS": + return ContractCodeHistoryOperationType.CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS; + case -1: + case "UNRECOGNIZED": + default: + return ContractCodeHistoryOperationType.UNRECOGNIZED; + } +} +export function contractCodeHistoryOperationTypeToJSON(object: ContractCodeHistoryOperationType): string { + switch (object) { + case ContractCodeHistoryOperationType.CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED: + return "CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED"; + case ContractCodeHistoryOperationType.CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT: + return "CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT"; + case ContractCodeHistoryOperationType.CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE: + return "CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE"; + case ContractCodeHistoryOperationType.CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS: + return "CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS"; + case ContractCodeHistoryOperationType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** AccessTypeParam */ +export interface AccessTypeParam { + value: AccessType; +} +export interface AccessTypeParamProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.AccessTypeParam"; + value: Uint8Array; +} +/** AccessTypeParam */ +export interface AccessTypeParamAmino { + value: AccessType; +} +export interface AccessTypeParamAminoMsg { + type: "wasm/AccessTypeParam"; + value: AccessTypeParamAmino; +} +/** AccessConfig access control type. */ +export interface AccessConfig { + permission: AccessType; + addresses: string[]; +} +export interface AccessConfigProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.AccessConfig"; + value: Uint8Array; +} +/** AccessConfig access control type. */ +export interface AccessConfigAmino { + permission: AccessType; + addresses: string[]; +} +export interface AccessConfigAminoMsg { + type: "wasm/AccessConfig"; + value: AccessConfigAmino; +} +/** Params defines the set of wasm parameters. */ +export interface Params { + codeUploadAccess: AccessConfig; + instantiateDefaultPermission: AccessType; +} +export interface ParamsProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.Params"; + value: Uint8Array; +} +/** Params defines the set of wasm parameters. */ +export interface ParamsAmino { + code_upload_access: AccessConfigAmino; + instantiate_default_permission: AccessType; +} +export interface ParamsAminoMsg { + type: "wasm/Params"; + value: ParamsAmino; +} +/** CodeInfo is data for the uploaded contract WASM code */ +export interface CodeInfo { + /** CodeHash is the unique identifier created by wasmvm */ + codeHash: Uint8Array; + /** Creator address who initially stored the code */ + creator: string; + /** InstantiateConfig access control to apply on contract creation, optional */ + instantiateConfig: AccessConfig; +} +export interface CodeInfoProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.CodeInfo"; + value: Uint8Array; +} +/** CodeInfo is data for the uploaded contract WASM code */ +export interface CodeInfoAmino { + /** CodeHash is the unique identifier created by wasmvm */ + code_hash: string; + /** Creator address who initially stored the code */ + creator: string; + /** InstantiateConfig access control to apply on contract creation, optional */ + instantiate_config: AccessConfigAmino; +} +export interface CodeInfoAminoMsg { + type: "wasm/CodeInfo"; + value: CodeInfoAmino; +} +/** ContractInfo stores a WASM contract instance */ +export interface ContractInfo { + /** CodeID is the reference to the stored Wasm code */ + codeId: bigint; + /** Creator address who initially instantiated the contract */ + creator: string; + /** Admin is an optional address that can execute migrations */ + admin: string; + /** Label is optional metadata to be stored with a contract instance. */ + label: string; + /** Created Tx position when the contract was instantiated. */ + created?: AbsoluteTxPosition; + ibcPortId: string; + /** + * Extension is an extension point to store custom metadata within the + * persistence model. + */ + extension?: Any | undefined; +} +export interface ContractInfoProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.ContractInfo"; + value: Uint8Array; +} +export type ContractInfoEncoded = Omit & { + /** + * Extension is an extension point to store custom metadata within the + * persistence model. + */ + extension?: AnyProtoMsg | undefined; +}; +/** ContractInfo stores a WASM contract instance */ +export interface ContractInfoAmino { + /** CodeID is the reference to the stored Wasm code */ + code_id: string; + /** Creator address who initially instantiated the contract */ + creator: string; + /** Admin is an optional address that can execute migrations */ + admin: string; + /** Label is optional metadata to be stored with a contract instance. */ + label: string; + /** Created Tx position when the contract was instantiated. */ + created?: AbsoluteTxPositionAmino; + ibc_port_id: string; + /** + * Extension is an extension point to store custom metadata within the + * persistence model. + */ + extension?: AnyAmino; +} +export interface ContractInfoAminoMsg { + type: "wasm/ContractInfo"; + value: ContractInfoAmino; +} +/** ContractCodeHistoryEntry metadata to a contract. */ +export interface ContractCodeHistoryEntry { + operation: ContractCodeHistoryOperationType; + /** CodeID is the reference to the stored WASM code */ + codeId: bigint; + /** Updated Tx position when the operation was executed. */ + updated?: AbsoluteTxPosition; + msg: Uint8Array; +} +export interface ContractCodeHistoryEntryProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.ContractCodeHistoryEntry"; + value: Uint8Array; +} +/** ContractCodeHistoryEntry metadata to a contract. */ +export interface ContractCodeHistoryEntryAmino { + operation: ContractCodeHistoryOperationType; + /** CodeID is the reference to the stored WASM code */ + code_id: string; + /** Updated Tx position when the operation was executed. */ + updated?: AbsoluteTxPositionAmino; + msg: any; +} +export interface ContractCodeHistoryEntryAminoMsg { + type: "wasm/ContractCodeHistoryEntry"; + value: ContractCodeHistoryEntryAmino; +} +/** + * AbsoluteTxPosition is a unique transaction position that allows for global + * ordering of transactions. + */ +export interface AbsoluteTxPosition { + /** BlockHeight is the block the contract was created at */ + blockHeight: bigint; + /** + * TxIndex is a monotonic counter within the block (actual transaction index, + * or gas consumed) + */ + txIndex: bigint; +} +export interface AbsoluteTxPositionProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.AbsoluteTxPosition"; + value: Uint8Array; +} +/** + * AbsoluteTxPosition is a unique transaction position that allows for global + * ordering of transactions. + */ +export interface AbsoluteTxPositionAmino { + /** BlockHeight is the block the contract was created at */ + block_height: string; + /** + * TxIndex is a monotonic counter within the block (actual transaction index, + * or gas consumed) + */ + tx_index: string; +} +export interface AbsoluteTxPositionAminoMsg { + type: "wasm/AbsoluteTxPosition"; + value: AbsoluteTxPositionAmino; +} +/** Model is a struct that holds a KV pair */ +export interface Model { + /** hex-encode key to read it better (this is often ascii) */ + key: Uint8Array; + /** base64-encode raw value */ + value: Uint8Array; +} +export interface ModelProtoMsg { + typeUrl: "/cosmwasm.wasm.v1.Model"; + value: Uint8Array; +} +/** Model is a struct that holds a KV pair */ +export interface ModelAmino { + /** hex-encode key to read it better (this is often ascii) */ + key: string; + /** base64-encode raw value */ + value: string; +} +export interface ModelAminoMsg { + type: "wasm/Model"; + value: ModelAmino; +} +function createBaseAccessTypeParam(): AccessTypeParam { + return { + value: 0 + }; +} +export const AccessTypeParam = { + typeUrl: "/cosmwasm.wasm.v1.AccessTypeParam", + aminoType: "wasm/AccessTypeParam", + is(o: any): o is AccessTypeParam { + return o && (o.$typeUrl === AccessTypeParam.typeUrl || isSet(o.value)); + }, + isAmino(o: any): o is AccessTypeParamAmino { + return o && (o.$typeUrl === AccessTypeParam.typeUrl || isSet(o.value)); + }, + encode(message: AccessTypeParam, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.value !== 0) { + writer.uint32(8).int32(message.value); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AccessTypeParam { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAccessTypeParam(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.value = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): AccessTypeParam { + const message = createBaseAccessTypeParam(); + message.value = object.value ?? 0; + return message; + }, + fromAmino(object: AccessTypeParamAmino): AccessTypeParam { + const message = createBaseAccessTypeParam(); + if (object.value !== undefined && object.value !== null) { + message.value = object.value; + } + return message; + }, + toAmino(message: AccessTypeParam): AccessTypeParamAmino { + const obj: any = {}; + obj.value = message.value === 0 ? undefined : message.value; + return obj; + }, + fromAminoMsg(object: AccessTypeParamAminoMsg): AccessTypeParam { + return AccessTypeParam.fromAmino(object.value); + }, + toAminoMsg(message: AccessTypeParam): AccessTypeParamAminoMsg { + return { + type: "wasm/AccessTypeParam", + value: AccessTypeParam.toAmino(message) + }; + }, + fromProtoMsg(message: AccessTypeParamProtoMsg): AccessTypeParam { + return AccessTypeParam.decode(message.value); + }, + toProto(message: AccessTypeParam): Uint8Array { + return AccessTypeParam.encode(message).finish(); + }, + toProtoMsg(message: AccessTypeParam): AccessTypeParamProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.AccessTypeParam", + value: AccessTypeParam.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(AccessTypeParam.typeUrl, AccessTypeParam); +GlobalDecoderRegistry.registerAminoProtoMapping(AccessTypeParam.aminoType, AccessTypeParam.typeUrl); +function createBaseAccessConfig(): AccessConfig { + return { + permission: 0, + addresses: [] + }; +} +export const AccessConfig = { + typeUrl: "/cosmwasm.wasm.v1.AccessConfig", + aminoType: "wasm/AccessConfig", + is(o: any): o is AccessConfig { + return o && (o.$typeUrl === AccessConfig.typeUrl || isSet(o.permission) && Array.isArray(o.addresses) && (!o.addresses.length || typeof o.addresses[0] === "string")); + }, + isAmino(o: any): o is AccessConfigAmino { + return o && (o.$typeUrl === AccessConfig.typeUrl || isSet(o.permission) && Array.isArray(o.addresses) && (!o.addresses.length || typeof o.addresses[0] === "string")); + }, + encode(message: AccessConfig, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.permission !== 0) { + writer.uint32(8).int32(message.permission); + } + for (const v of message.addresses) { + writer.uint32(26).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AccessConfig { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAccessConfig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.permission = (reader.int32() as any); + break; + case 3: + message.addresses.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): AccessConfig { + const message = createBaseAccessConfig(); + message.permission = object.permission ?? 0; + message.addresses = object.addresses?.map(e => e) || []; + return message; + }, + fromAmino(object: AccessConfigAmino): AccessConfig { + const message = createBaseAccessConfig(); + if (object.permission !== undefined && object.permission !== null) { + message.permission = object.permission; + } + message.addresses = object.addresses?.map(e => e) || []; + return message; + }, + toAmino(message: AccessConfig): AccessConfigAmino { + const obj: any = {}; + obj.permission = message.permission === 0 ? undefined : message.permission; + if (message.addresses) { + obj.addresses = message.addresses.map(e => e); + } else { + obj.addresses = message.addresses; + } + return obj; + }, + fromAminoMsg(object: AccessConfigAminoMsg): AccessConfig { + return AccessConfig.fromAmino(object.value); + }, + toAminoMsg(message: AccessConfig): AccessConfigAminoMsg { + return { + type: "wasm/AccessConfig", + value: AccessConfig.toAmino(message) + }; + }, + fromProtoMsg(message: AccessConfigProtoMsg): AccessConfig { + return AccessConfig.decode(message.value); + }, + toProto(message: AccessConfig): Uint8Array { + return AccessConfig.encode(message).finish(); + }, + toProtoMsg(message: AccessConfig): AccessConfigProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.AccessConfig", + value: AccessConfig.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(AccessConfig.typeUrl, AccessConfig); +GlobalDecoderRegistry.registerAminoProtoMapping(AccessConfig.aminoType, AccessConfig.typeUrl); +function createBaseParams(): Params { + return { + codeUploadAccess: AccessConfig.fromPartial({}), + instantiateDefaultPermission: 0 + }; +} +export const Params = { + typeUrl: "/cosmwasm.wasm.v1.Params", + aminoType: "wasm/Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || AccessConfig.is(o.codeUploadAccess) && isSet(o.instantiateDefaultPermission)); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || AccessConfig.isAmino(o.code_upload_access) && isSet(o.instantiate_default_permission)); + }, + encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.codeUploadAccess !== undefined) { + AccessConfig.encode(message.codeUploadAccess, writer.uint32(10).fork()).ldelim(); + } + if (message.instantiateDefaultPermission !== 0) { + writer.uint32(16).int32(message.instantiateDefaultPermission); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.codeUploadAccess = AccessConfig.decode(reader, reader.uint32()); + break; + case 2: + message.instantiateDefaultPermission = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Params { + const message = createBaseParams(); + message.codeUploadAccess = object.codeUploadAccess !== undefined && object.codeUploadAccess !== null ? AccessConfig.fromPartial(object.codeUploadAccess) : undefined; + message.instantiateDefaultPermission = object.instantiateDefaultPermission ?? 0; + return message; + }, + fromAmino(object: ParamsAmino): Params { + const message = createBaseParams(); + if (object.code_upload_access !== undefined && object.code_upload_access !== null) { + message.codeUploadAccess = AccessConfig.fromAmino(object.code_upload_access); + } + if (object.instantiate_default_permission !== undefined && object.instantiate_default_permission !== null) { + message.instantiateDefaultPermission = object.instantiate_default_permission; + } + return message; + }, + toAmino(message: Params): ParamsAmino { + const obj: any = {}; + obj.code_upload_access = message.codeUploadAccess ? AccessConfig.toAmino(message.codeUploadAccess) : AccessConfig.toAmino(AccessConfig.fromPartial({})); + obj.instantiate_default_permission = message.instantiateDefaultPermission === 0 ? undefined : message.instantiateDefaultPermission; + return obj; + }, + fromAminoMsg(object: ParamsAminoMsg): Params { + return Params.fromAmino(object.value); + }, + toAminoMsg(message: Params): ParamsAminoMsg { + return { + type: "wasm/Params", + value: Params.toAmino(message) + }; + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.Params", + value: Params.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Params.typeUrl, Params); +GlobalDecoderRegistry.registerAminoProtoMapping(Params.aminoType, Params.typeUrl); +function createBaseCodeInfo(): CodeInfo { + return { + codeHash: new Uint8Array(), + creator: "", + instantiateConfig: AccessConfig.fromPartial({}) + }; +} +export const CodeInfo = { + typeUrl: "/cosmwasm.wasm.v1.CodeInfo", + aminoType: "wasm/CodeInfo", + is(o: any): o is CodeInfo { + return o && (o.$typeUrl === CodeInfo.typeUrl || (o.codeHash instanceof Uint8Array || typeof o.codeHash === "string") && typeof o.creator === "string" && AccessConfig.is(o.instantiateConfig)); + }, + isAmino(o: any): o is CodeInfoAmino { + return o && (o.$typeUrl === CodeInfo.typeUrl || (o.code_hash instanceof Uint8Array || typeof o.code_hash === "string") && typeof o.creator === "string" && AccessConfig.isAmino(o.instantiate_config)); + }, + encode(message: CodeInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.codeHash.length !== 0) { + writer.uint32(10).bytes(message.codeHash); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.instantiateConfig !== undefined) { + AccessConfig.encode(message.instantiateConfig, writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): CodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCodeInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.codeHash = reader.bytes(); + break; + case 2: + message.creator = reader.string(); + break; + case 5: + message.instantiateConfig = AccessConfig.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): CodeInfo { + const message = createBaseCodeInfo(); + message.codeHash = object.codeHash ?? new Uint8Array(); + message.creator = object.creator ?? ""; + message.instantiateConfig = object.instantiateConfig !== undefined && object.instantiateConfig !== null ? AccessConfig.fromPartial(object.instantiateConfig) : undefined; + return message; + }, + fromAmino(object: CodeInfoAmino): CodeInfo { + const message = createBaseCodeInfo(); + if (object.code_hash !== undefined && object.code_hash !== null) { + message.codeHash = bytesFromBase64(object.code_hash); + } + if (object.creator !== undefined && object.creator !== null) { + message.creator = object.creator; + } + if (object.instantiate_config !== undefined && object.instantiate_config !== null) { + message.instantiateConfig = AccessConfig.fromAmino(object.instantiate_config); + } + return message; + }, + toAmino(message: CodeInfo): CodeInfoAmino { + const obj: any = {}; + obj.code_hash = message.codeHash ? base64FromBytes(message.codeHash) : undefined; + obj.creator = message.creator === "" ? undefined : message.creator; + obj.instantiate_config = message.instantiateConfig ? AccessConfig.toAmino(message.instantiateConfig) : AccessConfig.toAmino(AccessConfig.fromPartial({})); + return obj; + }, + fromAminoMsg(object: CodeInfoAminoMsg): CodeInfo { + return CodeInfo.fromAmino(object.value); + }, + toAminoMsg(message: CodeInfo): CodeInfoAminoMsg { + return { + type: "wasm/CodeInfo", + value: CodeInfo.toAmino(message) + }; + }, + fromProtoMsg(message: CodeInfoProtoMsg): CodeInfo { + return CodeInfo.decode(message.value); + }, + toProto(message: CodeInfo): Uint8Array { + return CodeInfo.encode(message).finish(); + }, + toProtoMsg(message: CodeInfo): CodeInfoProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.CodeInfo", + value: CodeInfo.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(CodeInfo.typeUrl, CodeInfo); +GlobalDecoderRegistry.registerAminoProtoMapping(CodeInfo.aminoType, CodeInfo.typeUrl); +function createBaseContractInfo(): ContractInfo { + return { + codeId: BigInt(0), + creator: "", + admin: "", + label: "", + created: undefined, + ibcPortId: "", + extension: undefined + }; +} +export const ContractInfo = { + typeUrl: "/cosmwasm.wasm.v1.ContractInfo", + aminoType: "wasm/ContractInfo", + is(o: any): o is ContractInfo { + return o && (o.$typeUrl === ContractInfo.typeUrl || typeof o.codeId === "bigint" && typeof o.creator === "string" && typeof o.admin === "string" && typeof o.label === "string" && typeof o.ibcPortId === "string"); + }, + isAmino(o: any): o is ContractInfoAmino { + return o && (o.$typeUrl === ContractInfo.typeUrl || typeof o.code_id === "bigint" && typeof o.creator === "string" && typeof o.admin === "string" && typeof o.label === "string" && typeof o.ibc_port_id === "string"); + }, + encode(message: ContractInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.codeId !== BigInt(0)) { + writer.uint32(8).uint64(message.codeId); + } + if (message.creator !== "") { + writer.uint32(18).string(message.creator); + } + if (message.admin !== "") { + writer.uint32(26).string(message.admin); + } + if (message.label !== "") { + writer.uint32(34).string(message.label); + } + if (message.created !== undefined) { + AbsoluteTxPosition.encode(message.created, writer.uint32(42).fork()).ldelim(); + } + if (message.ibcPortId !== "") { + writer.uint32(50).string(message.ibcPortId); + } + if (message.extension !== undefined) { + Any.encode(GlobalDecoderRegistry.wrapAny(message.extension), writer.uint32(58).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ContractInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.codeId = reader.uint64(); + break; + case 2: + message.creator = reader.string(); + break; + case 3: + message.admin = reader.string(); + break; + case 4: + message.label = reader.string(); + break; + case 5: + message.created = AbsoluteTxPosition.decode(reader, reader.uint32()); + break; + case 6: + message.ibcPortId = reader.string(); + break; + case 7: + message.extension = GlobalDecoderRegistry.unwrapAny(reader); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ContractInfo { + const message = createBaseContractInfo(); + message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); + message.creator = object.creator ?? ""; + message.admin = object.admin ?? ""; + message.label = object.label ?? ""; + message.created = object.created !== undefined && object.created !== null ? AbsoluteTxPosition.fromPartial(object.created) : undefined; + message.ibcPortId = object.ibcPortId ?? ""; + message.extension = object.extension !== undefined && object.extension !== null ? GlobalDecoderRegistry.fromPartial(object.extension) : undefined; + return message; + }, + fromAmino(object: ContractInfoAmino): ContractInfo { + const message = createBaseContractInfo(); + if (object.code_id !== undefined && object.code_id !== null) { + message.codeId = BigInt(object.code_id); + } + if (object.creator !== undefined && object.creator !== null) { + message.creator = object.creator; + } + if (object.admin !== undefined && object.admin !== null) { + message.admin = object.admin; + } + if (object.label !== undefined && object.label !== null) { + message.label = object.label; + } + if (object.created !== undefined && object.created !== null) { + message.created = AbsoluteTxPosition.fromAmino(object.created); + } + if (object.ibc_port_id !== undefined && object.ibc_port_id !== null) { + message.ibcPortId = object.ibc_port_id; + } + if (object.extension !== undefined && object.extension !== null) { + message.extension = GlobalDecoderRegistry.fromAminoMsg(object.extension); + } + return message; + }, + toAmino(message: ContractInfo): ContractInfoAmino { + const obj: any = {}; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId?.toString() : undefined; + obj.creator = message.creator === "" ? undefined : message.creator; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.label = message.label === "" ? undefined : message.label; + obj.created = message.created ? AbsoluteTxPosition.toAmino(message.created) : undefined; + obj.ibc_port_id = message.ibcPortId === "" ? undefined : message.ibcPortId; + obj.extension = message.extension ? GlobalDecoderRegistry.toAminoMsg(message.extension) : undefined; + return obj; + }, + fromAminoMsg(object: ContractInfoAminoMsg): ContractInfo { + return ContractInfo.fromAmino(object.value); + }, + toAminoMsg(message: ContractInfo): ContractInfoAminoMsg { + return { + type: "wasm/ContractInfo", + value: ContractInfo.toAmino(message) + }; + }, + fromProtoMsg(message: ContractInfoProtoMsg): ContractInfo { + return ContractInfo.decode(message.value); + }, + toProto(message: ContractInfo): Uint8Array { + return ContractInfo.encode(message).finish(); + }, + toProtoMsg(message: ContractInfo): ContractInfoProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.ContractInfo", + value: ContractInfo.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ContractInfo.typeUrl, ContractInfo); +GlobalDecoderRegistry.registerAminoProtoMapping(ContractInfo.aminoType, ContractInfo.typeUrl); +function createBaseContractCodeHistoryEntry(): ContractCodeHistoryEntry { + return { + operation: 0, + codeId: BigInt(0), + updated: undefined, + msg: new Uint8Array() + }; +} +export const ContractCodeHistoryEntry = { + typeUrl: "/cosmwasm.wasm.v1.ContractCodeHistoryEntry", + aminoType: "wasm/ContractCodeHistoryEntry", + is(o: any): o is ContractCodeHistoryEntry { + return o && (o.$typeUrl === ContractCodeHistoryEntry.typeUrl || isSet(o.operation) && typeof o.codeId === "bigint" && (o.msg instanceof Uint8Array || typeof o.msg === "string")); + }, + isAmino(o: any): o is ContractCodeHistoryEntryAmino { + return o && (o.$typeUrl === ContractCodeHistoryEntry.typeUrl || isSet(o.operation) && typeof o.code_id === "bigint" && (o.msg instanceof Uint8Array || typeof o.msg === "string")); + }, + encode(message: ContractCodeHistoryEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.operation !== 0) { + writer.uint32(8).int32(message.operation); + } + if (message.codeId !== BigInt(0)) { + writer.uint32(16).uint64(message.codeId); + } + if (message.updated !== undefined) { + AbsoluteTxPosition.encode(message.updated, writer.uint32(26).fork()).ldelim(); + } + if (message.msg.length !== 0) { + writer.uint32(34).bytes(message.msg); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ContractCodeHistoryEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseContractCodeHistoryEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.operation = (reader.int32() as any); + break; + case 2: + message.codeId = reader.uint64(); + break; + case 3: + message.updated = AbsoluteTxPosition.decode(reader, reader.uint32()); + break; + case 4: + message.msg = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ContractCodeHistoryEntry { + const message = createBaseContractCodeHistoryEntry(); + message.operation = object.operation ?? 0; + message.codeId = object.codeId !== undefined && object.codeId !== null ? BigInt(object.codeId.toString()) : BigInt(0); + message.updated = object.updated !== undefined && object.updated !== null ? AbsoluteTxPosition.fromPartial(object.updated) : undefined; + message.msg = object.msg ?? new Uint8Array(); + return message; + }, + fromAmino(object: ContractCodeHistoryEntryAmino): ContractCodeHistoryEntry { + const message = createBaseContractCodeHistoryEntry(); + if (object.operation !== undefined && object.operation !== null) { + message.operation = object.operation; + } + if (object.code_id !== undefined && object.code_id !== null) { + message.codeId = BigInt(object.code_id); + } + if (object.updated !== undefined && object.updated !== null) { + message.updated = AbsoluteTxPosition.fromAmino(object.updated); + } + if (object.msg !== undefined && object.msg !== null) { + message.msg = toUtf8(JSON.stringify(object.msg)); + } + return message; + }, + toAmino(message: ContractCodeHistoryEntry): ContractCodeHistoryEntryAmino { + const obj: any = {}; + obj.operation = message.operation === 0 ? undefined : message.operation; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId?.toString() : undefined; + obj.updated = message.updated ? AbsoluteTxPosition.toAmino(message.updated) : undefined; + obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; + return obj; + }, + fromAminoMsg(object: ContractCodeHistoryEntryAminoMsg): ContractCodeHistoryEntry { + return ContractCodeHistoryEntry.fromAmino(object.value); + }, + toAminoMsg(message: ContractCodeHistoryEntry): ContractCodeHistoryEntryAminoMsg { + return { + type: "wasm/ContractCodeHistoryEntry", + value: ContractCodeHistoryEntry.toAmino(message) + }; + }, + fromProtoMsg(message: ContractCodeHistoryEntryProtoMsg): ContractCodeHistoryEntry { + return ContractCodeHistoryEntry.decode(message.value); + }, + toProto(message: ContractCodeHistoryEntry): Uint8Array { + return ContractCodeHistoryEntry.encode(message).finish(); + }, + toProtoMsg(message: ContractCodeHistoryEntry): ContractCodeHistoryEntryProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.ContractCodeHistoryEntry", + value: ContractCodeHistoryEntry.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ContractCodeHistoryEntry.typeUrl, ContractCodeHistoryEntry); +GlobalDecoderRegistry.registerAminoProtoMapping(ContractCodeHistoryEntry.aminoType, ContractCodeHistoryEntry.typeUrl); +function createBaseAbsoluteTxPosition(): AbsoluteTxPosition { + return { + blockHeight: BigInt(0), + txIndex: BigInt(0) + }; +} +export const AbsoluteTxPosition = { + typeUrl: "/cosmwasm.wasm.v1.AbsoluteTxPosition", + aminoType: "wasm/AbsoluteTxPosition", + is(o: any): o is AbsoluteTxPosition { + return o && (o.$typeUrl === AbsoluteTxPosition.typeUrl || typeof o.blockHeight === "bigint" && typeof o.txIndex === "bigint"); + }, + isAmino(o: any): o is AbsoluteTxPositionAmino { + return o && (o.$typeUrl === AbsoluteTxPosition.typeUrl || typeof o.block_height === "bigint" && typeof o.tx_index === "bigint"); + }, + encode(message: AbsoluteTxPosition, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.blockHeight !== BigInt(0)) { + writer.uint32(8).uint64(message.blockHeight); + } + if (message.txIndex !== BigInt(0)) { + writer.uint32(16).uint64(message.txIndex); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AbsoluteTxPosition { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAbsoluteTxPosition(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.blockHeight = reader.uint64(); + break; + case 2: + message.txIndex = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): AbsoluteTxPosition { + const message = createBaseAbsoluteTxPosition(); + message.blockHeight = object.blockHeight !== undefined && object.blockHeight !== null ? BigInt(object.blockHeight.toString()) : BigInt(0); + message.txIndex = object.txIndex !== undefined && object.txIndex !== null ? BigInt(object.txIndex.toString()) : BigInt(0); + return message; + }, + fromAmino(object: AbsoluteTxPositionAmino): AbsoluteTxPosition { + const message = createBaseAbsoluteTxPosition(); + if (object.block_height !== undefined && object.block_height !== null) { + message.blockHeight = BigInt(object.block_height); + } + if (object.tx_index !== undefined && object.tx_index !== null) { + message.txIndex = BigInt(object.tx_index); + } + return message; + }, + toAmino(message: AbsoluteTxPosition): AbsoluteTxPositionAmino { + const obj: any = {}; + obj.block_height = message.blockHeight !== BigInt(0) ? message.blockHeight?.toString() : undefined; + obj.tx_index = message.txIndex !== BigInt(0) ? message.txIndex?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: AbsoluteTxPositionAminoMsg): AbsoluteTxPosition { + return AbsoluteTxPosition.fromAmino(object.value); + }, + toAminoMsg(message: AbsoluteTxPosition): AbsoluteTxPositionAminoMsg { + return { + type: "wasm/AbsoluteTxPosition", + value: AbsoluteTxPosition.toAmino(message) + }; + }, + fromProtoMsg(message: AbsoluteTxPositionProtoMsg): AbsoluteTxPosition { + return AbsoluteTxPosition.decode(message.value); + }, + toProto(message: AbsoluteTxPosition): Uint8Array { + return AbsoluteTxPosition.encode(message).finish(); + }, + toProtoMsg(message: AbsoluteTxPosition): AbsoluteTxPositionProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.AbsoluteTxPosition", + value: AbsoluteTxPosition.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(AbsoluteTxPosition.typeUrl, AbsoluteTxPosition); +GlobalDecoderRegistry.registerAminoProtoMapping(AbsoluteTxPosition.aminoType, AbsoluteTxPosition.typeUrl); +function createBaseModel(): Model { + return { + key: new Uint8Array(), + value: new Uint8Array() + }; +} +export const Model = { + typeUrl: "/cosmwasm.wasm.v1.Model", + aminoType: "wasm/Model", + is(o: any): o is Model { + return o && (o.$typeUrl === Model.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string")); + }, + isAmino(o: any): o is ModelAmino { + return o && (o.$typeUrl === Model.typeUrl || (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string")); + }, + encode(message: Model, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Model { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseModel(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + case 2: + message.value = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Model { + const message = createBaseModel(); + message.key = object.key ?? new Uint8Array(); + message.value = object.value ?? new Uint8Array(); + return message; + }, + fromAmino(object: ModelAmino): Model { + const message = createBaseModel(); + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + if (object.value !== undefined && object.value !== null) { + message.value = bytesFromBase64(object.value); + } + return message; + }, + toAmino(message: Model): ModelAmino { + const obj: any = {}; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + obj.value = message.value ? base64FromBytes(message.value) : undefined; + return obj; + }, + fromAminoMsg(object: ModelAminoMsg): Model { + return Model.fromAmino(object.value); + }, + toAminoMsg(message: Model): ModelAminoMsg { + return { + type: "wasm/Model", + value: Model.toAmino(message) + }; + }, + fromProtoMsg(message: ModelProtoMsg): Model { + return Model.decode(message.value); + }, + toProto(message: Model): Uint8Array { + return Model.encode(message).finish(); + }, + toProtoMsg(message: Model): ModelProtoMsg { + return { + typeUrl: "/cosmwasm.wasm.v1.Model", + value: Model.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Model.typeUrl, Model); +GlobalDecoderRegistry.registerAminoProtoMapping(Model.aminoType, Model.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/extern.ts b/libs/interchain-query/src/extern.ts new file mode 100644 index 00000000..98523711 --- /dev/null +++ b/libs/interchain-query/src/extern.ts @@ -0,0 +1,38 @@ +/** +* This file and any referenced files were automatically generated by @cosmology/telescope@1.10.8 +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +import { HttpEndpoint } from "@interchainjs/types"; +import { + createQueryRpc, +} from '@interchainjs/cosmos/utils'; +import { Rpc } from "./helpers"; + +const _rpcClients: Record = {}; + +export const getRpcEndpointKey = (rpcEndpoint: string | HttpEndpoint) => { + if (typeof rpcEndpoint === 'string') { + return rpcEndpoint; + } else if (!!rpcEndpoint) { + //@ts-ignore + return rpcEndpoint.url; + } +} + +export const getRpcClient = async (rpcEndpoint: string | HttpEndpoint) => { + const key = getRpcEndpointKey(rpcEndpoint); + if (!key) return; + if (_rpcClients.hasOwnProperty(key)) { + return _rpcClients[key]; + } + const rpc = await createRpcClient(rpcEndpoint); + _rpcClients[key] = rpc; + return rpc; +} + +export const createRpcClient = async (rpcEndpoint: string | HttpEndpoint) => { + return createQueryRpc(rpcEndpoint) +} diff --git a/libs/interchain-query/src/gogoproto/gogo.ts b/libs/interchain-query/src/gogoproto/gogo.ts new file mode 100644 index 00000000..693da49f --- /dev/null +++ b/libs/interchain-query/src/gogoproto/gogo.ts @@ -0,0 +1 @@ +export {} \ No newline at end of file diff --git a/libs/interchain-query/src/google/api/annotations.ts b/libs/interchain-query/src/google/api/annotations.ts new file mode 100644 index 00000000..693da49f --- /dev/null +++ b/libs/interchain-query/src/google/api/annotations.ts @@ -0,0 +1 @@ +export {} \ No newline at end of file diff --git a/libs/interchain-query/src/google/api/http.ts b/libs/interchain-query/src/google/api/http.ts new file mode 100644 index 00000000..d990263c --- /dev/null +++ b/libs/interchain-query/src/google/api/http.ts @@ -0,0 +1,1085 @@ +import { BinaryReader, BinaryWriter } from "../../binary"; +import { DeepPartial } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; +/** + * Defines the HTTP configuration for an API service. It contains a list of + * [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method + * to one or more HTTP REST API methods. + */ +export interface Http { + /** + * A list of HTTP configuration rules that apply to individual API methods. + * + * **NOTE:** All service configuration rules follow "last one wins" order. + */ + rules: HttpRule[]; + /** + * When set to true, URL path parameters will be fully URI-decoded except in + * cases of single segment matches in reserved expansion, where "%2F" will be + * left encoded. + * + * The default behavior is to not decode RFC 6570 reserved characters in multi + * segment matches. + */ + fullyDecodeReservedExpansion: boolean; +} +export interface HttpProtoMsg { + typeUrl: "/google.api.Http"; + value: Uint8Array; +} +/** + * Defines the HTTP configuration for an API service. It contains a list of + * [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method + * to one or more HTTP REST API methods. + */ +export interface HttpAmino { + /** + * A list of HTTP configuration rules that apply to individual API methods. + * + * **NOTE:** All service configuration rules follow "last one wins" order. + */ + rules: HttpRuleAmino[]; + /** + * When set to true, URL path parameters will be fully URI-decoded except in + * cases of single segment matches in reserved expansion, where "%2F" will be + * left encoded. + * + * The default behavior is to not decode RFC 6570 reserved characters in multi + * segment matches. + */ + fully_decode_reserved_expansion: boolean; +} +export interface HttpAminoMsg { + type: "/google.api.Http"; + value: HttpAmino; +} +/** + * # gRPC Transcoding + * + * gRPC Transcoding is a feature for mapping between a gRPC method and one or + * more HTTP REST endpoints. It allows developers to build a single API service + * that supports both gRPC APIs and REST APIs. Many systems, including [Google + * APIs](https://github.com/googleapis/googleapis), + * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC + * Gateway](https://github.com/grpc-ecosystem/grpc-gateway), + * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature + * and use it for large scale production services. + * + * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies + * how different portions of the gRPC request message are mapped to the URL + * path, URL query parameters, and HTTP request body. It also controls how the + * gRPC response message is mapped to the HTTP response body. `HttpRule` is + * typically specified as an `google.api.http` annotation on the gRPC method. + * + * Each mapping specifies a URL path template and an HTTP method. The path + * template may refer to one or more fields in the gRPC request message, as long + * as each field is a non-repeated field with a primitive (non-message) type. + * The path template controls how fields of the request message are mapped to + * the URL path. + * + * Example: + * + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http) = { + * get: "/v1/{name=messages/*}" + * }; + * } + * } + * message GetMessageRequest { + * string name = 1; // Mapped to URL path. + * } + * message Message { + * string text = 1; // The resource content. + * } + * + * This enables an HTTP REST to gRPC mapping as below: + * + * HTTP | gRPC + * -----|----- + * `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")` + * + * Any fields in the request message which are not bound by the path template + * automatically become HTTP query parameters if there is no HTTP request body. + * For example: + * + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http) = { + * get:"/v1/messages/{message_id}" + * }; + * } + * } + * message GetMessageRequest { + * message SubMessage { + * string subfield = 1; + * } + * string message_id = 1; // Mapped to URL path. + * int64 revision = 2; // Mapped to URL query parameter `revision`. + * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. + * } + * + * This enables a HTTP JSON to RPC mapping as below: + * + * HTTP | gRPC + * -----|----- + * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | + * `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: + * "foo"))` + * + * Note that fields which are mapped to URL query parameters must have a + * primitive type or a repeated primitive type or a non-repeated message type. + * In the case of a repeated type, the parameter can be repeated in the URL + * as `...?param=A¶m=B`. In the case of a message type, each field of the + * message is mapped to a separate parameter, such as + * `...?foo.a=A&foo.b=B&foo.c=C`. + * + * For HTTP methods that allow a request body, the `body` field + * specifies the mapping. Consider a REST update method on the + * message resource collection: + * + * service Messaging { + * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { + * option (google.api.http) = { + * patch: "/v1/messages/{message_id}" + * body: "message" + * }; + * } + * } + * message UpdateMessageRequest { + * string message_id = 1; // mapped to the URL + * Message message = 2; // mapped to the body + * } + * + * The following HTTP JSON to RPC mapping is enabled, where the + * representation of the JSON in the request body is determined by + * protos JSON encoding: + * + * HTTP | gRPC + * -----|----- + * `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: + * "123456" message { text: "Hi!" })` + * + * The special name `*` can be used in the body mapping to define that + * every field not bound by the path template should be mapped to the + * request body. This enables the following alternative definition of + * the update method: + * + * service Messaging { + * rpc UpdateMessage(Message) returns (Message) { + * option (google.api.http) = { + * patch: "/v1/messages/{message_id}" + * body: "*" + * }; + * } + * } + * message Message { + * string message_id = 1; + * string text = 2; + * } + * + * + * The following HTTP JSON to RPC mapping is enabled: + * + * HTTP | gRPC + * -----|----- + * `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: + * "123456" text: "Hi!")` + * + * Note that when using `*` in the body mapping, it is not possible to + * have HTTP parameters, as all fields not bound by the path end in + * the body. This makes this option more rarely used in practice when + * defining REST APIs. The common usage of `*` is in custom methods + * which don't use the URL at all for transferring data. + * + * It is possible to define multiple HTTP methods for one RPC by using + * the `additional_bindings` option. Example: + * + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http) = { + * get: "/v1/messages/{message_id}" + * additional_bindings { + * get: "/v1/users/{user_id}/messages/{message_id}" + * } + * }; + * } + * } + * message GetMessageRequest { + * string message_id = 1; + * string user_id = 2; + * } + * + * This enables the following two alternative HTTP JSON to RPC mappings: + * + * HTTP | gRPC + * -----|----- + * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` + * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: + * "123456")` + * + * ## Rules for HTTP mapping + * + * 1. Leaf request fields (recursive expansion nested messages in the request + * message) are classified into three categories: + * - Fields referred by the path template. They are passed via the URL path. + * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They + * are passed via the HTTP + * request body. + * - All other fields are passed via the URL query parameters, and the + * parameter name is the field path in the request message. A repeated + * field can be represented as multiple query parameters under the same + * name. + * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL + * query parameter, all fields + * are passed via URL path and HTTP request body. + * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP + * request body, all + * fields are passed via URL path and URL query parameters. + * + * ### Path template syntax + * + * Template = "/" Segments [ Verb ] ; + * Segments = Segment { "/" Segment } ; + * Segment = "*" | "**" | LITERAL | Variable ; + * Variable = "{" FieldPath [ "=" Segments ] "}" ; + * FieldPath = IDENT { "." IDENT } ; + * Verb = ":" LITERAL ; + * + * The syntax `*` matches a single URL path segment. The syntax `**` matches + * zero or more URL path segments, which must be the last part of the URL path + * except the `Verb`. + * + * The syntax `Variable` matches part of the URL path as specified by its + * template. A variable template must not contain other variables. If a variable + * matches a single path segment, its template may be omitted, e.g. `{var}` + * is equivalent to `{var=*}`. + * + * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` + * contains any reserved character, such characters should be percent-encoded + * before the matching. + * + * If a variable contains exactly one path segment, such as `"{var}"` or + * `"{var=*}"`, when such a variable is expanded into a URL path on the client + * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The + * server side does the reverse decoding. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{var}`. + * + * If a variable contains multiple path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path on the + * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. + * The server side does the reverse decoding, except "%2F" and "%2f" are left + * unchanged. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{+var}`. + * + * ## Using gRPC API Service Configuration + * + * gRPC API Service Configuration (service config) is a configuration language + * for configuring a gRPC service to become a user-facing product. The + * service config is simply the YAML representation of the `google.api.Service` + * proto message. + * + * As an alternative to annotating your proto file, you can configure gRPC + * transcoding in your service config YAML files. You do this by specifying a + * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same + * effect as the proto annotation. This can be particularly useful if you + * have a proto that is reused in multiple services. Note that any transcoding + * specified in the service config will override any matching transcoding + * configuration in the proto. + * + * Example: + * + * http: + * rules: + * # Selects a gRPC method and applies HttpRule to it. + * - selector: example.v1.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * ## Special notes + * + * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + * proto to JSON conversion must follow the [proto3 + * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). + * + * While the single segment variable follows the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String + * Expansion, the multi segment variable **does not** follow RFC 6570 Section + * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion + * does not expand special characters like `?` and `#`, which would lead + * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding + * for multi segment variables. + * + * The path variables **must not** refer to any repeated or mapped field, + * because client libraries are not capable of handling such variable expansion. + * + * The path variables **must not** capture the leading "/" character. The reason + * is that the most common use case "{var}" does not capture the leading "/" + * character. For consistency, all path variables must share the same behavior. + * + * Repeated message fields must not be mapped to URL query parameters, because + * no client library can support such complicated mapping. + * + * If an API needs to use a JSON array for request or response body, it can map + * the request or response body to a repeated field. However, some gRPC + * Transcoding implementations may not support this feature. + */ +export interface HttpRule { + /** + * Selects a method to which this rule applies. + * + * Refer to [selector][google.api.DocumentationRule.selector] for syntax + * details. + */ + selector: string; + /** + * Maps to HTTP GET. Used for listing and getting information about + * resources. + */ + get?: string; + /** Maps to HTTP PUT. Used for replacing a resource. */ + put?: string; + /** Maps to HTTP POST. Used for creating a resource or performing an action. */ + post?: string; + /** Maps to HTTP DELETE. Used for deleting a resource. */ + delete?: string; + /** Maps to HTTP PATCH. Used for updating a resource. */ + patch?: string; + /** + * The custom pattern is used for specifying an HTTP method that is not + * included in the `pattern` field, such as HEAD, or "*" to leave the + * HTTP method unspecified for this rule. The wild-card rule is useful + * for services that provide content to Web (HTML) clients. + */ + custom?: CustomHttpPattern; + /** + * The name of the request field whose value is mapped to the HTTP request + * body, or `*` for mapping all request fields not captured by the path + * pattern to the HTTP body, or omitted for not having any HTTP request body. + * + * NOTE: the referred field must be present at the top-level of the request + * message type. + */ + body: string; + /** + * Optional. The name of the response field whose value is mapped to the HTTP + * response body. When omitted, the entire response message will be used + * as the HTTP response body. + * + * NOTE: The referred field must be present at the top-level of the response + * message type. + */ + responseBody: string; + /** + * Additional HTTP bindings for the selector. Nested bindings must + * not contain an `additional_bindings` field themselves (that is, + * the nesting may only be one level deep). + */ + additionalBindings: HttpRule[]; +} +export interface HttpRuleProtoMsg { + typeUrl: "/google.api.HttpRule"; + value: Uint8Array; +} +/** + * # gRPC Transcoding + * + * gRPC Transcoding is a feature for mapping between a gRPC method and one or + * more HTTP REST endpoints. It allows developers to build a single API service + * that supports both gRPC APIs and REST APIs. Many systems, including [Google + * APIs](https://github.com/googleapis/googleapis), + * [Cloud Endpoints](https://cloud.google.com/endpoints), [gRPC + * Gateway](https://github.com/grpc-ecosystem/grpc-gateway), + * and [Envoy](https://github.com/envoyproxy/envoy) proxy support this feature + * and use it for large scale production services. + * + * `HttpRule` defines the schema of the gRPC/REST mapping. The mapping specifies + * how different portions of the gRPC request message are mapped to the URL + * path, URL query parameters, and HTTP request body. It also controls how the + * gRPC response message is mapped to the HTTP response body. `HttpRule` is + * typically specified as an `google.api.http` annotation on the gRPC method. + * + * Each mapping specifies a URL path template and an HTTP method. The path + * template may refer to one or more fields in the gRPC request message, as long + * as each field is a non-repeated field with a primitive (non-message) type. + * The path template controls how fields of the request message are mapped to + * the URL path. + * + * Example: + * + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http) = { + * get: "/v1/{name=messages/*}" + * }; + * } + * } + * message GetMessageRequest { + * string name = 1; // Mapped to URL path. + * } + * message Message { + * string text = 1; // The resource content. + * } + * + * This enables an HTTP REST to gRPC mapping as below: + * + * HTTP | gRPC + * -----|----- + * `GET /v1/messages/123456` | `GetMessage(name: "messages/123456")` + * + * Any fields in the request message which are not bound by the path template + * automatically become HTTP query parameters if there is no HTTP request body. + * For example: + * + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http) = { + * get:"/v1/messages/{message_id}" + * }; + * } + * } + * message GetMessageRequest { + * message SubMessage { + * string subfield = 1; + * } + * string message_id = 1; // Mapped to URL path. + * int64 revision = 2; // Mapped to URL query parameter `revision`. + * SubMessage sub = 3; // Mapped to URL query parameter `sub.subfield`. + * } + * + * This enables a HTTP JSON to RPC mapping as below: + * + * HTTP | gRPC + * -----|----- + * `GET /v1/messages/123456?revision=2&sub.subfield=foo` | + * `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: + * "foo"))` + * + * Note that fields which are mapped to URL query parameters must have a + * primitive type or a repeated primitive type or a non-repeated message type. + * In the case of a repeated type, the parameter can be repeated in the URL + * as `...?param=A¶m=B`. In the case of a message type, each field of the + * message is mapped to a separate parameter, such as + * `...?foo.a=A&foo.b=B&foo.c=C`. + * + * For HTTP methods that allow a request body, the `body` field + * specifies the mapping. Consider a REST update method on the + * message resource collection: + * + * service Messaging { + * rpc UpdateMessage(UpdateMessageRequest) returns (Message) { + * option (google.api.http) = { + * patch: "/v1/messages/{message_id}" + * body: "message" + * }; + * } + * } + * message UpdateMessageRequest { + * string message_id = 1; // mapped to the URL + * Message message = 2; // mapped to the body + * } + * + * The following HTTP JSON to RPC mapping is enabled, where the + * representation of the JSON in the request body is determined by + * protos JSON encoding: + * + * HTTP | gRPC + * -----|----- + * `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: + * "123456" message { text: "Hi!" })` + * + * The special name `*` can be used in the body mapping to define that + * every field not bound by the path template should be mapped to the + * request body. This enables the following alternative definition of + * the update method: + * + * service Messaging { + * rpc UpdateMessage(Message) returns (Message) { + * option (google.api.http) = { + * patch: "/v1/messages/{message_id}" + * body: "*" + * }; + * } + * } + * message Message { + * string message_id = 1; + * string text = 2; + * } + * + * + * The following HTTP JSON to RPC mapping is enabled: + * + * HTTP | gRPC + * -----|----- + * `PATCH /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: + * "123456" text: "Hi!")` + * + * Note that when using `*` in the body mapping, it is not possible to + * have HTTP parameters, as all fields not bound by the path end in + * the body. This makes this option more rarely used in practice when + * defining REST APIs. The common usage of `*` is in custom methods + * which don't use the URL at all for transferring data. + * + * It is possible to define multiple HTTP methods for one RPC by using + * the `additional_bindings` option. Example: + * + * service Messaging { + * rpc GetMessage(GetMessageRequest) returns (Message) { + * option (google.api.http) = { + * get: "/v1/messages/{message_id}" + * additional_bindings { + * get: "/v1/users/{user_id}/messages/{message_id}" + * } + * }; + * } + * } + * message GetMessageRequest { + * string message_id = 1; + * string user_id = 2; + * } + * + * This enables the following two alternative HTTP JSON to RPC mappings: + * + * HTTP | gRPC + * -----|----- + * `GET /v1/messages/123456` | `GetMessage(message_id: "123456")` + * `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: + * "123456")` + * + * ## Rules for HTTP mapping + * + * 1. Leaf request fields (recursive expansion nested messages in the request + * message) are classified into three categories: + * - Fields referred by the path template. They are passed via the URL path. + * - Fields referred by the [HttpRule.body][google.api.HttpRule.body]. They + * are passed via the HTTP + * request body. + * - All other fields are passed via the URL query parameters, and the + * parameter name is the field path in the request message. A repeated + * field can be represented as multiple query parameters under the same + * name. + * 2. If [HttpRule.body][google.api.HttpRule.body] is "*", there is no URL + * query parameter, all fields + * are passed via URL path and HTTP request body. + * 3. If [HttpRule.body][google.api.HttpRule.body] is omitted, there is no HTTP + * request body, all + * fields are passed via URL path and URL query parameters. + * + * ### Path template syntax + * + * Template = "/" Segments [ Verb ] ; + * Segments = Segment { "/" Segment } ; + * Segment = "*" | "**" | LITERAL | Variable ; + * Variable = "{" FieldPath [ "=" Segments ] "}" ; + * FieldPath = IDENT { "." IDENT } ; + * Verb = ":" LITERAL ; + * + * The syntax `*` matches a single URL path segment. The syntax `**` matches + * zero or more URL path segments, which must be the last part of the URL path + * except the `Verb`. + * + * The syntax `Variable` matches part of the URL path as specified by its + * template. A variable template must not contain other variables. If a variable + * matches a single path segment, its template may be omitted, e.g. `{var}` + * is equivalent to `{var=*}`. + * + * The syntax `LITERAL` matches literal text in the URL path. If the `LITERAL` + * contains any reserved character, such characters should be percent-encoded + * before the matching. + * + * If a variable contains exactly one path segment, such as `"{var}"` or + * `"{var=*}"`, when such a variable is expanded into a URL path on the client + * side, all characters except `[-_.~0-9a-zA-Z]` are percent-encoded. The + * server side does the reverse decoding. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{var}`. + * + * If a variable contains multiple path segments, such as `"{var=foo/*}"` + * or `"{var=**}"`, when such a variable is expanded into a URL path on the + * client side, all characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. + * The server side does the reverse decoding, except "%2F" and "%2f" are left + * unchanged. Such variables show up in the + * [Discovery + * Document](https://developers.google.com/discovery/v1/reference/apis) as + * `{+var}`. + * + * ## Using gRPC API Service Configuration + * + * gRPC API Service Configuration (service config) is a configuration language + * for configuring a gRPC service to become a user-facing product. The + * service config is simply the YAML representation of the `google.api.Service` + * proto message. + * + * As an alternative to annotating your proto file, you can configure gRPC + * transcoding in your service config YAML files. You do this by specifying a + * `HttpRule` that maps the gRPC method to a REST endpoint, achieving the same + * effect as the proto annotation. This can be particularly useful if you + * have a proto that is reused in multiple services. Note that any transcoding + * specified in the service config will override any matching transcoding + * configuration in the proto. + * + * Example: + * + * http: + * rules: + * # Selects a gRPC method and applies HttpRule to it. + * - selector: example.v1.Messaging.GetMessage + * get: /v1/messages/{message_id}/{sub.subfield} + * + * ## Special notes + * + * When gRPC Transcoding is used to map a gRPC to JSON REST endpoints, the + * proto to JSON conversion must follow the [proto3 + * specification](https://developers.google.com/protocol-buffers/docs/proto3#json). + * + * While the single segment variable follows the semantics of + * [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2 Simple String + * Expansion, the multi segment variable **does not** follow RFC 6570 Section + * 3.2.3 Reserved Expansion. The reason is that the Reserved Expansion + * does not expand special characters like `?` and `#`, which would lead + * to invalid URLs. As the result, gRPC Transcoding uses a custom encoding + * for multi segment variables. + * + * The path variables **must not** refer to any repeated or mapped field, + * because client libraries are not capable of handling such variable expansion. + * + * The path variables **must not** capture the leading "/" character. The reason + * is that the most common use case "{var}" does not capture the leading "/" + * character. For consistency, all path variables must share the same behavior. + * + * Repeated message fields must not be mapped to URL query parameters, because + * no client library can support such complicated mapping. + * + * If an API needs to use a JSON array for request or response body, it can map + * the request or response body to a repeated field. However, some gRPC + * Transcoding implementations may not support this feature. + */ +export interface HttpRuleAmino { + /** + * Selects a method to which this rule applies. + * + * Refer to [selector][google.api.DocumentationRule.selector] for syntax + * details. + */ + selector: string; + /** + * Maps to HTTP GET. Used for listing and getting information about + * resources. + */ + get?: string; + /** Maps to HTTP PUT. Used for replacing a resource. */ + put?: string; + /** Maps to HTTP POST. Used for creating a resource or performing an action. */ + post?: string; + /** Maps to HTTP DELETE. Used for deleting a resource. */ + delete?: string; + /** Maps to HTTP PATCH. Used for updating a resource. */ + patch?: string; + /** + * The custom pattern is used for specifying an HTTP method that is not + * included in the `pattern` field, such as HEAD, or "*" to leave the + * HTTP method unspecified for this rule. The wild-card rule is useful + * for services that provide content to Web (HTML) clients. + */ + custom?: CustomHttpPatternAmino; + /** + * The name of the request field whose value is mapped to the HTTP request + * body, or `*` for mapping all request fields not captured by the path + * pattern to the HTTP body, or omitted for not having any HTTP request body. + * + * NOTE: the referred field must be present at the top-level of the request + * message type. + */ + body: string; + /** + * Optional. The name of the response field whose value is mapped to the HTTP + * response body. When omitted, the entire response message will be used + * as the HTTP response body. + * + * NOTE: The referred field must be present at the top-level of the response + * message type. + */ + response_body: string; + /** + * Additional HTTP bindings for the selector. Nested bindings must + * not contain an `additional_bindings` field themselves (that is, + * the nesting may only be one level deep). + */ + additional_bindings: HttpRuleAmino[]; +} +export interface HttpRuleAminoMsg { + type: "/google.api.HttpRule"; + value: HttpRuleAmino; +} +/** A custom pattern is used for defining custom HTTP verb. */ +export interface CustomHttpPattern { + /** The name of this custom HTTP verb. */ + kind: string; + /** The path matched by this custom verb. */ + path: string; +} +export interface CustomHttpPatternProtoMsg { + typeUrl: "/google.api.CustomHttpPattern"; + value: Uint8Array; +} +/** A custom pattern is used for defining custom HTTP verb. */ +export interface CustomHttpPatternAmino { + /** The name of this custom HTTP verb. */ + kind: string; + /** The path matched by this custom verb. */ + path: string; +} +export interface CustomHttpPatternAminoMsg { + type: "/google.api.CustomHttpPattern"; + value: CustomHttpPatternAmino; +} +function createBaseHttp(): Http { + return { + rules: [], + fullyDecodeReservedExpansion: false + }; +} +export const Http = { + typeUrl: "/google.api.Http", + is(o: any): o is Http { + return o && (o.$typeUrl === Http.typeUrl || Array.isArray(o.rules) && (!o.rules.length || HttpRule.is(o.rules[0])) && typeof o.fullyDecodeReservedExpansion === "boolean"); + }, + isAmino(o: any): o is HttpAmino { + return o && (o.$typeUrl === Http.typeUrl || Array.isArray(o.rules) && (!o.rules.length || HttpRule.isAmino(o.rules[0])) && typeof o.fully_decode_reserved_expansion === "boolean"); + }, + encode(message: Http, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.rules) { + HttpRule.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.fullyDecodeReservedExpansion === true) { + writer.uint32(16).bool(message.fullyDecodeReservedExpansion); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Http { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHttp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.rules.push(HttpRule.decode(reader, reader.uint32())); + break; + case 2: + message.fullyDecodeReservedExpansion = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Http { + const message = createBaseHttp(); + message.rules = object.rules?.map(e => HttpRule.fromPartial(e)) || []; + message.fullyDecodeReservedExpansion = object.fullyDecodeReservedExpansion ?? false; + return message; + }, + fromAmino(object: HttpAmino): Http { + const message = createBaseHttp(); + message.rules = object.rules?.map(e => HttpRule.fromAmino(e)) || []; + if (object.fully_decode_reserved_expansion !== undefined && object.fully_decode_reserved_expansion !== null) { + message.fullyDecodeReservedExpansion = object.fully_decode_reserved_expansion; + } + return message; + }, + toAmino(message: Http): HttpAmino { + const obj: any = {}; + if (message.rules) { + obj.rules = message.rules.map(e => e ? HttpRule.toAmino(e) : undefined); + } else { + obj.rules = message.rules; + } + obj.fully_decode_reserved_expansion = message.fullyDecodeReservedExpansion === false ? undefined : message.fullyDecodeReservedExpansion; + return obj; + }, + fromAminoMsg(object: HttpAminoMsg): Http { + return Http.fromAmino(object.value); + }, + fromProtoMsg(message: HttpProtoMsg): Http { + return Http.decode(message.value); + }, + toProto(message: Http): Uint8Array { + return Http.encode(message).finish(); + }, + toProtoMsg(message: Http): HttpProtoMsg { + return { + typeUrl: "/google.api.Http", + value: Http.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Http.typeUrl, Http); +function createBaseHttpRule(): HttpRule { + return { + selector: "", + get: undefined, + put: undefined, + post: undefined, + delete: undefined, + patch: undefined, + custom: undefined, + body: "", + responseBody: "", + additionalBindings: [] + }; +} +export const HttpRule = { + typeUrl: "/google.api.HttpRule", + is(o: any): o is HttpRule { + return o && (o.$typeUrl === HttpRule.typeUrl || typeof o.selector === "string" && typeof o.body === "string" && typeof o.responseBody === "string" && Array.isArray(o.additionalBindings) && (!o.additionalBindings.length || HttpRule.is(o.additionalBindings[0]))); + }, + isAmino(o: any): o is HttpRuleAmino { + return o && (o.$typeUrl === HttpRule.typeUrl || typeof o.selector === "string" && typeof o.body === "string" && typeof o.response_body === "string" && Array.isArray(o.additional_bindings) && (!o.additional_bindings.length || HttpRule.isAmino(o.additional_bindings[0]))); + }, + encode(message: HttpRule, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.selector !== "") { + writer.uint32(10).string(message.selector); + } + if (message.get !== undefined) { + writer.uint32(18).string(message.get); + } + if (message.put !== undefined) { + writer.uint32(26).string(message.put); + } + if (message.post !== undefined) { + writer.uint32(34).string(message.post); + } + if (message.delete !== undefined) { + writer.uint32(42).string(message.delete); + } + if (message.patch !== undefined) { + writer.uint32(50).string(message.patch); + } + if (message.custom !== undefined) { + CustomHttpPattern.encode(message.custom, writer.uint32(66).fork()).ldelim(); + } + if (message.body !== "") { + writer.uint32(58).string(message.body); + } + if (message.responseBody !== "") { + writer.uint32(98).string(message.responseBody); + } + for (const v of message.additionalBindings) { + HttpRule.encode(v!, writer.uint32(90).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): HttpRule { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHttpRule(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.selector = reader.string(); + break; + case 2: + message.get = reader.string(); + break; + case 3: + message.put = reader.string(); + break; + case 4: + message.post = reader.string(); + break; + case 5: + message.delete = reader.string(); + break; + case 6: + message.patch = reader.string(); + break; + case 8: + message.custom = CustomHttpPattern.decode(reader, reader.uint32()); + break; + case 7: + message.body = reader.string(); + break; + case 12: + message.responseBody = reader.string(); + break; + case 11: + message.additionalBindings.push(HttpRule.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): HttpRule { + const message = createBaseHttpRule(); + message.selector = object.selector ?? ""; + message.get = object.get ?? undefined; + message.put = object.put ?? undefined; + message.post = object.post ?? undefined; + message.delete = object.delete ?? undefined; + message.patch = object.patch ?? undefined; + message.custom = object.custom !== undefined && object.custom !== null ? CustomHttpPattern.fromPartial(object.custom) : undefined; + message.body = object.body ?? ""; + message.responseBody = object.responseBody ?? ""; + message.additionalBindings = object.additionalBindings?.map(e => HttpRule.fromPartial(e)) || []; + return message; + }, + fromAmino(object: HttpRuleAmino): HttpRule { + const message = createBaseHttpRule(); + if (object.selector !== undefined && object.selector !== null) { + message.selector = object.selector; + } + if (object.get !== undefined && object.get !== null) { + message.get = object.get; + } + if (object.put !== undefined && object.put !== null) { + message.put = object.put; + } + if (object.post !== undefined && object.post !== null) { + message.post = object.post; + } + if (object.delete !== undefined && object.delete !== null) { + message.delete = object.delete; + } + if (object.patch !== undefined && object.patch !== null) { + message.patch = object.patch; + } + if (object.custom !== undefined && object.custom !== null) { + message.custom = CustomHttpPattern.fromAmino(object.custom); + } + if (object.body !== undefined && object.body !== null) { + message.body = object.body; + } + if (object.response_body !== undefined && object.response_body !== null) { + message.responseBody = object.response_body; + } + message.additionalBindings = object.additional_bindings?.map(e => HttpRule.fromAmino(e)) || []; + return message; + }, + toAmino(message: HttpRule): HttpRuleAmino { + const obj: any = {}; + obj.selector = message.selector === "" ? undefined : message.selector; + obj.get = message.get === null ? undefined : message.get; + obj.put = message.put === null ? undefined : message.put; + obj.post = message.post === null ? undefined : message.post; + obj.delete = message.delete === null ? undefined : message.delete; + obj.patch = message.patch === null ? undefined : message.patch; + obj.custom = message.custom ? CustomHttpPattern.toAmino(message.custom) : undefined; + obj.body = message.body === "" ? undefined : message.body; + obj.response_body = message.responseBody === "" ? undefined : message.responseBody; + if (message.additionalBindings) { + obj.additional_bindings = message.additionalBindings.map(e => e ? HttpRule.toAmino(e) : undefined); + } else { + obj.additional_bindings = message.additionalBindings; + } + return obj; + }, + fromAminoMsg(object: HttpRuleAminoMsg): HttpRule { + return HttpRule.fromAmino(object.value); + }, + fromProtoMsg(message: HttpRuleProtoMsg): HttpRule { + return HttpRule.decode(message.value); + }, + toProto(message: HttpRule): Uint8Array { + return HttpRule.encode(message).finish(); + }, + toProtoMsg(message: HttpRule): HttpRuleProtoMsg { + return { + typeUrl: "/google.api.HttpRule", + value: HttpRule.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(HttpRule.typeUrl, HttpRule); +function createBaseCustomHttpPattern(): CustomHttpPattern { + return { + kind: "", + path: "" + }; +} +export const CustomHttpPattern = { + typeUrl: "/google.api.CustomHttpPattern", + is(o: any): o is CustomHttpPattern { + return o && (o.$typeUrl === CustomHttpPattern.typeUrl || typeof o.kind === "string" && typeof o.path === "string"); + }, + isAmino(o: any): o is CustomHttpPatternAmino { + return o && (o.$typeUrl === CustomHttpPattern.typeUrl || typeof o.kind === "string" && typeof o.path === "string"); + }, + encode(message: CustomHttpPattern, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.kind !== "") { + writer.uint32(10).string(message.kind); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): CustomHttpPattern { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCustomHttpPattern(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.kind = reader.string(); + break; + case 2: + message.path = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): CustomHttpPattern { + const message = createBaseCustomHttpPattern(); + message.kind = object.kind ?? ""; + message.path = object.path ?? ""; + return message; + }, + fromAmino(object: CustomHttpPatternAmino): CustomHttpPattern { + const message = createBaseCustomHttpPattern(); + if (object.kind !== undefined && object.kind !== null) { + message.kind = object.kind; + } + if (object.path !== undefined && object.path !== null) { + message.path = object.path; + } + return message; + }, + toAmino(message: CustomHttpPattern): CustomHttpPatternAmino { + const obj: any = {}; + obj.kind = message.kind === "" ? undefined : message.kind; + obj.path = message.path === "" ? undefined : message.path; + return obj; + }, + fromAminoMsg(object: CustomHttpPatternAminoMsg): CustomHttpPattern { + return CustomHttpPattern.fromAmino(object.value); + }, + fromProtoMsg(message: CustomHttpPatternProtoMsg): CustomHttpPattern { + return CustomHttpPattern.decode(message.value); + }, + toProto(message: CustomHttpPattern): Uint8Array { + return CustomHttpPattern.encode(message).finish(); + }, + toProtoMsg(message: CustomHttpPattern): CustomHttpPatternProtoMsg { + return { + typeUrl: "/google.api.CustomHttpPattern", + value: CustomHttpPattern.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(CustomHttpPattern.typeUrl, CustomHttpPattern); \ No newline at end of file diff --git a/libs/interchain-query/src/google/protobuf/any.ts b/libs/interchain-query/src/google/protobuf/any.ts new file mode 100644 index 00000000..bbae1be1 --- /dev/null +++ b/libs/interchain-query/src/google/protobuf/any.ts @@ -0,0 +1,331 @@ +import { BinaryReader, BinaryWriter } from "../../binary"; +import { DeepPartial } from "../../helpers"; +/** + * `Any` contains an arbitrary serialized protocol buffer message along with a + * URL that describes the type of the serialized message. + * + * Protobuf library provides support to pack/unpack Any values in the form + * of utility functions or additional generated methods of the Any type. + * + * Example 1: Pack and unpack a message in C++. + * + * Foo foo = ...; + * Any any; + * any.PackFrom(foo); + * ... + * if (any.UnpackTo(&foo)) { + * ... + * } + * + * Example 2: Pack and unpack a message in Java. + * + * Foo foo = ...; + * Any any = Any.pack(foo); + * ... + * if (any.is(Foo.class)) { + * foo = any.unpack(Foo.class); + * } + * // or ... + * if (any.isSameTypeAs(Foo.getDefaultInstance())) { + * foo = any.unpack(Foo.getDefaultInstance()); + * } + * + * Example 3: Pack and unpack a message in Python. + * + * foo = Foo(...) + * any = Any() + * any.Pack(foo) + * ... + * if any.Is(Foo.DESCRIPTOR): + * any.Unpack(foo) + * ... + * + * Example 4: Pack and unpack a message in Go + * + * foo := &pb.Foo{...} + * any, err := anypb.New(foo) + * if err != nil { + * ... + * } + * ... + * foo := &pb.Foo{} + * if err := any.UnmarshalTo(foo); err != nil { + * ... + * } + * + * The pack methods provided by protobuf library will by default use + * 'type.googleapis.com/full.type.name' as the type URL and the unpack + * methods only use the fully qualified type name after the last '/' + * in the type URL, for example "foo.bar.com/x/y.z" will yield type + * name "y.z". + * + * JSON + * ==== + * The JSON representation of an `Any` value uses the regular + * representation of the deserialized, embedded message, with an + * additional field `@type` which contains the type URL. Example: + * + * package google.profile; + * message Person { + * string first_name = 1; + * string last_name = 2; + * } + * + * { + * "@type": "type.googleapis.com/google.profile.Person", + * "firstName": , + * "lastName": + * } + * + * If the embedded message type is well-known and has a custom JSON + * representation, that representation will be embedded adding a field + * `value` which holds the custom JSON in addition to the `@type` + * field. Example (for message [google.protobuf.Duration][]): + * + * { + * "@type": "type.googleapis.com/google.protobuf.Duration", + * "value": "1.212s" + * } + */ +export interface Any { + /** + * A URL/resource name that uniquely identifies the type of the serialized + * protocol buffer message. This string must contain at least + * one "/" character. The last segment of the URL's path must represent + * the fully qualified name of the type (as in + * `path/google.protobuf.Duration`). The name should be in a canonical form + * (e.g., leading "." is not accepted). + * + * In practice, teams usually precompile into the binary all types that they + * expect it to use in the context of Any. However, for URLs which use the + * scheme `http`, `https`, or no scheme, one can optionally set up a type + * server that maps type URLs to message definitions as follows: + * + * * If no scheme is provided, `https` is assumed. + * * An HTTP GET on the URL must yield a [google.protobuf.Type][] + * value in binary format, or produce an error. + * * Applications are allowed to cache lookup results based on the + * URL, or have them precompiled into a binary to avoid any + * lookup. Therefore, binary compatibility needs to be preserved + * on changes to types. (Use versioned type names to manage + * breaking changes.) + * + * Note: this functionality is not currently available in the official + * protobuf release, and it is not used for type URLs beginning with + * type.googleapis.com. As of May 2023, there are no widely used type server + * implementations and no plans to implement one. + * + * Schemes other than `http`, `https` (or the empty scheme) might be + * used with implementation specific semantics. + */ + typeUrl: string; + /** Must be a valid serialized protocol buffer of the above specified type. */ + value: Uint8Array; +} +export interface AnyProtoMsg { + typeUrl: "/google.protobuf.Any"; + value: Uint8Array; +} +/** + * `Any` contains an arbitrary serialized protocol buffer message along with a + * URL that describes the type of the serialized message. + * + * Protobuf library provides support to pack/unpack Any values in the form + * of utility functions or additional generated methods of the Any type. + * + * Example 1: Pack and unpack a message in C++. + * + * Foo foo = ...; + * Any any; + * any.PackFrom(foo); + * ... + * if (any.UnpackTo(&foo)) { + * ... + * } + * + * Example 2: Pack and unpack a message in Java. + * + * Foo foo = ...; + * Any any = Any.pack(foo); + * ... + * if (any.is(Foo.class)) { + * foo = any.unpack(Foo.class); + * } + * // or ... + * if (any.isSameTypeAs(Foo.getDefaultInstance())) { + * foo = any.unpack(Foo.getDefaultInstance()); + * } + * + * Example 3: Pack and unpack a message in Python. + * + * foo = Foo(...) + * any = Any() + * any.Pack(foo) + * ... + * if any.Is(Foo.DESCRIPTOR): + * any.Unpack(foo) + * ... + * + * Example 4: Pack and unpack a message in Go + * + * foo := &pb.Foo{...} + * any, err := anypb.New(foo) + * if err != nil { + * ... + * } + * ... + * foo := &pb.Foo{} + * if err := any.UnmarshalTo(foo); err != nil { + * ... + * } + * + * The pack methods provided by protobuf library will by default use + * 'type.googleapis.com/full.type.name' as the type URL and the unpack + * methods only use the fully qualified type name after the last '/' + * in the type URL, for example "foo.bar.com/x/y.z" will yield type + * name "y.z". + * + * JSON + * ==== + * The JSON representation of an `Any` value uses the regular + * representation of the deserialized, embedded message, with an + * additional field `@type` which contains the type URL. Example: + * + * package google.profile; + * message Person { + * string first_name = 1; + * string last_name = 2; + * } + * + * { + * "@type": "type.googleapis.com/google.profile.Person", + * "firstName": , + * "lastName": + * } + * + * If the embedded message type is well-known and has a custom JSON + * representation, that representation will be embedded adding a field + * `value` which holds the custom JSON in addition to the `@type` + * field. Example (for message [google.protobuf.Duration][]): + * + * { + * "@type": "type.googleapis.com/google.protobuf.Duration", + * "value": "1.212s" + * } + */ +export interface AnyAmino { + /** + * A URL/resource name that uniquely identifies the type of the serialized + * protocol buffer message. This string must contain at least + * one "/" character. The last segment of the URL's path must represent + * the fully qualified name of the type (as in + * `path/google.protobuf.Duration`). The name should be in a canonical form + * (e.g., leading "." is not accepted). + * + * In practice, teams usually precompile into the binary all types that they + * expect it to use in the context of Any. However, for URLs which use the + * scheme `http`, `https`, or no scheme, one can optionally set up a type + * server that maps type URLs to message definitions as follows: + * + * * If no scheme is provided, `https` is assumed. + * * An HTTP GET on the URL must yield a [google.protobuf.Type][] + * value in binary format, or produce an error. + * * Applications are allowed to cache lookup results based on the + * URL, or have them precompiled into a binary to avoid any + * lookup. Therefore, binary compatibility needs to be preserved + * on changes to types. (Use versioned type names to manage + * breaking changes.) + * + * Note: this functionality is not currently available in the official + * protobuf release, and it is not used for type URLs beginning with + * type.googleapis.com. As of May 2023, there are no widely used type server + * implementations and no plans to implement one. + * + * Schemes other than `http`, `https` (or the empty scheme) might be + * used with implementation specific semantics. + */ + type: string; + /** Must be a valid serialized protocol buffer of the above specified type. */ + value: any; +} +export interface AnyAminoMsg { + type: string; + value: AnyAmino; +} +function createBaseAny(): Any { + return { + typeUrl: "", + value: new Uint8Array() + }; +} +export const Any = { + typeUrl: "/google.protobuf.Any", + is(o: any): o is Any { + return o && (o.$typeUrl === Any.typeUrl || typeof o.typeUrl === "string" && (o.value instanceof Uint8Array || typeof o.value === "string")); + }, + isAmino(o: any): o is AnyAmino { + return o && (o.$typeUrl === Any.typeUrl || typeof o.type === "string" && (o.value instanceof Uint8Array || typeof o.value === "string")); + }, + encode(message: Any, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.typeUrl !== "") { + writer.uint32(10).string(message.typeUrl); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Any { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAny(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.typeUrl = reader.string(); + break; + case 2: + message.value = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Any { + const message = createBaseAny(); + message.typeUrl = object.typeUrl ?? ""; + message.value = object.value ?? new Uint8Array(); + return message; + }, + fromAmino(object: AnyAmino): Any { + return { + typeUrl: object.type, + value: object.value + }; + }, + toAmino(message: Any): AnyAmino { + const obj: any = {}; + obj.type = message.typeUrl; + obj.value = message.value; + return obj; + }, + fromAminoMsg(object: AnyAminoMsg): Any { + return Any.fromAmino(object.value); + }, + fromProtoMsg(message: AnyProtoMsg): Any { + return Any.decode(message.value); + }, + toProto(message: Any): Uint8Array { + return Any.encode(message).finish(); + }, + toProtoMsg(message: Any): AnyProtoMsg { + return { + typeUrl: "/google.protobuf.Any", + value: Any.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/libs/interchain-query/src/google/protobuf/descriptor.ts b/libs/interchain-query/src/google/protobuf/descriptor.ts new file mode 100644 index 00000000..48e84349 --- /dev/null +++ b/libs/interchain-query/src/google/protobuf/descriptor.ts @@ -0,0 +1,7068 @@ +import { BinaryReader, BinaryWriter } from "../../binary"; +import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; +/** The full set of known editions. */ +export enum Edition { + /** EDITION_UNKNOWN - A placeholder for an unknown edition value. */ + EDITION_UNKNOWN = 0, + /** + * EDITION_LEGACY - A placeholder edition for specifying default behaviors *before* a feature + * was first introduced. This is effectively an "infinite past". + */ + EDITION_LEGACY = 900, + /** + * EDITION_PROTO2 - Legacy syntax "editions". These pre-date editions, but behave much like + * distinct editions. These can't be used to specify the edition of proto + * files, but feature definitions must supply proto2/proto3 defaults for + * backwards compatibility. + */ + EDITION_PROTO2 = 998, + EDITION_PROTO3 = 999, + /** + * EDITION_2023 - Editions that have been released. The specific values are arbitrary and + * should not be depended on, but they will always be time-ordered for easy + * comparison. + */ + EDITION_2023 = 1000, + EDITION_2024 = 1001, + /** + * EDITION_1_TEST_ONLY - Placeholder editions for testing feature resolution. These should not be + * used or relyed on outside of tests. + */ + EDITION_1_TEST_ONLY = 1, + EDITION_2_TEST_ONLY = 2, + EDITION_99997_TEST_ONLY = 99997, + EDITION_99998_TEST_ONLY = 99998, + EDITION_99999_TEST_ONLY = 99999, + /** + * EDITION_MAX - Placeholder for specifying unbounded edition support. This should only + * ever be used by plugins that can expect to never require any changes to + * support a new edition. + */ + EDITION_MAX = 2147483647, + UNRECOGNIZED = -1, +} +export const EditionAmino = Edition; +export function editionFromJSON(object: any): Edition { + switch (object) { + case 0: + case "EDITION_UNKNOWN": + return Edition.EDITION_UNKNOWN; + case 900: + case "EDITION_LEGACY": + return Edition.EDITION_LEGACY; + case 998: + case "EDITION_PROTO2": + return Edition.EDITION_PROTO2; + case 999: + case "EDITION_PROTO3": + return Edition.EDITION_PROTO3; + case 1000: + case "EDITION_2023": + return Edition.EDITION_2023; + case 1001: + case "EDITION_2024": + return Edition.EDITION_2024; + case 1: + case "EDITION_1_TEST_ONLY": + return Edition.EDITION_1_TEST_ONLY; + case 2: + case "EDITION_2_TEST_ONLY": + return Edition.EDITION_2_TEST_ONLY; + case 99997: + case "EDITION_99997_TEST_ONLY": + return Edition.EDITION_99997_TEST_ONLY; + case 99998: + case "EDITION_99998_TEST_ONLY": + return Edition.EDITION_99998_TEST_ONLY; + case 99999: + case "EDITION_99999_TEST_ONLY": + return Edition.EDITION_99999_TEST_ONLY; + case 2147483647: + case "EDITION_MAX": + return Edition.EDITION_MAX; + case -1: + case "UNRECOGNIZED": + default: + return Edition.UNRECOGNIZED; + } +} +export function editionToJSON(object: Edition): string { + switch (object) { + case Edition.EDITION_UNKNOWN: + return "EDITION_UNKNOWN"; + case Edition.EDITION_LEGACY: + return "EDITION_LEGACY"; + case Edition.EDITION_PROTO2: + return "EDITION_PROTO2"; + case Edition.EDITION_PROTO3: + return "EDITION_PROTO3"; + case Edition.EDITION_2023: + return "EDITION_2023"; + case Edition.EDITION_2024: + return "EDITION_2024"; + case Edition.EDITION_1_TEST_ONLY: + return "EDITION_1_TEST_ONLY"; + case Edition.EDITION_2_TEST_ONLY: + return "EDITION_2_TEST_ONLY"; + case Edition.EDITION_99997_TEST_ONLY: + return "EDITION_99997_TEST_ONLY"; + case Edition.EDITION_99998_TEST_ONLY: + return "EDITION_99998_TEST_ONLY"; + case Edition.EDITION_99999_TEST_ONLY: + return "EDITION_99999_TEST_ONLY"; + case Edition.EDITION_MAX: + return "EDITION_MAX"; + case Edition.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** The verification state of the extension range. */ +export enum ExtensionRangeOptions_VerificationState { + /** DECLARATION - All the extensions of the range must be declared. */ + DECLARATION = 0, + UNVERIFIED = 1, + UNRECOGNIZED = -1, +} +export const ExtensionRangeOptions_VerificationStateAmino = ExtensionRangeOptions_VerificationState; +export function extensionRangeOptions_VerificationStateFromJSON(object: any): ExtensionRangeOptions_VerificationState { + switch (object) { + case 0: + case "DECLARATION": + return ExtensionRangeOptions_VerificationState.DECLARATION; + case 1: + case "UNVERIFIED": + return ExtensionRangeOptions_VerificationState.UNVERIFIED; + case -1: + case "UNRECOGNIZED": + default: + return ExtensionRangeOptions_VerificationState.UNRECOGNIZED; + } +} +export function extensionRangeOptions_VerificationStateToJSON(object: ExtensionRangeOptions_VerificationState): string { + switch (object) { + case ExtensionRangeOptions_VerificationState.DECLARATION: + return "DECLARATION"; + case ExtensionRangeOptions_VerificationState.UNVERIFIED: + return "UNVERIFIED"; + case ExtensionRangeOptions_VerificationState.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export enum FieldDescriptorProto_Type { + /** + * TYPE_DOUBLE - 0 is reserved for errors. + * Order is weird for historical reasons. + */ + TYPE_DOUBLE = 1, + TYPE_FLOAT = 2, + /** + * TYPE_INT64 - Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if + * negative values are likely. + */ + TYPE_INT64 = 3, + TYPE_UINT64 = 4, + /** + * TYPE_INT32 - Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if + * negative values are likely. + */ + TYPE_INT32 = 5, + TYPE_FIXED64 = 6, + TYPE_FIXED32 = 7, + TYPE_BOOL = 8, + TYPE_STRING = 9, + /** + * TYPE_GROUP - Tag-delimited aggregate. + * Group type is deprecated and not supported after google.protobuf. However, Proto3 + * implementations should still be able to parse the group wire format and + * treat group fields as unknown fields. In Editions, the group wire format + * can be enabled via the `message_encoding` feature. + */ + TYPE_GROUP = 10, + /** TYPE_MESSAGE - Length-delimited aggregate. */ + TYPE_MESSAGE = 11, + /** TYPE_BYTES - New in version 2. */ + TYPE_BYTES = 12, + TYPE_UINT32 = 13, + TYPE_ENUM = 14, + TYPE_SFIXED32 = 15, + TYPE_SFIXED64 = 16, + /** TYPE_SINT32 - Uses ZigZag encoding. */ + TYPE_SINT32 = 17, + /** TYPE_SINT64 - Uses ZigZag encoding. */ + TYPE_SINT64 = 18, + UNRECOGNIZED = -1, +} +export const FieldDescriptorProto_TypeAmino = FieldDescriptorProto_Type; +export function fieldDescriptorProto_TypeFromJSON(object: any): FieldDescriptorProto_Type { + switch (object) { + case 1: + case "TYPE_DOUBLE": + return FieldDescriptorProto_Type.TYPE_DOUBLE; + case 2: + case "TYPE_FLOAT": + return FieldDescriptorProto_Type.TYPE_FLOAT; + case 3: + case "TYPE_INT64": + return FieldDescriptorProto_Type.TYPE_INT64; + case 4: + case "TYPE_UINT64": + return FieldDescriptorProto_Type.TYPE_UINT64; + case 5: + case "TYPE_INT32": + return FieldDescriptorProto_Type.TYPE_INT32; + case 6: + case "TYPE_FIXED64": + return FieldDescriptorProto_Type.TYPE_FIXED64; + case 7: + case "TYPE_FIXED32": + return FieldDescriptorProto_Type.TYPE_FIXED32; + case 8: + case "TYPE_BOOL": + return FieldDescriptorProto_Type.TYPE_BOOL; + case 9: + case "TYPE_STRING": + return FieldDescriptorProto_Type.TYPE_STRING; + case 10: + case "TYPE_GROUP": + return FieldDescriptorProto_Type.TYPE_GROUP; + case 11: + case "TYPE_MESSAGE": + return FieldDescriptorProto_Type.TYPE_MESSAGE; + case 12: + case "TYPE_BYTES": + return FieldDescriptorProto_Type.TYPE_BYTES; + case 13: + case "TYPE_UINT32": + return FieldDescriptorProto_Type.TYPE_UINT32; + case 14: + case "TYPE_ENUM": + return FieldDescriptorProto_Type.TYPE_ENUM; + case 15: + case "TYPE_SFIXED32": + return FieldDescriptorProto_Type.TYPE_SFIXED32; + case 16: + case "TYPE_SFIXED64": + return FieldDescriptorProto_Type.TYPE_SFIXED64; + case 17: + case "TYPE_SINT32": + return FieldDescriptorProto_Type.TYPE_SINT32; + case 18: + case "TYPE_SINT64": + return FieldDescriptorProto_Type.TYPE_SINT64; + case -1: + case "UNRECOGNIZED": + default: + return FieldDescriptorProto_Type.UNRECOGNIZED; + } +} +export function fieldDescriptorProto_TypeToJSON(object: FieldDescriptorProto_Type): string { + switch (object) { + case FieldDescriptorProto_Type.TYPE_DOUBLE: + return "TYPE_DOUBLE"; + case FieldDescriptorProto_Type.TYPE_FLOAT: + return "TYPE_FLOAT"; + case FieldDescriptorProto_Type.TYPE_INT64: + return "TYPE_INT64"; + case FieldDescriptorProto_Type.TYPE_UINT64: + return "TYPE_UINT64"; + case FieldDescriptorProto_Type.TYPE_INT32: + return "TYPE_INT32"; + case FieldDescriptorProto_Type.TYPE_FIXED64: + return "TYPE_FIXED64"; + case FieldDescriptorProto_Type.TYPE_FIXED32: + return "TYPE_FIXED32"; + case FieldDescriptorProto_Type.TYPE_BOOL: + return "TYPE_BOOL"; + case FieldDescriptorProto_Type.TYPE_STRING: + return "TYPE_STRING"; + case FieldDescriptorProto_Type.TYPE_GROUP: + return "TYPE_GROUP"; + case FieldDescriptorProto_Type.TYPE_MESSAGE: + return "TYPE_MESSAGE"; + case FieldDescriptorProto_Type.TYPE_BYTES: + return "TYPE_BYTES"; + case FieldDescriptorProto_Type.TYPE_UINT32: + return "TYPE_UINT32"; + case FieldDescriptorProto_Type.TYPE_ENUM: + return "TYPE_ENUM"; + case FieldDescriptorProto_Type.TYPE_SFIXED32: + return "TYPE_SFIXED32"; + case FieldDescriptorProto_Type.TYPE_SFIXED64: + return "TYPE_SFIXED64"; + case FieldDescriptorProto_Type.TYPE_SINT32: + return "TYPE_SINT32"; + case FieldDescriptorProto_Type.TYPE_SINT64: + return "TYPE_SINT64"; + case FieldDescriptorProto_Type.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export enum FieldDescriptorProto_Label { + /** LABEL_OPTIONAL - 0 is reserved for errors */ + LABEL_OPTIONAL = 1, + LABEL_REPEATED = 3, + /** + * LABEL_REQUIRED - The required label is only allowed in google.protobuf. In proto3 and Editions + * it's explicitly prohibited. In Editions, the `field_presence` feature + * can be used to get this behavior. + */ + LABEL_REQUIRED = 2, + UNRECOGNIZED = -1, +} +export const FieldDescriptorProto_LabelAmino = FieldDescriptorProto_Label; +export function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptorProto_Label { + switch (object) { + case 1: + case "LABEL_OPTIONAL": + return FieldDescriptorProto_Label.LABEL_OPTIONAL; + case 3: + case "LABEL_REPEATED": + return FieldDescriptorProto_Label.LABEL_REPEATED; + case 2: + case "LABEL_REQUIRED": + return FieldDescriptorProto_Label.LABEL_REQUIRED; + case -1: + case "UNRECOGNIZED": + default: + return FieldDescriptorProto_Label.UNRECOGNIZED; + } +} +export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_Label): string { + switch (object) { + case FieldDescriptorProto_Label.LABEL_OPTIONAL: + return "LABEL_OPTIONAL"; + case FieldDescriptorProto_Label.LABEL_REPEATED: + return "LABEL_REPEATED"; + case FieldDescriptorProto_Label.LABEL_REQUIRED: + return "LABEL_REQUIRED"; + case FieldDescriptorProto_Label.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** Generated classes can be optimized for speed or code size. */ +export enum FileOptions_OptimizeMode { + /** SPEED - Generate complete code for parsing, serialization, */ + SPEED = 1, + /** CODE_SIZE - etc. */ + CODE_SIZE = 2, + /** LITE_RUNTIME - Generate code using MessageLite and the lite runtime. */ + LITE_RUNTIME = 3, + UNRECOGNIZED = -1, +} +export const FileOptions_OptimizeModeAmino = FileOptions_OptimizeMode; +export function fileOptions_OptimizeModeFromJSON(object: any): FileOptions_OptimizeMode { + switch (object) { + case 1: + case "SPEED": + return FileOptions_OptimizeMode.SPEED; + case 2: + case "CODE_SIZE": + return FileOptions_OptimizeMode.CODE_SIZE; + case 3: + case "LITE_RUNTIME": + return FileOptions_OptimizeMode.LITE_RUNTIME; + case -1: + case "UNRECOGNIZED": + default: + return FileOptions_OptimizeMode.UNRECOGNIZED; + } +} +export function fileOptions_OptimizeModeToJSON(object: FileOptions_OptimizeMode): string { + switch (object) { + case FileOptions_OptimizeMode.SPEED: + return "SPEED"; + case FileOptions_OptimizeMode.CODE_SIZE: + return "CODE_SIZE"; + case FileOptions_OptimizeMode.LITE_RUNTIME: + return "LITE_RUNTIME"; + case FileOptions_OptimizeMode.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export enum FieldOptions_CType { + /** STRING - Default mode. */ + STRING = 0, + /** + * CORD - The option [ctype=CORD] may be applied to a non-repeated field of type + * "bytes". It indicates that in C++, the data should be stored in a Cord + * instead of a string. For very large strings, this may reduce memory + * fragmentation. It may also allow better performance when parsing from a + * Cord, or when parsing with aliasing enabled, as the parsed Cord may then + * alias the original buffer. + */ + CORD = 1, + STRING_PIECE = 2, + UNRECOGNIZED = -1, +} +export const FieldOptions_CTypeAmino = FieldOptions_CType; +export function fieldOptions_CTypeFromJSON(object: any): FieldOptions_CType { + switch (object) { + case 0: + case "STRING": + return FieldOptions_CType.STRING; + case 1: + case "CORD": + return FieldOptions_CType.CORD; + case 2: + case "STRING_PIECE": + return FieldOptions_CType.STRING_PIECE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_CType.UNRECOGNIZED; + } +} +export function fieldOptions_CTypeToJSON(object: FieldOptions_CType): string { + switch (object) { + case FieldOptions_CType.STRING: + return "STRING"; + case FieldOptions_CType.CORD: + return "CORD"; + case FieldOptions_CType.STRING_PIECE: + return "STRING_PIECE"; + case FieldOptions_CType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export enum FieldOptions_JSType { + /** JS_NORMAL - Use the default type. */ + JS_NORMAL = 0, + /** JS_STRING - Use JavaScript strings. */ + JS_STRING = 1, + /** JS_NUMBER - Use JavaScript numbers. */ + JS_NUMBER = 2, + UNRECOGNIZED = -1, +} +export const FieldOptions_JSTypeAmino = FieldOptions_JSType; +export function fieldOptions_JSTypeFromJSON(object: any): FieldOptions_JSType { + switch (object) { + case 0: + case "JS_NORMAL": + return FieldOptions_JSType.JS_NORMAL; + case 1: + case "JS_STRING": + return FieldOptions_JSType.JS_STRING; + case 2: + case "JS_NUMBER": + return FieldOptions_JSType.JS_NUMBER; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_JSType.UNRECOGNIZED; + } +} +export function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string { + switch (object) { + case FieldOptions_JSType.JS_NORMAL: + return "JS_NORMAL"; + case FieldOptions_JSType.JS_STRING: + return "JS_STRING"; + case FieldOptions_JSType.JS_NUMBER: + return "JS_NUMBER"; + case FieldOptions_JSType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** + * If set to RETENTION_SOURCE, the option will be omitted from the binary. + * Note: as of January 2023, support for this is in progress and does not yet + * have an effect (b/264593489). + */ +export enum FieldOptions_OptionRetention { + RETENTION_UNKNOWN = 0, + RETENTION_RUNTIME = 1, + RETENTION_SOURCE = 2, + UNRECOGNIZED = -1, +} +export const FieldOptions_OptionRetentionAmino = FieldOptions_OptionRetention; +export function fieldOptions_OptionRetentionFromJSON(object: any): FieldOptions_OptionRetention { + switch (object) { + case 0: + case "RETENTION_UNKNOWN": + return FieldOptions_OptionRetention.RETENTION_UNKNOWN; + case 1: + case "RETENTION_RUNTIME": + return FieldOptions_OptionRetention.RETENTION_RUNTIME; + case 2: + case "RETENTION_SOURCE": + return FieldOptions_OptionRetention.RETENTION_SOURCE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionRetention.UNRECOGNIZED; + } +} +export function fieldOptions_OptionRetentionToJSON(object: FieldOptions_OptionRetention): string { + switch (object) { + case FieldOptions_OptionRetention.RETENTION_UNKNOWN: + return "RETENTION_UNKNOWN"; + case FieldOptions_OptionRetention.RETENTION_RUNTIME: + return "RETENTION_RUNTIME"; + case FieldOptions_OptionRetention.RETENTION_SOURCE: + return "RETENTION_SOURCE"; + case FieldOptions_OptionRetention.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** + * This indicates the types of entities that the field may apply to when used + * as an option. If it is unset, then the field may be freely used as an + * option on any kind of entity. Note: as of January 2023, support for this is + * in progress and does not yet have an effect (b/264593489). + */ +export enum FieldOptions_OptionTargetType { + TARGET_TYPE_UNKNOWN = 0, + TARGET_TYPE_FILE = 1, + TARGET_TYPE_EXTENSION_RANGE = 2, + TARGET_TYPE_MESSAGE = 3, + TARGET_TYPE_FIELD = 4, + TARGET_TYPE_ONEOF = 5, + TARGET_TYPE_ENUM = 6, + TARGET_TYPE_ENUM_ENTRY = 7, + TARGET_TYPE_SERVICE = 8, + TARGET_TYPE_METHOD = 9, + UNRECOGNIZED = -1, +} +export const FieldOptions_OptionTargetTypeAmino = FieldOptions_OptionTargetType; +export function fieldOptions_OptionTargetTypeFromJSON(object: any): FieldOptions_OptionTargetType { + switch (object) { + case 0: + case "TARGET_TYPE_UNKNOWN": + return FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN; + case 1: + case "TARGET_TYPE_FILE": + return FieldOptions_OptionTargetType.TARGET_TYPE_FILE; + case 2: + case "TARGET_TYPE_EXTENSION_RANGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE; + case 3: + case "TARGET_TYPE_MESSAGE": + return FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE; + case 4: + case "TARGET_TYPE_FIELD": + return FieldOptions_OptionTargetType.TARGET_TYPE_FIELD; + case 5: + case "TARGET_TYPE_ONEOF": + return FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF; + case 6: + case "TARGET_TYPE_ENUM": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM; + case 7: + case "TARGET_TYPE_ENUM_ENTRY": + return FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY; + case 8: + case "TARGET_TYPE_SERVICE": + return FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE; + case 9: + case "TARGET_TYPE_METHOD": + return FieldOptions_OptionTargetType.TARGET_TYPE_METHOD; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_OptionTargetType.UNRECOGNIZED; + } +} +export function fieldOptions_OptionTargetTypeToJSON(object: FieldOptions_OptionTargetType): string { + switch (object) { + case FieldOptions_OptionTargetType.TARGET_TYPE_UNKNOWN: + return "TARGET_TYPE_UNKNOWN"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FILE: + return "TARGET_TYPE_FILE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_EXTENSION_RANGE: + return "TARGET_TYPE_EXTENSION_RANGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_MESSAGE: + return "TARGET_TYPE_MESSAGE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_FIELD: + return "TARGET_TYPE_FIELD"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ONEOF: + return "TARGET_TYPE_ONEOF"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM: + return "TARGET_TYPE_ENUM"; + case FieldOptions_OptionTargetType.TARGET_TYPE_ENUM_ENTRY: + return "TARGET_TYPE_ENUM_ENTRY"; + case FieldOptions_OptionTargetType.TARGET_TYPE_SERVICE: + return "TARGET_TYPE_SERVICE"; + case FieldOptions_OptionTargetType.TARGET_TYPE_METHOD: + return "TARGET_TYPE_METHOD"; + case FieldOptions_OptionTargetType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** + * Is this method side-effect-free (or safe in HTTP parlance), or idempotent, + * or neither? HTTP based RPC implementation may choose GET verb for safe + * methods, and PUT verb for idempotent methods instead of the default POST. + */ +export enum MethodOptions_IdempotencyLevel { + IDEMPOTENCY_UNKNOWN = 0, + /** NO_SIDE_EFFECTS - implies idempotent */ + NO_SIDE_EFFECTS = 1, + /** IDEMPOTENT - idempotent, but may have side effects */ + IDEMPOTENT = 2, + UNRECOGNIZED = -1, +} +export const MethodOptions_IdempotencyLevelAmino = MethodOptions_IdempotencyLevel; +export function methodOptions_IdempotencyLevelFromJSON(object: any): MethodOptions_IdempotencyLevel { + switch (object) { + case 0: + case "IDEMPOTENCY_UNKNOWN": + return MethodOptions_IdempotencyLevel.IDEMPOTENCY_UNKNOWN; + case 1: + case "NO_SIDE_EFFECTS": + return MethodOptions_IdempotencyLevel.NO_SIDE_EFFECTS; + case 2: + case "IDEMPOTENT": + return MethodOptions_IdempotencyLevel.IDEMPOTENT; + case -1: + case "UNRECOGNIZED": + default: + return MethodOptions_IdempotencyLevel.UNRECOGNIZED; + } +} +export function methodOptions_IdempotencyLevelToJSON(object: MethodOptions_IdempotencyLevel): string { + switch (object) { + case MethodOptions_IdempotencyLevel.IDEMPOTENCY_UNKNOWN: + return "IDEMPOTENCY_UNKNOWN"; + case MethodOptions_IdempotencyLevel.NO_SIDE_EFFECTS: + return "NO_SIDE_EFFECTS"; + case MethodOptions_IdempotencyLevel.IDEMPOTENT: + return "IDEMPOTENT"; + case MethodOptions_IdempotencyLevel.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export enum FeatureSet_FieldPresence { + FIELD_PRESENCE_UNKNOWN = 0, + EXPLICIT = 1, + IMPLICIT = 2, + LEGACY_REQUIRED = 3, + UNRECOGNIZED = -1, +} +export const FeatureSet_FieldPresenceAmino = FeatureSet_FieldPresence; +export function featureSet_FieldPresenceFromJSON(object: any): FeatureSet_FieldPresence { + switch (object) { + case 0: + case "FIELD_PRESENCE_UNKNOWN": + return FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN; + case 1: + case "EXPLICIT": + return FeatureSet_FieldPresence.EXPLICIT; + case 2: + case "IMPLICIT": + return FeatureSet_FieldPresence.IMPLICIT; + case 3: + case "LEGACY_REQUIRED": + return FeatureSet_FieldPresence.LEGACY_REQUIRED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_FieldPresence.UNRECOGNIZED; + } +} +export function featureSet_FieldPresenceToJSON(object: FeatureSet_FieldPresence): string { + switch (object) { + case FeatureSet_FieldPresence.FIELD_PRESENCE_UNKNOWN: + return "FIELD_PRESENCE_UNKNOWN"; + case FeatureSet_FieldPresence.EXPLICIT: + return "EXPLICIT"; + case FeatureSet_FieldPresence.IMPLICIT: + return "IMPLICIT"; + case FeatureSet_FieldPresence.LEGACY_REQUIRED: + return "LEGACY_REQUIRED"; + case FeatureSet_FieldPresence.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export enum FeatureSet_EnumType { + ENUM_TYPE_UNKNOWN = 0, + OPEN = 1, + CLOSED = 2, + UNRECOGNIZED = -1, +} +export const FeatureSet_EnumTypeAmino = FeatureSet_EnumType; +export function featureSet_EnumTypeFromJSON(object: any): FeatureSet_EnumType { + switch (object) { + case 0: + case "ENUM_TYPE_UNKNOWN": + return FeatureSet_EnumType.ENUM_TYPE_UNKNOWN; + case 1: + case "OPEN": + return FeatureSet_EnumType.OPEN; + case 2: + case "CLOSED": + return FeatureSet_EnumType.CLOSED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_EnumType.UNRECOGNIZED; + } +} +export function featureSet_EnumTypeToJSON(object: FeatureSet_EnumType): string { + switch (object) { + case FeatureSet_EnumType.ENUM_TYPE_UNKNOWN: + return "ENUM_TYPE_UNKNOWN"; + case FeatureSet_EnumType.OPEN: + return "OPEN"; + case FeatureSet_EnumType.CLOSED: + return "CLOSED"; + case FeatureSet_EnumType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export enum FeatureSet_RepeatedFieldEncoding { + REPEATED_FIELD_ENCODING_UNKNOWN = 0, + PACKED = 1, + EXPANDED = 2, + UNRECOGNIZED = -1, +} +export const FeatureSet_RepeatedFieldEncodingAmino = FeatureSet_RepeatedFieldEncoding; +export function featureSet_RepeatedFieldEncodingFromJSON(object: any): FeatureSet_RepeatedFieldEncoding { + switch (object) { + case 0: + case "REPEATED_FIELD_ENCODING_UNKNOWN": + return FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN; + case 1: + case "PACKED": + return FeatureSet_RepeatedFieldEncoding.PACKED; + case 2: + case "EXPANDED": + return FeatureSet_RepeatedFieldEncoding.EXPANDED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED; + } +} +export function featureSet_RepeatedFieldEncodingToJSON(object: FeatureSet_RepeatedFieldEncoding): string { + switch (object) { + case FeatureSet_RepeatedFieldEncoding.REPEATED_FIELD_ENCODING_UNKNOWN: + return "REPEATED_FIELD_ENCODING_UNKNOWN"; + case FeatureSet_RepeatedFieldEncoding.PACKED: + return "PACKED"; + case FeatureSet_RepeatedFieldEncoding.EXPANDED: + return "EXPANDED"; + case FeatureSet_RepeatedFieldEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export enum FeatureSet_Utf8Validation { + UTF8_VALIDATION_UNKNOWN = 0, + VERIFY = 2, + NONE = 3, + UNRECOGNIZED = -1, +} +export const FeatureSet_Utf8ValidationAmino = FeatureSet_Utf8Validation; +export function featureSet_Utf8ValidationFromJSON(object: any): FeatureSet_Utf8Validation { + switch (object) { + case 0: + case "UTF8_VALIDATION_UNKNOWN": + return FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN; + case 2: + case "VERIFY": + return FeatureSet_Utf8Validation.VERIFY; + case 3: + case "NONE": + return FeatureSet_Utf8Validation.NONE; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_Utf8Validation.UNRECOGNIZED; + } +} +export function featureSet_Utf8ValidationToJSON(object: FeatureSet_Utf8Validation): string { + switch (object) { + case FeatureSet_Utf8Validation.UTF8_VALIDATION_UNKNOWN: + return "UTF8_VALIDATION_UNKNOWN"; + case FeatureSet_Utf8Validation.VERIFY: + return "VERIFY"; + case FeatureSet_Utf8Validation.NONE: + return "NONE"; + case FeatureSet_Utf8Validation.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export enum FeatureSet_MessageEncoding { + MESSAGE_ENCODING_UNKNOWN = 0, + LENGTH_PREFIXED = 1, + DELIMITED = 2, + UNRECOGNIZED = -1, +} +export const FeatureSet_MessageEncodingAmino = FeatureSet_MessageEncoding; +export function featureSet_MessageEncodingFromJSON(object: any): FeatureSet_MessageEncoding { + switch (object) { + case 0: + case "MESSAGE_ENCODING_UNKNOWN": + return FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN; + case 1: + case "LENGTH_PREFIXED": + return FeatureSet_MessageEncoding.LENGTH_PREFIXED; + case 2: + case "DELIMITED": + return FeatureSet_MessageEncoding.DELIMITED; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_MessageEncoding.UNRECOGNIZED; + } +} +export function featureSet_MessageEncodingToJSON(object: FeatureSet_MessageEncoding): string { + switch (object) { + case FeatureSet_MessageEncoding.MESSAGE_ENCODING_UNKNOWN: + return "MESSAGE_ENCODING_UNKNOWN"; + case FeatureSet_MessageEncoding.LENGTH_PREFIXED: + return "LENGTH_PREFIXED"; + case FeatureSet_MessageEncoding.DELIMITED: + return "DELIMITED"; + case FeatureSet_MessageEncoding.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export enum FeatureSet_JsonFormat { + JSON_FORMAT_UNKNOWN = 0, + ALLOW = 1, + LEGACY_BEST_EFFORT = 2, + UNRECOGNIZED = -1, +} +export const FeatureSet_JsonFormatAmino = FeatureSet_JsonFormat; +export function featureSet_JsonFormatFromJSON(object: any): FeatureSet_JsonFormat { + switch (object) { + case 0: + case "JSON_FORMAT_UNKNOWN": + return FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN; + case 1: + case "ALLOW": + return FeatureSet_JsonFormat.ALLOW; + case 2: + case "LEGACY_BEST_EFFORT": + return FeatureSet_JsonFormat.LEGACY_BEST_EFFORT; + case -1: + case "UNRECOGNIZED": + default: + return FeatureSet_JsonFormat.UNRECOGNIZED; + } +} +export function featureSet_JsonFormatToJSON(object: FeatureSet_JsonFormat): string { + switch (object) { + case FeatureSet_JsonFormat.JSON_FORMAT_UNKNOWN: + return "JSON_FORMAT_UNKNOWN"; + case FeatureSet_JsonFormat.ALLOW: + return "ALLOW"; + case FeatureSet_JsonFormat.LEGACY_BEST_EFFORT: + return "LEGACY_BEST_EFFORT"; + case FeatureSet_JsonFormat.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** + * Represents the identified object's effect on the element in the original + * .proto file. + */ +export enum GeneratedCodeInfo_Annotation_Semantic { + /** NONE - There is no effect or the effect is indescribable. */ + NONE = 0, + /** SET - The element is set or otherwise mutated. */ + SET = 1, + /** ALIAS - An alias to the element is returned. */ + ALIAS = 2, + UNRECOGNIZED = -1, +} +export const GeneratedCodeInfo_Annotation_SemanticAmino = GeneratedCodeInfo_Annotation_Semantic; +export function generatedCodeInfo_Annotation_SemanticFromJSON(object: any): GeneratedCodeInfo_Annotation_Semantic { + switch (object) { + case 0: + case "NONE": + return GeneratedCodeInfo_Annotation_Semantic.NONE; + case 1: + case "SET": + return GeneratedCodeInfo_Annotation_Semantic.SET; + case 2: + case "ALIAS": + return GeneratedCodeInfo_Annotation_Semantic.ALIAS; + case -1: + case "UNRECOGNIZED": + default: + return GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED; + } +} +export function generatedCodeInfo_Annotation_SemanticToJSON(object: GeneratedCodeInfo_Annotation_Semantic): string { + switch (object) { + case GeneratedCodeInfo_Annotation_Semantic.NONE: + return "NONE"; + case GeneratedCodeInfo_Annotation_Semantic.SET: + return "SET"; + case GeneratedCodeInfo_Annotation_Semantic.ALIAS: + return "ALIAS"; + case GeneratedCodeInfo_Annotation_Semantic.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** + * The protocol compiler can output a FileDescriptorSet containing the .proto + * files it parses. + */ +export interface FileDescriptorSet { + file: FileDescriptorProto[]; +} +export interface FileDescriptorSetProtoMsg { + typeUrl: "/google.protobuf.FileDescriptorSet"; + value: Uint8Array; +} +/** + * The protocol compiler can output a FileDescriptorSet containing the .proto + * files it parses. + */ +export interface FileDescriptorSetAmino { + file: FileDescriptorProtoAmino[]; +} +export interface FileDescriptorSetAminoMsg { + type: "/google.protobuf.FileDescriptorSet"; + value: FileDescriptorSetAmino; +} +/** Describes a complete .proto file. */ +export interface FileDescriptorProto { + /** file name, relative to root of source tree */ + name: string; + /** e.g. "foo", "foo.bar", etc. */ + package: string; + /** Names of files imported by this file. */ + dependency: string[]; + /** Indexes of the public imported files in the dependency list above. */ + publicDependency: number[]; + /** + * Indexes of the weak imported files in the dependency list. + * For Google-internal migration only. Do not use. + */ + weakDependency: number[]; + /** All top-level definitions in this file. */ + messageType: DescriptorProto[]; + enumType: EnumDescriptorProto[]; + service: ServiceDescriptorProto[]; + extension: FieldDescriptorProto[]; + options?: FileOptions; + /** + * This field contains optional information about the original source code. + * You may safely remove this entire field without harming runtime + * functionality of the descriptors -- the information is needed only by + * development tools. + */ + sourceCodeInfo?: SourceCodeInfo; + /** + * The syntax of the proto file. + * The supported values are "proto2", "proto3", and "editions". + * + * If `edition` is present, this value must be "editions". + */ + syntax: string; + /** The edition of the proto file. */ + edition: Edition; +} +export interface FileDescriptorProtoProtoMsg { + typeUrl: "/google.protobuf.FileDescriptorProto"; + value: Uint8Array; +} +/** Describes a complete .proto file. */ +export interface FileDescriptorProtoAmino { + /** file name, relative to root of source tree */ + name: string; + /** e.g. "foo", "foo.bar", etc. */ + package: string; + /** Names of files imported by this file. */ + dependency: string[]; + /** Indexes of the public imported files in the dependency list above. */ + public_dependency: number[]; + /** + * Indexes of the weak imported files in the dependency list. + * For Google-internal migration only. Do not use. + */ + weak_dependency: number[]; + /** All top-level definitions in this file. */ + message_type: DescriptorProtoAmino[]; + enum_type: EnumDescriptorProtoAmino[]; + service: ServiceDescriptorProtoAmino[]; + extension: FieldDescriptorProtoAmino[]; + options?: FileOptionsAmino; + /** + * This field contains optional information about the original source code. + * You may safely remove this entire field without harming runtime + * functionality of the descriptors -- the information is needed only by + * development tools. + */ + source_code_info?: SourceCodeInfoAmino; + /** + * The syntax of the proto file. + * The supported values are "proto2", "proto3", and "editions". + * + * If `edition` is present, this value must be "editions". + */ + syntax: string; + /** The edition of the proto file. */ + edition: Edition; +} +export interface FileDescriptorProtoAminoMsg { + type: "/google.protobuf.FileDescriptorProto"; + value: FileDescriptorProtoAmino; +} +/** Describes a message type. */ +export interface DescriptorProto { + name: string; + field: FieldDescriptorProto[]; + extension: FieldDescriptorProto[]; + nestedType: DescriptorProto[]; + enumType: EnumDescriptorProto[]; + extensionRange: DescriptorProto_ExtensionRange[]; + oneofDecl: OneofDescriptorProto[]; + options?: MessageOptions; + reservedRange: DescriptorProto_ReservedRange[]; + /** + * Reserved field names, which may not be used by fields in the same message. + * A given name may only be reserved once. + */ + reservedName: string[]; +} +export interface DescriptorProtoProtoMsg { + typeUrl: "/google.protobuf.DescriptorProto"; + value: Uint8Array; +} +/** Describes a message type. */ +export interface DescriptorProtoAmino { + name: string; + field: FieldDescriptorProtoAmino[]; + extension: FieldDescriptorProtoAmino[]; + nested_type: DescriptorProtoAmino[]; + enum_type: EnumDescriptorProtoAmino[]; + extension_range: DescriptorProto_ExtensionRangeAmino[]; + oneof_decl: OneofDescriptorProtoAmino[]; + options?: MessageOptionsAmino; + reserved_range: DescriptorProto_ReservedRangeAmino[]; + /** + * Reserved field names, which may not be used by fields in the same message. + * A given name may only be reserved once. + */ + reserved_name: string[]; +} +export interface DescriptorProtoAminoMsg { + type: "/google.protobuf.DescriptorProto"; + value: DescriptorProtoAmino; +} +export interface DescriptorProto_ExtensionRange { + /** Inclusive. */ + start: number; + /** Exclusive. */ + end: number; + options?: ExtensionRangeOptions; +} +export interface DescriptorProto_ExtensionRangeProtoMsg { + typeUrl: "/google.protobuf.ExtensionRange"; + value: Uint8Array; +} +export interface DescriptorProto_ExtensionRangeAmino { + /** Inclusive. */ + start: number; + /** Exclusive. */ + end: number; + options?: ExtensionRangeOptionsAmino; +} +export interface DescriptorProto_ExtensionRangeAminoMsg { + type: "/google.protobuf.ExtensionRange"; + value: DescriptorProto_ExtensionRangeAmino; +} +/** + * Range of reserved tag numbers. Reserved tag numbers may not be used by + * fields or extension ranges in the same message. Reserved ranges may + * not overlap. + */ +export interface DescriptorProto_ReservedRange { + /** Inclusive. */ + start: number; + /** Exclusive. */ + end: number; +} +export interface DescriptorProto_ReservedRangeProtoMsg { + typeUrl: "/google.protobuf.ReservedRange"; + value: Uint8Array; +} +/** + * Range of reserved tag numbers. Reserved tag numbers may not be used by + * fields or extension ranges in the same message. Reserved ranges may + * not overlap. + */ +export interface DescriptorProto_ReservedRangeAmino { + /** Inclusive. */ + start: number; + /** Exclusive. */ + end: number; +} +export interface DescriptorProto_ReservedRangeAminoMsg { + type: "/google.protobuf.ReservedRange"; + value: DescriptorProto_ReservedRangeAmino; +} +export interface ExtensionRangeOptions { + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; + /** + * For external users: DO NOT USE. We are in the process of open sourcing + * extension declaration and executing internal cleanups before it can be + * used externally. + */ + declaration: ExtensionRangeOptions_Declaration[]; + /** Any features defined in the specific edition. */ + features?: FeatureSet; + /** + * The verification state of the range. + * TODO: flip the default to DECLARATION once all empty ranges + * are marked as UNVERIFIED. + */ + verification: ExtensionRangeOptions_VerificationState; +} +export interface ExtensionRangeOptionsProtoMsg { + typeUrl: "/google.protobuf.ExtensionRangeOptions"; + value: Uint8Array; +} +export interface ExtensionRangeOptionsAmino { + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option: UninterpretedOptionAmino[]; + /** + * For external users: DO NOT USE. We are in the process of open sourcing + * extension declaration and executing internal cleanups before it can be + * used externally. + */ + declaration: ExtensionRangeOptions_DeclarationAmino[]; + /** Any features defined in the specific edition. */ + features?: FeatureSetAmino; + /** + * The verification state of the range. + * TODO: flip the default to DECLARATION once all empty ranges + * are marked as UNVERIFIED. + */ + verification: ExtensionRangeOptions_VerificationState; +} +export interface ExtensionRangeOptionsAminoMsg { + type: "/google.protobuf.ExtensionRangeOptions"; + value: ExtensionRangeOptionsAmino; +} +export interface ExtensionRangeOptions_Declaration { + /** The extension number declared within the extension range. */ + number: number; + /** + * The fully-qualified name of the extension field. There must be a leading + * dot in front of the full name. + */ + fullName: string; + /** + * The fully-qualified type name of the extension field. Unlike + * Metadata.type, Declaration.type must have a leading dot for messages + * and enums. + */ + type: string; + /** + * If true, indicates that the number is reserved in the extension range, + * and any extension field with the number will fail to compile. Set this + * when a declared extension field is deleted. + */ + reserved: boolean; + /** + * If true, indicates that the extension must be defined as repeated. + * Otherwise the extension must be defined as optional. + */ + repeated: boolean; +} +export interface ExtensionRangeOptions_DeclarationProtoMsg { + typeUrl: "/google.protobuf.Declaration"; + value: Uint8Array; +} +export interface ExtensionRangeOptions_DeclarationAmino { + /** The extension number declared within the extension range. */ + number: number; + /** + * The fully-qualified name of the extension field. There must be a leading + * dot in front of the full name. + */ + full_name: string; + /** + * The fully-qualified type name of the extension field. Unlike + * Metadata.type, Declaration.type must have a leading dot for messages + * and enums. + */ + type: string; + /** + * If true, indicates that the number is reserved in the extension range, + * and any extension field with the number will fail to compile. Set this + * when a declared extension field is deleted. + */ + reserved: boolean; + /** + * If true, indicates that the extension must be defined as repeated. + * Otherwise the extension must be defined as optional. + */ + repeated: boolean; +} +export interface ExtensionRangeOptions_DeclarationAminoMsg { + type: "/google.protobuf.Declaration"; + value: ExtensionRangeOptions_DeclarationAmino; +} +/** Describes a field within a message. */ +export interface FieldDescriptorProto { + name: string; + number: number; + label: FieldDescriptorProto_Label; + /** + * If type_name is set, this need not be set. If both this and type_name + * are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. + */ + type: FieldDescriptorProto_Type; + /** + * For message and enum types, this is the name of the type. If the name + * starts with a '.', it is fully-qualified. Otherwise, C++-like scoping + * rules are used to find the type (i.e. first the nested types within this + * message are searched, then within the parent, on up to the root + * namespace). + */ + typeName: string; + /** + * For extensions, this is the name of the type being extended. It is + * resolved in the same manner as type_name. + */ + extendee: string; + /** + * For numeric types, contains the original text representation of the value. + * For booleans, "true" or "false". + * For strings, contains the default text contents (not escaped in any way). + * For bytes, contains the C escaped value. All bytes >= 128 are escaped. + */ + defaultValue: string; + /** + * If set, gives the index of a oneof in the containing type's oneof_decl + * list. This field is a member of that oneof. + */ + oneofIndex: number; + /** + * JSON name of this field. The value is set by protocol compiler. If the + * user has set a "json_name" option on this field, that option's value + * will be used. Otherwise, it's deduced from the field's name by converting + * it to camelCase. + */ + jsonName: string; + options?: FieldOptions; + /** + * If true, this is a proto3 "optional". When a proto3 field is optional, it + * tracks presence regardless of field type. + * + * When proto3_optional is true, this field must belong to a oneof to signal + * to old proto3 clients that presence is tracked for this field. This oneof + * is known as a "synthetic" oneof, and this field must be its sole member + * (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs + * exist in the descriptor only, and do not generate any API. Synthetic oneofs + * must be ordered after all "real" oneofs. + * + * For message fields, proto3_optional doesn't create any semantic change, + * since non-repeated message fields always track presence. However it still + * indicates the semantic detail of whether the user wrote "optional" or not. + * This can be useful for round-tripping the .proto file. For consistency we + * give message fields a synthetic oneof also, even though it is not required + * to track presence. This is especially important because the parser can't + * tell if a field is a message or an enum, so it must always create a + * synthetic oneof. + * + * Proto2 optional fields do not set this flag, because they already indicate + * optional with `LABEL_OPTIONAL`. + */ + proto3Optional: boolean; +} +export interface FieldDescriptorProtoProtoMsg { + typeUrl: "/google.protobuf.FieldDescriptorProto"; + value: Uint8Array; +} +/** Describes a field within a message. */ +export interface FieldDescriptorProtoAmino { + name: string; + number: number; + label: FieldDescriptorProto_Label; + /** + * If type_name is set, this need not be set. If both this and type_name + * are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. + */ + type: FieldDescriptorProto_Type; + /** + * For message and enum types, this is the name of the type. If the name + * starts with a '.', it is fully-qualified. Otherwise, C++-like scoping + * rules are used to find the type (i.e. first the nested types within this + * message are searched, then within the parent, on up to the root + * namespace). + */ + type_name: string; + /** + * For extensions, this is the name of the type being extended. It is + * resolved in the same manner as type_name. + */ + extendee: string; + /** + * For numeric types, contains the original text representation of the value. + * For booleans, "true" or "false". + * For strings, contains the default text contents (not escaped in any way). + * For bytes, contains the C escaped value. All bytes >= 128 are escaped. + */ + default_value: string; + /** + * If set, gives the index of a oneof in the containing type's oneof_decl + * list. This field is a member of that oneof. + */ + oneof_index: number; + /** + * JSON name of this field. The value is set by protocol compiler. If the + * user has set a "json_name" option on this field, that option's value + * will be used. Otherwise, it's deduced from the field's name by converting + * it to camelCase. + */ + json_name: string; + options?: FieldOptionsAmino; + /** + * If true, this is a proto3 "optional". When a proto3 field is optional, it + * tracks presence regardless of field type. + * + * When proto3_optional is true, this field must belong to a oneof to signal + * to old proto3 clients that presence is tracked for this field. This oneof + * is known as a "synthetic" oneof, and this field must be its sole member + * (each proto3 optional field gets its own synthetic oneof). Synthetic oneofs + * exist in the descriptor only, and do not generate any API. Synthetic oneofs + * must be ordered after all "real" oneofs. + * + * For message fields, proto3_optional doesn't create any semantic change, + * since non-repeated message fields always track presence. However it still + * indicates the semantic detail of whether the user wrote "optional" or not. + * This can be useful for round-tripping the .proto file. For consistency we + * give message fields a synthetic oneof also, even though it is not required + * to track presence. This is especially important because the parser can't + * tell if a field is a message or an enum, so it must always create a + * synthetic oneof. + * + * Proto2 optional fields do not set this flag, because they already indicate + * optional with `LABEL_OPTIONAL`. + */ + proto3_optional: boolean; +} +export interface FieldDescriptorProtoAminoMsg { + type: "/google.protobuf.FieldDescriptorProto"; + value: FieldDescriptorProtoAmino; +} +/** Describes a oneof. */ +export interface OneofDescriptorProto { + name: string; + options?: OneofOptions; +} +export interface OneofDescriptorProtoProtoMsg { + typeUrl: "/google.protobuf.OneofDescriptorProto"; + value: Uint8Array; +} +/** Describes a oneof. */ +export interface OneofDescriptorProtoAmino { + name: string; + options?: OneofOptionsAmino; +} +export interface OneofDescriptorProtoAminoMsg { + type: "/google.protobuf.OneofDescriptorProto"; + value: OneofDescriptorProtoAmino; +} +/** Describes an enum type. */ +export interface EnumDescriptorProto { + name: string; + value: EnumValueDescriptorProto[]; + options?: EnumOptions; + /** + * Range of reserved numeric values. Reserved numeric values may not be used + * by enum values in the same enum declaration. Reserved ranges may not + * overlap. + */ + reservedRange: EnumDescriptorProto_EnumReservedRange[]; + /** + * Reserved enum value names, which may not be reused. A given name may only + * be reserved once. + */ + reservedName: string[]; +} +export interface EnumDescriptorProtoProtoMsg { + typeUrl: "/google.protobuf.EnumDescriptorProto"; + value: Uint8Array; +} +/** Describes an enum type. */ +export interface EnumDescriptorProtoAmino { + name: string; + value: EnumValueDescriptorProtoAmino[]; + options?: EnumOptionsAmino; + /** + * Range of reserved numeric values. Reserved numeric values may not be used + * by enum values in the same enum declaration. Reserved ranges may not + * overlap. + */ + reserved_range: EnumDescriptorProto_EnumReservedRangeAmino[]; + /** + * Reserved enum value names, which may not be reused. A given name may only + * be reserved once. + */ + reserved_name: string[]; +} +export interface EnumDescriptorProtoAminoMsg { + type: "/google.protobuf.EnumDescriptorProto"; + value: EnumDescriptorProtoAmino; +} +/** + * Range of reserved numeric values. Reserved values may not be used by + * entries in the same enum. Reserved ranges may not overlap. + * + * Note that this is distinct from DescriptorProto.ReservedRange in that it + * is inclusive such that it can appropriately represent the entire int32 + * domain. + */ +export interface EnumDescriptorProto_EnumReservedRange { + /** Inclusive. */ + start: number; + /** Inclusive. */ + end: number; +} +export interface EnumDescriptorProto_EnumReservedRangeProtoMsg { + typeUrl: "/google.protobuf.EnumReservedRange"; + value: Uint8Array; +} +/** + * Range of reserved numeric values. Reserved values may not be used by + * entries in the same enum. Reserved ranges may not overlap. + * + * Note that this is distinct from DescriptorProto.ReservedRange in that it + * is inclusive such that it can appropriately represent the entire int32 + * domain. + */ +export interface EnumDescriptorProto_EnumReservedRangeAmino { + /** Inclusive. */ + start: number; + /** Inclusive. */ + end: number; +} +export interface EnumDescriptorProto_EnumReservedRangeAminoMsg { + type: "/google.protobuf.EnumReservedRange"; + value: EnumDescriptorProto_EnumReservedRangeAmino; +} +/** Describes a value within an enum. */ +export interface EnumValueDescriptorProto { + name: string; + number: number; + options?: EnumValueOptions; +} +export interface EnumValueDescriptorProtoProtoMsg { + typeUrl: "/google.protobuf.EnumValueDescriptorProto"; + value: Uint8Array; +} +/** Describes a value within an enum. */ +export interface EnumValueDescriptorProtoAmino { + name: string; + number: number; + options?: EnumValueOptionsAmino; +} +export interface EnumValueDescriptorProtoAminoMsg { + type: "/google.protobuf.EnumValueDescriptorProto"; + value: EnumValueDescriptorProtoAmino; +} +/** Describes a service. */ +export interface ServiceDescriptorProto { + name: string; + method: MethodDescriptorProto[]; + options?: ServiceOptions; +} +export interface ServiceDescriptorProtoProtoMsg { + typeUrl: "/google.protobuf.ServiceDescriptorProto"; + value: Uint8Array; +} +/** Describes a service. */ +export interface ServiceDescriptorProtoAmino { + name: string; + method: MethodDescriptorProtoAmino[]; + options?: ServiceOptionsAmino; +} +export interface ServiceDescriptorProtoAminoMsg { + type: "/google.protobuf.ServiceDescriptorProto"; + value: ServiceDescriptorProtoAmino; +} +/** Describes a method of a service. */ +export interface MethodDescriptorProto { + name: string; + /** + * Input and output type names. These are resolved in the same way as + * FieldDescriptorProto.type_name, but must refer to a message type. + */ + inputType: string; + outputType: string; + options?: MethodOptions; + /** Identifies if client streams multiple client messages */ + clientStreaming: boolean; + /** Identifies if server streams multiple server messages */ + serverStreaming: boolean; +} +export interface MethodDescriptorProtoProtoMsg { + typeUrl: "/google.protobuf.MethodDescriptorProto"; + value: Uint8Array; +} +/** Describes a method of a service. */ +export interface MethodDescriptorProtoAmino { + name: string; + /** + * Input and output type names. These are resolved in the same way as + * FieldDescriptorProto.type_name, but must refer to a message type. + */ + input_type: string; + output_type: string; + options?: MethodOptionsAmino; + /** Identifies if client streams multiple client messages */ + client_streaming: boolean; + /** Identifies if server streams multiple server messages */ + server_streaming: boolean; +} +export interface MethodDescriptorProtoAminoMsg { + type: "/google.protobuf.MethodDescriptorProto"; + value: MethodDescriptorProtoAmino; +} +export interface FileOptions { + /** + * Sets the Java package where classes generated from this .proto will be + * placed. By default, the proto package is used, but this is often + * inappropriate because proto packages do not normally start with backwards + * domain names. + */ + javaPackage: string; + /** + * Controls the name of the wrapper Java class generated for the .proto file. + * That class will always contain the .proto file's getDescriptor() method as + * well as any top-level extensions defined in the .proto file. + * If java_multiple_files is disabled, then all the other classes from the + * .proto file will be nested inside the single wrapper outer class. + */ + javaOuterClassname: string; + /** + * If enabled, then the Java code generator will generate a separate .java + * file for each top-level message, enum, and service defined in the .proto + * file. Thus, these types will *not* be nested inside the wrapper class + * named by java_outer_classname. However, the wrapper class will still be + * generated to contain the file's getDescriptor() method as well as any + * top-level extensions defined in the file. + */ + javaMultipleFiles: boolean; + /** This option does nothing. */ + /** @deprecated */ + javaGenerateEqualsAndHash: boolean; + /** + * A proto2 file can set this to true to opt in to UTF-8 checking for Java, + * which will throw an exception if invalid UTF-8 is parsed from the wire or + * assigned to a string field. + * + * TODO: clarify exactly what kinds of field types this option + * applies to, and update these docs accordingly. + * + * Proto3 files already perform these checks. Setting the option explicitly to + * false has no effect: it cannot be used to opt proto3 files out of UTF-8 + * checks. + */ + javaStringCheckUtf8: boolean; + optimizeFor: FileOptions_OptimizeMode; + /** + * Sets the Go package where structs generated from this .proto will be + * placed. If omitted, the Go package will be derived from the following: + * - The basename of the package import path, if provided. + * - Otherwise, the package statement in the .proto file, if present. + * - Otherwise, the basename of the .proto file, without extension. + */ + goPackage: string; + /** + * Should generic services be generated in each language? "Generic" services + * are not specific to any particular RPC system. They are generated by the + * main code generators in each language (without additional plugins). + * Generic services were the only kind of service generation supported by + * early versions of google.protobuf. + * + * Generic services are now considered deprecated in favor of using plugins + * that generate code specific to your particular RPC system. Therefore, + * these default to false. Old code which depends on generic services should + * explicitly set them to true. + */ + ccGenericServices: boolean; + javaGenericServices: boolean; + pyGenericServices: boolean; + /** + * Is this file deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for everything in the file, or it will be completely ignored; in the very + * least, this is a formalization for deprecating files. + */ + deprecated: boolean; + /** + * Enables the use of arenas for the proto messages in this file. This applies + * only to generated classes for C++. + */ + ccEnableArenas: boolean; + /** + * Sets the objective c class prefix which is prepended to all objective c + * generated classes from this .proto. There is no default. + */ + objcClassPrefix: string; + /** Namespace for generated classes; defaults to the package. */ + csharpNamespace: string; + /** + * By default Swift generators will take the proto package and CamelCase it + * replacing '.' with underscore and use that to prefix the types/symbols + * defined. When this options is provided, they will use this value instead + * to prefix the types/symbols defined. + */ + swiftPrefix: string; + /** + * Sets the php class prefix which is prepended to all php generated classes + * from this .proto. Default is empty. + */ + phpClassPrefix: string; + /** + * Use this option to change the namespace of php generated classes. Default + * is empty. When this option is empty, the package name will be used for + * determining the namespace. + */ + phpNamespace: string; + /** + * Use this option to change the namespace of php generated metadata classes. + * Default is empty. When this option is empty, the proto file name will be + * used for determining the namespace. + */ + phpMetadataNamespace: string; + /** + * Use this option to change the package of ruby generated classes. Default + * is empty. When this option is not set, the package name will be used for + * determining the ruby package. + */ + rubyPackage: string; + /** Any features defined in the specific edition. */ + features?: FeatureSet; + /** + * The parser stores options it doesn't recognize here. + * See the documentation for the "Options" section above. + */ + uninterpretedOption: UninterpretedOption[]; +} +export interface FileOptionsProtoMsg { + typeUrl: "/google.protobuf.FileOptions"; + value: Uint8Array; +} +export interface FileOptionsAmino { + /** + * Sets the Java package where classes generated from this .proto will be + * placed. By default, the proto package is used, but this is often + * inappropriate because proto packages do not normally start with backwards + * domain names. + */ + java_package: string; + /** + * Controls the name of the wrapper Java class generated for the .proto file. + * That class will always contain the .proto file's getDescriptor() method as + * well as any top-level extensions defined in the .proto file. + * If java_multiple_files is disabled, then all the other classes from the + * .proto file will be nested inside the single wrapper outer class. + */ + java_outer_classname: string; + /** + * If enabled, then the Java code generator will generate a separate .java + * file for each top-level message, enum, and service defined in the .proto + * file. Thus, these types will *not* be nested inside the wrapper class + * named by java_outer_classname. However, the wrapper class will still be + * generated to contain the file's getDescriptor() method as well as any + * top-level extensions defined in the file. + */ + java_multiple_files: boolean; + /** This option does nothing. */ + /** @deprecated */ + java_generate_equals_and_hash: boolean; + /** + * A proto2 file can set this to true to opt in to UTF-8 checking for Java, + * which will throw an exception if invalid UTF-8 is parsed from the wire or + * assigned to a string field. + * + * TODO: clarify exactly what kinds of field types this option + * applies to, and update these docs accordingly. + * + * Proto3 files already perform these checks. Setting the option explicitly to + * false has no effect: it cannot be used to opt proto3 files out of UTF-8 + * checks. + */ + java_string_check_utf8: boolean; + optimize_for: FileOptions_OptimizeMode; + /** + * Sets the Go package where structs generated from this .proto will be + * placed. If omitted, the Go package will be derived from the following: + * - The basename of the package import path, if provided. + * - Otherwise, the package statement in the .proto file, if present. + * - Otherwise, the basename of the .proto file, without extension. + */ + go_package: string; + /** + * Should generic services be generated in each language? "Generic" services + * are not specific to any particular RPC system. They are generated by the + * main code generators in each language (without additional plugins). + * Generic services were the only kind of service generation supported by + * early versions of google.protobuf. + * + * Generic services are now considered deprecated in favor of using plugins + * that generate code specific to your particular RPC system. Therefore, + * these default to false. Old code which depends on generic services should + * explicitly set them to true. + */ + cc_generic_services: boolean; + java_generic_services: boolean; + py_generic_services: boolean; + /** + * Is this file deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for everything in the file, or it will be completely ignored; in the very + * least, this is a formalization for deprecating files. + */ + deprecated: boolean; + /** + * Enables the use of arenas for the proto messages in this file. This applies + * only to generated classes for C++. + */ + cc_enable_arenas: boolean; + /** + * Sets the objective c class prefix which is prepended to all objective c + * generated classes from this .proto. There is no default. + */ + objc_class_prefix: string; + /** Namespace for generated classes; defaults to the package. */ + csharp_namespace: string; + /** + * By default Swift generators will take the proto package and CamelCase it + * replacing '.' with underscore and use that to prefix the types/symbols + * defined. When this options is provided, they will use this value instead + * to prefix the types/symbols defined. + */ + swift_prefix: string; + /** + * Sets the php class prefix which is prepended to all php generated classes + * from this .proto. Default is empty. + */ + php_class_prefix: string; + /** + * Use this option to change the namespace of php generated classes. Default + * is empty. When this option is empty, the package name will be used for + * determining the namespace. + */ + php_namespace: string; + /** + * Use this option to change the namespace of php generated metadata classes. + * Default is empty. When this option is empty, the proto file name will be + * used for determining the namespace. + */ + php_metadata_namespace: string; + /** + * Use this option to change the package of ruby generated classes. Default + * is empty. When this option is not set, the package name will be used for + * determining the ruby package. + */ + ruby_package: string; + /** Any features defined in the specific edition. */ + features?: FeatureSetAmino; + /** + * The parser stores options it doesn't recognize here. + * See the documentation for the "Options" section above. + */ + uninterpreted_option: UninterpretedOptionAmino[]; +} +export interface FileOptionsAminoMsg { + type: "/google.protobuf.FileOptions"; + value: FileOptionsAmino; +} +export interface MessageOptions { + /** + * Set true to use the old proto1 MessageSet wire format for extensions. + * This is provided for backwards-compatibility with the MessageSet wire + * format. You should not use this for any other reason: It's less + * efficient, has fewer features, and is more complicated. + * + * The message must be defined exactly as follows: + * message Foo { + * option message_set_wire_format = true; + * extensions 4 to max; + * } + * Note that the message cannot have any defined fields; MessageSets only + * have extensions. + * + * All extensions of your type must be singular messages; e.g. they cannot + * be int32s, enums, or repeated messages. + * + * Because this is an option, the above two restrictions are not enforced by + * the protocol compiler. + */ + messageSetWireFormat: boolean; + /** + * Disables the generation of the standard "descriptor()" accessor, which can + * conflict with a field of the same name. This is meant to make migration + * from proto1 easier; new code should avoid fields named "descriptor". + */ + noStandardDescriptorAccessor: boolean; + /** + * Is this message deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the message, or it will be completely ignored; in the very least, + * this is a formalization for deprecating messages. + */ + deprecated: boolean; + /** + * Whether the message is an automatically generated map entry type for the + * maps field. + * + * For maps fields: + * map map_field = 1; + * The parsed descriptor looks like: + * message MapFieldEntry { + * option map_entry = true; + * optional KeyType key = 1; + * optional ValueType value = 2; + * } + * repeated MapFieldEntry map_field = 1; + * + * Implementations may choose not to generate the map_entry=true message, but + * use a native map in the target language to hold the keys and values. + * The reflection APIs in such implementations still need to work as + * if the field is a repeated message field. + * + * NOTE: Do not set the option in .proto files. Always use the maps syntax + * instead. The option should only be implicitly set by the proto compiler + * parser. + */ + mapEntry: boolean; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * + * This should only be used as a temporary measure against broken builds due + * to the change in behavior for JSON field name conflicts. + * + * TODO This is legacy behavior we plan to remove once downstream + * teams have had time to migrate. + */ + /** @deprecated */ + deprecatedLegacyJsonFieldConflicts: boolean; + /** Any features defined in the specific edition. */ + features?: FeatureSet; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} +export interface MessageOptionsProtoMsg { + typeUrl: "/google.protobuf.MessageOptions"; + value: Uint8Array; +} +export interface MessageOptionsAmino { + /** + * Set true to use the old proto1 MessageSet wire format for extensions. + * This is provided for backwards-compatibility with the MessageSet wire + * format. You should not use this for any other reason: It's less + * efficient, has fewer features, and is more complicated. + * + * The message must be defined exactly as follows: + * message Foo { + * option message_set_wire_format = true; + * extensions 4 to max; + * } + * Note that the message cannot have any defined fields; MessageSets only + * have extensions. + * + * All extensions of your type must be singular messages; e.g. they cannot + * be int32s, enums, or repeated messages. + * + * Because this is an option, the above two restrictions are not enforced by + * the protocol compiler. + */ + message_set_wire_format: boolean; + /** + * Disables the generation of the standard "descriptor()" accessor, which can + * conflict with a field of the same name. This is meant to make migration + * from proto1 easier; new code should avoid fields named "descriptor". + */ + no_standard_descriptor_accessor: boolean; + /** + * Is this message deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the message, or it will be completely ignored; in the very least, + * this is a formalization for deprecating messages. + */ + deprecated: boolean; + /** + * Whether the message is an automatically generated map entry type for the + * maps field. + * + * For maps fields: + * map map_field = 1; + * The parsed descriptor looks like: + * message MapFieldEntry { + * option map_entry = true; + * optional KeyType key = 1; + * optional ValueType value = 2; + * } + * repeated MapFieldEntry map_field = 1; + * + * Implementations may choose not to generate the map_entry=true message, but + * use a native map in the target language to hold the keys and values. + * The reflection APIs in such implementations still need to work as + * if the field is a repeated message field. + * + * NOTE: Do not set the option in .proto files. Always use the maps syntax + * instead. The option should only be implicitly set by the proto compiler + * parser. + */ + map_entry: boolean; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * + * This should only be used as a temporary measure against broken builds due + * to the change in behavior for JSON field name conflicts. + * + * TODO This is legacy behavior we plan to remove once downstream + * teams have had time to migrate. + */ + /** @deprecated */ + deprecated_legacy_json_field_conflicts: boolean; + /** Any features defined in the specific edition. */ + features?: FeatureSetAmino; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option: UninterpretedOptionAmino[]; +} +export interface MessageOptionsAminoMsg { + type: "/google.protobuf.MessageOptions"; + value: MessageOptionsAmino; +} +export interface FieldOptions { + /** + * The ctype option instructs the C++ code generator to use a different + * representation of the field than it normally would. See the specific + * options below. This option is only implemented to support use of + * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + * type "bytes" in the open source release -- sorry, we'll try to include + * other types in a future version! + */ + ctype: FieldOptions_CType; + /** + * The packed option can be enabled for repeated primitive fields to enable + * a more efficient representation on the wire. Rather than repeatedly + * writing the tag and type for each element, the entire array is encoded as + * a single length-delimited blob. In proto3, only explicit setting it to + * false will avoid using packed encoding. This option is prohibited in + * Editions, but the `repeated_field_encoding` feature can be used to control + * the behavior. + */ + packed: boolean; + /** + * The jstype option determines the JavaScript type used for values of the + * field. The option is permitted only for 64 bit integral and fixed types + * (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING + * is represented as JavaScript string, which avoids loss of precision that + * can happen when a large value is converted to a floating point JavaScript. + * Specifying JS_NUMBER for the jstype causes the generated JavaScript code to + * use the JavaScript "number" type. The behavior of the default option + * JS_NORMAL is implementation dependent. + * + * This option is an enum to permit additional types to be added, e.g. + * goog.math.Integer. + */ + jstype: FieldOptions_JSType; + /** + * Should this field be parsed lazily? Lazy applies only to message-type + * fields. It means that when the outer message is initially parsed, the + * inner message's contents will not be parsed but instead stored in encoded + * form. The inner message will actually be parsed when it is first accessed. + * + * This is only a hint. Implementations are free to choose whether to use + * eager or lazy parsing regardless of the value of this option. However, + * setting this option true suggests that the protocol author believes that + * using lazy parsing on this field is worth the additional bookkeeping + * overhead typically needed to implement it. + * + * This option does not affect the public interface of any generated code; + * all method signatures remain the same. Furthermore, thread-safety of the + * interface is not affected by this option; const methods remain safe to + * call from multiple threads concurrently, while non-const methods continue + * to require exclusive access. + * + * Note that lazy message fields are still eagerly verified to check + * ill-formed wireformat or missing required fields. Calling IsInitialized() + * on the outer message would fail if the inner message has missing required + * fields. Failed verification would result in parsing failure (except when + * uninitialized messages are acceptable). + */ + lazy: boolean; + /** + * unverified_lazy does no correctness checks on the byte stream. This should + * only be used where lazy with verification is prohibitive for performance + * reasons. + */ + unverifiedLazy: boolean; + /** + * Is this field deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for accessors, or it will be completely ignored; in the very least, this + * is a formalization for deprecating fields. + */ + deprecated: boolean; + /** For Google-internal migration only. Do not use. */ + weak: boolean; + /** + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + */ + debugRedact: boolean; + retention: FieldOptions_OptionRetention; + targets: FieldOptions_OptionTargetType[]; + editionDefaults: FieldOptions_EditionDefault[]; + /** Any features defined in the specific edition. */ + features?: FeatureSet; + featureSupport?: FieldOptions_FeatureSupport; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} +export interface FieldOptionsProtoMsg { + typeUrl: "/google.protobuf.FieldOptions"; + value: Uint8Array; +} +export interface FieldOptionsAmino { + /** + * The ctype option instructs the C++ code generator to use a different + * representation of the field than it normally would. See the specific + * options below. This option is only implemented to support use of + * [ctype=CORD] and [ctype=STRING] (the default) on non-repeated fields of + * type "bytes" in the open source release -- sorry, we'll try to include + * other types in a future version! + */ + ctype: FieldOptions_CType; + /** + * The packed option can be enabled for repeated primitive fields to enable + * a more efficient representation on the wire. Rather than repeatedly + * writing the tag and type for each element, the entire array is encoded as + * a single length-delimited blob. In proto3, only explicit setting it to + * false will avoid using packed encoding. This option is prohibited in + * Editions, but the `repeated_field_encoding` feature can be used to control + * the behavior. + */ + packed: boolean; + /** + * The jstype option determines the JavaScript type used for values of the + * field. The option is permitted only for 64 bit integral and fixed types + * (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING + * is represented as JavaScript string, which avoids loss of precision that + * can happen when a large value is converted to a floating point JavaScript. + * Specifying JS_NUMBER for the jstype causes the generated JavaScript code to + * use the JavaScript "number" type. The behavior of the default option + * JS_NORMAL is implementation dependent. + * + * This option is an enum to permit additional types to be added, e.g. + * goog.math.Integer. + */ + jstype: FieldOptions_JSType; + /** + * Should this field be parsed lazily? Lazy applies only to message-type + * fields. It means that when the outer message is initially parsed, the + * inner message's contents will not be parsed but instead stored in encoded + * form. The inner message will actually be parsed when it is first accessed. + * + * This is only a hint. Implementations are free to choose whether to use + * eager or lazy parsing regardless of the value of this option. However, + * setting this option true suggests that the protocol author believes that + * using lazy parsing on this field is worth the additional bookkeeping + * overhead typically needed to implement it. + * + * This option does not affect the public interface of any generated code; + * all method signatures remain the same. Furthermore, thread-safety of the + * interface is not affected by this option; const methods remain safe to + * call from multiple threads concurrently, while non-const methods continue + * to require exclusive access. + * + * Note that lazy message fields are still eagerly verified to check + * ill-formed wireformat or missing required fields. Calling IsInitialized() + * on the outer message would fail if the inner message has missing required + * fields. Failed verification would result in parsing failure (except when + * uninitialized messages are acceptable). + */ + lazy: boolean; + /** + * unverified_lazy does no correctness checks on the byte stream. This should + * only be used where lazy with verification is prohibitive for performance + * reasons. + */ + unverified_lazy: boolean; + /** + * Is this field deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for accessors, or it will be completely ignored; in the very least, this + * is a formalization for deprecating fields. + */ + deprecated: boolean; + /** For Google-internal migration only. Do not use. */ + weak: boolean; + /** + * Indicate that the field value should not be printed out when using debug + * formats, e.g. when the field contains sensitive credentials. + */ + debug_redact: boolean; + retention: FieldOptions_OptionRetention; + targets: FieldOptions_OptionTargetType[]; + edition_defaults: FieldOptions_EditionDefaultAmino[]; + /** Any features defined in the specific edition. */ + features?: FeatureSetAmino; + feature_support?: FieldOptions_FeatureSupportAmino; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option: UninterpretedOptionAmino[]; +} +export interface FieldOptionsAminoMsg { + type: "/google.protobuf.FieldOptions"; + value: FieldOptionsAmino; +} +export interface FieldOptions_EditionDefault { + edition: Edition; + /** Textproto value. */ + value: string; +} +export interface FieldOptions_EditionDefaultProtoMsg { + typeUrl: "/google.protobuf.EditionDefault"; + value: Uint8Array; +} +export interface FieldOptions_EditionDefaultAmino { + edition: Edition; + /** Textproto value. */ + value: string; +} +export interface FieldOptions_EditionDefaultAminoMsg { + type: "/google.protobuf.EditionDefault"; + value: FieldOptions_EditionDefaultAmino; +} +/** Information about the support window of a feature. */ +export interface FieldOptions_FeatureSupport { + /** + * The edition that this feature was first available in. In editions + * earlier than this one, the default assigned to EDITION_LEGACY will be + * used, and proto files will not be able to override it. + */ + editionIntroduced: Edition; + /** + * The edition this feature becomes deprecated in. Using this after this + * edition may trigger warnings. + */ + editionDeprecated: Edition; + /** + * The deprecation warning text if this feature is used after the edition it + * was marked deprecated in. + */ + deprecationWarning: string; + /** + * The edition this feature is no longer available in. In editions after + * this one, the last default assigned will be used, and proto files will + * not be able to override it. + */ + editionRemoved: Edition; +} +export interface FieldOptions_FeatureSupportProtoMsg { + typeUrl: "/google.protobuf.FeatureSupport"; + value: Uint8Array; +} +/** Information about the support window of a feature. */ +export interface FieldOptions_FeatureSupportAmino { + /** + * The edition that this feature was first available in. In editions + * earlier than this one, the default assigned to EDITION_LEGACY will be + * used, and proto files will not be able to override it. + */ + edition_introduced: Edition; + /** + * The edition this feature becomes deprecated in. Using this after this + * edition may trigger warnings. + */ + edition_deprecated: Edition; + /** + * The deprecation warning text if this feature is used after the edition it + * was marked deprecated in. + */ + deprecation_warning: string; + /** + * The edition this feature is no longer available in. In editions after + * this one, the last default assigned will be used, and proto files will + * not be able to override it. + */ + edition_removed: Edition; +} +export interface FieldOptions_FeatureSupportAminoMsg { + type: "/google.protobuf.FeatureSupport"; + value: FieldOptions_FeatureSupportAmino; +} +export interface OneofOptions { + /** Any features defined in the specific edition. */ + features?: FeatureSet; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} +export interface OneofOptionsProtoMsg { + typeUrl: "/google.protobuf.OneofOptions"; + value: Uint8Array; +} +export interface OneofOptionsAmino { + /** Any features defined in the specific edition. */ + features?: FeatureSetAmino; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option: UninterpretedOptionAmino[]; +} +export interface OneofOptionsAminoMsg { + type: "/google.protobuf.OneofOptions"; + value: OneofOptionsAmino; +} +export interface EnumOptions { + /** + * Set this option to true to allow mapping different tag names to the same + * value. + */ + allowAlias: boolean; + /** + * Is this enum deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the enum, or it will be completely ignored; in the very least, this + * is a formalization for deprecating enums. + */ + deprecated: boolean; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * TODO Remove this legacy behavior once downstream teams have + * had time to migrate. + */ + /** @deprecated */ + deprecatedLegacyJsonFieldConflicts: boolean; + /** Any features defined in the specific edition. */ + features?: FeatureSet; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} +export interface EnumOptionsProtoMsg { + typeUrl: "/google.protobuf.EnumOptions"; + value: Uint8Array; +} +export interface EnumOptionsAmino { + /** + * Set this option to true to allow mapping different tag names to the same + * value. + */ + allow_alias: boolean; + /** + * Is this enum deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the enum, or it will be completely ignored; in the very least, this + * is a formalization for deprecating enums. + */ + deprecated: boolean; + /** + * Enable the legacy handling of JSON field name conflicts. This lowercases + * and strips underscored from the fields before comparison in proto3 only. + * The new behavior takes `json_name` into account and applies to proto2 as + * well. + * TODO Remove this legacy behavior once downstream teams have + * had time to migrate. + */ + /** @deprecated */ + deprecated_legacy_json_field_conflicts: boolean; + /** Any features defined in the specific edition. */ + features?: FeatureSetAmino; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option: UninterpretedOptionAmino[]; +} +export interface EnumOptionsAminoMsg { + type: "/google.protobuf.EnumOptions"; + value: EnumOptionsAmino; +} +export interface EnumValueOptions { + /** + * Is this enum value deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the enum value, or it will be completely ignored; in the very least, + * this is a formalization for deprecating enum values. + */ + deprecated: boolean; + /** Any features defined in the specific edition. */ + features?: FeatureSet; + /** + * Indicate that fields annotated with this enum value should not be printed + * out when using debug formats, e.g. when the field contains sensitive + * credentials. + */ + debugRedact: boolean; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} +export interface EnumValueOptionsProtoMsg { + typeUrl: "/google.protobuf.EnumValueOptions"; + value: Uint8Array; +} +export interface EnumValueOptionsAmino { + /** + * Is this enum value deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the enum value, or it will be completely ignored; in the very least, + * this is a formalization for deprecating enum values. + */ + deprecated: boolean; + /** Any features defined in the specific edition. */ + features?: FeatureSetAmino; + /** + * Indicate that fields annotated with this enum value should not be printed + * out when using debug formats, e.g. when the field contains sensitive + * credentials. + */ + debug_redact: boolean; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option: UninterpretedOptionAmino[]; +} +export interface EnumValueOptionsAminoMsg { + type: "/google.protobuf.EnumValueOptions"; + value: EnumValueOptionsAmino; +} +export interface ServiceOptions { + /** Any features defined in the specific edition. */ + features?: FeatureSet; + /** + * Is this service deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the service, or it will be completely ignored; in the very least, + * this is a formalization for deprecating services. + */ + deprecated: boolean; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} +export interface ServiceOptionsProtoMsg { + typeUrl: "/google.protobuf.ServiceOptions"; + value: Uint8Array; +} +export interface ServiceOptionsAmino { + /** Any features defined in the specific edition. */ + features?: FeatureSetAmino; + /** + * Is this service deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the service, or it will be completely ignored; in the very least, + * this is a formalization for deprecating services. + */ + deprecated: boolean; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option: UninterpretedOptionAmino[]; +} +export interface ServiceOptionsAminoMsg { + type: "/google.protobuf.ServiceOptions"; + value: ServiceOptionsAmino; +} +export interface MethodOptions { + /** + * Is this method deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the method, or it will be completely ignored; in the very least, + * this is a formalization for deprecating methods. + */ + deprecated: boolean; + idempotencyLevel: MethodOptions_IdempotencyLevel; + /** Any features defined in the specific edition. */ + features?: FeatureSet; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} +export interface MethodOptionsProtoMsg { + typeUrl: "/google.protobuf.MethodOptions"; + value: Uint8Array; +} +export interface MethodOptionsAmino { + /** + * Is this method deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the method, or it will be completely ignored; in the very least, + * this is a formalization for deprecating methods. + */ + deprecated: boolean; + idempotency_level: MethodOptions_IdempotencyLevel; + /** Any features defined in the specific edition. */ + features?: FeatureSetAmino; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpreted_option: UninterpretedOptionAmino[]; +} +export interface MethodOptionsAminoMsg { + type: "/google.protobuf.MethodOptions"; + value: MethodOptionsAmino; +} +/** + * A message representing a option the parser does not recognize. This only + * appears in options protos created by the compiler::Parser class. + * DescriptorPool resolves these when building Descriptor objects. Therefore, + * options protos in descriptor objects (e.g. returned by Descriptor::options(), + * or produced by Descriptor::CopyTo()) will never have UninterpretedOptions + * in them. + */ +export interface UninterpretedOption { + name: UninterpretedOption_NamePart[]; + /** + * The value of the uninterpreted option, in whatever type the tokenizer + * identified it as during parsing. Exactly one of these should be set. + */ + identifierValue: string; + positiveIntValue: bigint; + negativeIntValue: bigint; + doubleValue: number; + stringValue: Uint8Array; + aggregateValue: string; +} +export interface UninterpretedOptionProtoMsg { + typeUrl: "/google.protobuf.UninterpretedOption"; + value: Uint8Array; +} +/** + * A message representing a option the parser does not recognize. This only + * appears in options protos created by the compiler::Parser class. + * DescriptorPool resolves these when building Descriptor objects. Therefore, + * options protos in descriptor objects (e.g. returned by Descriptor::options(), + * or produced by Descriptor::CopyTo()) will never have UninterpretedOptions + * in them. + */ +export interface UninterpretedOptionAmino { + name: UninterpretedOption_NamePartAmino[]; + /** + * The value of the uninterpreted option, in whatever type the tokenizer + * identified it as during parsing. Exactly one of these should be set. + */ + identifier_value: string; + positive_int_value: string; + negative_int_value: string; + double_value: number; + string_value: string; + aggregate_value: string; +} +export interface UninterpretedOptionAminoMsg { + type: "/google.protobuf.UninterpretedOption"; + value: UninterpretedOptionAmino; +} +/** + * The name of the uninterpreted option. Each string represents a segment in + * a dot-separated name. is_extension is true iff a segment represents an + * extension (denoted with parentheses in options specs in .proto files). + * E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents + * "foo.(bar.baz).moo". + */ +export interface UninterpretedOption_NamePart { + namePart: string; + isExtension: boolean; +} +export interface UninterpretedOption_NamePartProtoMsg { + typeUrl: "/google.protobuf.NamePart"; + value: Uint8Array; +} +/** + * The name of the uninterpreted option. Each string represents a segment in + * a dot-separated name. is_extension is true iff a segment represents an + * extension (denoted with parentheses in options specs in .proto files). + * E.g.,{ ["foo", false], ["bar.baz", true], ["moo", false] } represents + * "foo.(bar.baz).moo". + */ +export interface UninterpretedOption_NamePartAmino { + name_part: string; + is_extension: boolean; +} +export interface UninterpretedOption_NamePartAminoMsg { + type: "/google.protobuf.NamePart"; + value: UninterpretedOption_NamePartAmino; +} +/** + * TODO Enums in C++ gencode (and potentially other languages) are + * not well scoped. This means that each of the feature enums below can clash + * with each other. The short names we've chosen maximize call-site + * readability, but leave us very open to this scenario. A future feature will + * be designed and implemented to handle this, hopefully before we ever hit a + * conflict here. + */ +export interface FeatureSet { + fieldPresence: FeatureSet_FieldPresence; + enumType: FeatureSet_EnumType; + repeatedFieldEncoding: FeatureSet_RepeatedFieldEncoding; + utf8Validation: FeatureSet_Utf8Validation; + messageEncoding: FeatureSet_MessageEncoding; + jsonFormat: FeatureSet_JsonFormat; +} +export interface FeatureSetProtoMsg { + typeUrl: "/google.protobuf.FeatureSet"; + value: Uint8Array; +} +/** + * TODO Enums in C++ gencode (and potentially other languages) are + * not well scoped. This means that each of the feature enums below can clash + * with each other. The short names we've chosen maximize call-site + * readability, but leave us very open to this scenario. A future feature will + * be designed and implemented to handle this, hopefully before we ever hit a + * conflict here. + */ +export interface FeatureSetAmino { + field_presence: FeatureSet_FieldPresence; + enum_type: FeatureSet_EnumType; + repeated_field_encoding: FeatureSet_RepeatedFieldEncoding; + utf8_validation: FeatureSet_Utf8Validation; + message_encoding: FeatureSet_MessageEncoding; + json_format: FeatureSet_JsonFormat; +} +export interface FeatureSetAminoMsg { + type: "/google.protobuf.FeatureSet"; + value: FeatureSetAmino; +} +/** + * A compiled specification for the defaults of a set of features. These + * messages are generated from FeatureSet extensions and can be used to seed + * feature resolution. The resolution with this object becomes a simple search + * for the closest matching edition, followed by proto merges. + */ +export interface FeatureSetDefaults { + defaults: FeatureSetDefaults_FeatureSetEditionDefault[]; + /** + * The minimum supported edition (inclusive) when this was constructed. + * Editions before this will not have defaults. + */ + minimumEdition: Edition; + /** + * The maximum known edition (inclusive) when this was constructed. Editions + * after this will not have reliable defaults. + */ + maximumEdition: Edition; +} +export interface FeatureSetDefaultsProtoMsg { + typeUrl: "/google.protobuf.FeatureSetDefaults"; + value: Uint8Array; +} +/** + * A compiled specification for the defaults of a set of features. These + * messages are generated from FeatureSet extensions and can be used to seed + * feature resolution. The resolution with this object becomes a simple search + * for the closest matching edition, followed by proto merges. + */ +export interface FeatureSetDefaultsAmino { + defaults: FeatureSetDefaults_FeatureSetEditionDefaultAmino[]; + /** + * The minimum supported edition (inclusive) when this was constructed. + * Editions before this will not have defaults. + */ + minimum_edition: Edition; + /** + * The maximum known edition (inclusive) when this was constructed. Editions + * after this will not have reliable defaults. + */ + maximum_edition: Edition; +} +export interface FeatureSetDefaultsAminoMsg { + type: "/google.protobuf.FeatureSetDefaults"; + value: FeatureSetDefaultsAmino; +} +/** + * A map from every known edition with a unique set of defaults to its + * defaults. Not all editions may be contained here. For a given edition, + * the defaults at the closest matching edition ordered at or before it should + * be used. This field must be in strict ascending order by edition. + */ +export interface FeatureSetDefaults_FeatureSetEditionDefault { + edition: Edition; + /** Defaults of features that can be overridden in this edition. */ + overridableFeatures?: FeatureSet; + /** Defaults of features that can't be overridden in this edition. */ + fixedFeatures?: FeatureSet; +} +export interface FeatureSetDefaults_FeatureSetEditionDefaultProtoMsg { + typeUrl: "/google.protobuf.FeatureSetEditionDefault"; + value: Uint8Array; +} +/** + * A map from every known edition with a unique set of defaults to its + * defaults. Not all editions may be contained here. For a given edition, + * the defaults at the closest matching edition ordered at or before it should + * be used. This field must be in strict ascending order by edition. + */ +export interface FeatureSetDefaults_FeatureSetEditionDefaultAmino { + edition: Edition; + /** Defaults of features that can be overridden in this edition. */ + overridable_features?: FeatureSetAmino; + /** Defaults of features that can't be overridden in this edition. */ + fixed_features?: FeatureSetAmino; +} +export interface FeatureSetDefaults_FeatureSetEditionDefaultAminoMsg { + type: "/google.protobuf.FeatureSetEditionDefault"; + value: FeatureSetDefaults_FeatureSetEditionDefaultAmino; +} +/** + * Encapsulates information about the original source file from which a + * FileDescriptorProto was generated. + */ +export interface SourceCodeInfo { + /** + * A Location identifies a piece of source code in a .proto file which + * corresponds to a particular definition. This information is intended + * to be useful to IDEs, code indexers, documentation generators, and similar + * tools. + * + * For example, say we have a file like: + * message Foo { + * optional string foo = 1; + * } + * Let's look at just the field definition: + * optional string foo = 1; + * ^ ^^ ^^ ^ ^^^ + * a bc de f ghi + * We have the following locations: + * span path represents + * [a,i) [ 4, 0, 2, 0 ] The whole field definition. + * [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). + * [c,d) [ 4, 0, 2, 0, 5 ] The type (string). + * [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). + * [g,h) [ 4, 0, 2, 0, 3 ] The number (1). + * + * Notes: + * - A location may refer to a repeated field itself (i.e. not to any + * particular index within it). This is used whenever a set of elements are + * logically enclosed in a single code segment. For example, an entire + * extend block (possibly containing multiple extension definitions) will + * have an outer location whose path refers to the "extensions" repeated + * field without an index. + * - Multiple locations may have the same path. This happens when a single + * logical declaration is spread out across multiple places. The most + * obvious example is the "extend" block again -- there may be multiple + * extend blocks in the same scope, each of which will have the same path. + * - A location's span is not always a subset of its parent's span. For + * example, the "extendee" of an extension declaration appears at the + * beginning of the "extend" block and is shared by all extensions within + * the block. + * - Just because a location's span is a subset of some other location's span + * does not mean that it is a descendant. For example, a "group" defines + * both a type and a field in a single declaration. Thus, the locations + * corresponding to the type and field and their components will overlap. + * - Code which tries to interpret locations should probably be designed to + * ignore those that it doesn't understand, as more types of locations could + * be recorded in the future. + */ + location: SourceCodeInfo_Location[]; +} +export interface SourceCodeInfoProtoMsg { + typeUrl: "/google.protobuf.SourceCodeInfo"; + value: Uint8Array; +} +/** + * Encapsulates information about the original source file from which a + * FileDescriptorProto was generated. + */ +export interface SourceCodeInfoAmino { + /** + * A Location identifies a piece of source code in a .proto file which + * corresponds to a particular definition. This information is intended + * to be useful to IDEs, code indexers, documentation generators, and similar + * tools. + * + * For example, say we have a file like: + * message Foo { + * optional string foo = 1; + * } + * Let's look at just the field definition: + * optional string foo = 1; + * ^ ^^ ^^ ^ ^^^ + * a bc de f ghi + * We have the following locations: + * span path represents + * [a,i) [ 4, 0, 2, 0 ] The whole field definition. + * [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). + * [c,d) [ 4, 0, 2, 0, 5 ] The type (string). + * [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). + * [g,h) [ 4, 0, 2, 0, 3 ] The number (1). + * + * Notes: + * - A location may refer to a repeated field itself (i.e. not to any + * particular index within it). This is used whenever a set of elements are + * logically enclosed in a single code segment. For example, an entire + * extend block (possibly containing multiple extension definitions) will + * have an outer location whose path refers to the "extensions" repeated + * field without an index. + * - Multiple locations may have the same path. This happens when a single + * logical declaration is spread out across multiple places. The most + * obvious example is the "extend" block again -- there may be multiple + * extend blocks in the same scope, each of which will have the same path. + * - A location's span is not always a subset of its parent's span. For + * example, the "extendee" of an extension declaration appears at the + * beginning of the "extend" block and is shared by all extensions within + * the block. + * - Just because a location's span is a subset of some other location's span + * does not mean that it is a descendant. For example, a "group" defines + * both a type and a field in a single declaration. Thus, the locations + * corresponding to the type and field and their components will overlap. + * - Code which tries to interpret locations should probably be designed to + * ignore those that it doesn't understand, as more types of locations could + * be recorded in the future. + */ + location: SourceCodeInfo_LocationAmino[]; +} +export interface SourceCodeInfoAminoMsg { + type: "/google.protobuf.SourceCodeInfo"; + value: SourceCodeInfoAmino; +} +export interface SourceCodeInfo_Location { + /** + * Identifies which part of the FileDescriptorProto was defined at this + * location. + * + * Each element is a field number or an index. They form a path from + * the root FileDescriptorProto to the place where the definition appears. + * For example, this path: + * [ 4, 3, 2, 7, 1 ] + * refers to: + * file.message_type(3) // 4, 3 + * .field(7) // 2, 7 + * .name() // 1 + * This is because FileDescriptorProto.message_type has field number 4: + * repeated DescriptorProto message_type = 4; + * and DescriptorProto.field has field number 2: + * repeated FieldDescriptorProto field = 2; + * and FieldDescriptorProto.name has field number 1: + * optional string name = 1; + * + * Thus, the above path gives the location of a field name. If we removed + * the last element: + * [ 4, 3, 2, 7 ] + * this path refers to the whole field declaration (from the beginning + * of the label to the terminating semicolon). + */ + path: number[]; + /** + * Always has exactly three or four elements: start line, start column, + * end line (optional, otherwise assumed same as start line), end column. + * These are packed into a single field for efficiency. Note that line + * and column numbers are zero-based -- typically you will want to add + * 1 to each before displaying to a user. + */ + span: number[]; + /** + * If this SourceCodeInfo represents a complete declaration, these are any + * comments appearing before and after the declaration which appear to be + * attached to the declaration. + * + * A series of line comments appearing on consecutive lines, with no other + * tokens appearing on those lines, will be treated as a single comment. + * + * leading_detached_comments will keep paragraphs of comments that appear + * before (but not connected to) the current element. Each paragraph, + * separated by empty lines, will be one comment element in the repeated + * field. + * + * Only the comment content is provided; comment markers (e.g. //) are + * stripped out. For block comments, leading whitespace and an asterisk + * will be stripped from the beginning of each line other than the first. + * Newlines are included in the output. + * + * Examples: + * + * optional int32 foo = 1; // Comment attached to foo. + * // Comment attached to bar. + * optional int32 bar = 2; + * + * optional string baz = 3; + * // Comment attached to baz. + * // Another line attached to baz. + * + * // Comment attached to moo. + * // + * // Another line attached to moo. + * optional double moo = 4; + * + * // Detached comment for corge. This is not leading or trailing comments + * // to moo or corge because there are blank lines separating it from + * // both. + * + * // Detached comment for corge paragraph 2. + * + * optional string corge = 5; + * /* Block comment attached + * * to corge. Leading asterisks + * * will be removed. *\/ + * /* Block comment attached to + * * grault. *\/ + * optional int32 grault = 6; + * + * // ignored detached comments. + */ + leadingComments: string; + trailingComments: string; + leadingDetachedComments: string[]; +} +export interface SourceCodeInfo_LocationProtoMsg { + typeUrl: "/google.protobuf.Location"; + value: Uint8Array; +} +export interface SourceCodeInfo_LocationAmino { + /** + * Identifies which part of the FileDescriptorProto was defined at this + * location. + * + * Each element is a field number or an index. They form a path from + * the root FileDescriptorProto to the place where the definition appears. + * For example, this path: + * [ 4, 3, 2, 7, 1 ] + * refers to: + * file.message_type(3) // 4, 3 + * .field(7) // 2, 7 + * .name() // 1 + * This is because FileDescriptorProto.message_type has field number 4: + * repeated DescriptorProto message_type = 4; + * and DescriptorProto.field has field number 2: + * repeated FieldDescriptorProto field = 2; + * and FieldDescriptorProto.name has field number 1: + * optional string name = 1; + * + * Thus, the above path gives the location of a field name. If we removed + * the last element: + * [ 4, 3, 2, 7 ] + * this path refers to the whole field declaration (from the beginning + * of the label to the terminating semicolon). + */ + path: number[]; + /** + * Always has exactly three or four elements: start line, start column, + * end line (optional, otherwise assumed same as start line), end column. + * These are packed into a single field for efficiency. Note that line + * and column numbers are zero-based -- typically you will want to add + * 1 to each before displaying to a user. + */ + span: number[]; + /** + * If this SourceCodeInfo represents a complete declaration, these are any + * comments appearing before and after the declaration which appear to be + * attached to the declaration. + * + * A series of line comments appearing on consecutive lines, with no other + * tokens appearing on those lines, will be treated as a single comment. + * + * leading_detached_comments will keep paragraphs of comments that appear + * before (but not connected to) the current element. Each paragraph, + * separated by empty lines, will be one comment element in the repeated + * field. + * + * Only the comment content is provided; comment markers (e.g. //) are + * stripped out. For block comments, leading whitespace and an asterisk + * will be stripped from the beginning of each line other than the first. + * Newlines are included in the output. + * + * Examples: + * + * optional int32 foo = 1; // Comment attached to foo. + * // Comment attached to bar. + * optional int32 bar = 2; + * + * optional string baz = 3; + * // Comment attached to baz. + * // Another line attached to baz. + * + * // Comment attached to moo. + * // + * // Another line attached to moo. + * optional double moo = 4; + * + * // Detached comment for corge. This is not leading or trailing comments + * // to moo or corge because there are blank lines separating it from + * // both. + * + * // Detached comment for corge paragraph 2. + * + * optional string corge = 5; + * /* Block comment attached + * * to corge. Leading asterisks + * * will be removed. *\/ + * /* Block comment attached to + * * grault. *\/ + * optional int32 grault = 6; + * + * // ignored detached comments. + */ + leading_comments: string; + trailing_comments: string; + leading_detached_comments: string[]; +} +export interface SourceCodeInfo_LocationAminoMsg { + type: "/google.protobuf.Location"; + value: SourceCodeInfo_LocationAmino; +} +/** + * Describes the relationship between generated code and its original source + * file. A GeneratedCodeInfo message is associated with only one generated + * source file, but may contain references to different source .proto files. + */ +export interface GeneratedCodeInfo { + /** + * An Annotation connects some span of text in generated code to an element + * of its generating .proto file. + */ + annotation: GeneratedCodeInfo_Annotation[]; +} +export interface GeneratedCodeInfoProtoMsg { + typeUrl: "/google.protobuf.GeneratedCodeInfo"; + value: Uint8Array; +} +/** + * Describes the relationship between generated code and its original source + * file. A GeneratedCodeInfo message is associated with only one generated + * source file, but may contain references to different source .proto files. + */ +export interface GeneratedCodeInfoAmino { + /** + * An Annotation connects some span of text in generated code to an element + * of its generating .proto file. + */ + annotation: GeneratedCodeInfo_AnnotationAmino[]; +} +export interface GeneratedCodeInfoAminoMsg { + type: "/google.protobuf.GeneratedCodeInfo"; + value: GeneratedCodeInfoAmino; +} +export interface GeneratedCodeInfo_Annotation { + /** + * Identifies the element in the original source .proto file. This field + * is formatted the same as SourceCodeInfo.Location.path. + */ + path: number[]; + /** Identifies the filesystem path to the original source .proto. */ + sourceFile: string; + /** + * Identifies the starting offset in bytes in the generated code + * that relates to the identified object. + */ + begin: number; + /** + * Identifies the ending offset in bytes in the generated code that + * relates to the identified object. The end offset should be one past + * the last relevant byte (so the length of the text = end - begin). + */ + end: number; + semantic: GeneratedCodeInfo_Annotation_Semantic; +} +export interface GeneratedCodeInfo_AnnotationProtoMsg { + typeUrl: "/google.protobuf.Annotation"; + value: Uint8Array; +} +export interface GeneratedCodeInfo_AnnotationAmino { + /** + * Identifies the element in the original source .proto file. This field + * is formatted the same as SourceCodeInfo.Location.path. + */ + path: number[]; + /** Identifies the filesystem path to the original source .proto. */ + source_file: string; + /** + * Identifies the starting offset in bytes in the generated code + * that relates to the identified object. + */ + begin: number; + /** + * Identifies the ending offset in bytes in the generated code that + * relates to the identified object. The end offset should be one past + * the last relevant byte (so the length of the text = end - begin). + */ + end: number; + semantic: GeneratedCodeInfo_Annotation_Semantic; +} +export interface GeneratedCodeInfo_AnnotationAminoMsg { + type: "/google.protobuf.Annotation"; + value: GeneratedCodeInfo_AnnotationAmino; +} +function createBaseFileDescriptorSet(): FileDescriptorSet { + return { + file: [] + }; +} +export const FileDescriptorSet = { + typeUrl: "/google.protobuf.FileDescriptorSet", + is(o: any): o is FileDescriptorSet { + return o && (o.$typeUrl === FileDescriptorSet.typeUrl || Array.isArray(o.file) && (!o.file.length || FileDescriptorProto.is(o.file[0]))); + }, + isAmino(o: any): o is FileDescriptorSetAmino { + return o && (o.$typeUrl === FileDescriptorSet.typeUrl || Array.isArray(o.file) && (!o.file.length || FileDescriptorProto.isAmino(o.file[0]))); + }, + encode(message: FileDescriptorSet, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.file) { + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFileDescriptorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.file.push(FileDescriptorProto.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): FileDescriptorSet { + const message = createBaseFileDescriptorSet(); + message.file = object.file?.map(e => FileDescriptorProto.fromPartial(e)) || []; + return message; + }, + fromAmino(object: FileDescriptorSetAmino): FileDescriptorSet { + const message = createBaseFileDescriptorSet(); + message.file = object.file?.map(e => FileDescriptorProto.fromAmino(e)) || []; + return message; + }, + toAmino(message: FileDescriptorSet): FileDescriptorSetAmino { + const obj: any = {}; + if (message.file) { + obj.file = message.file.map(e => e ? FileDescriptorProto.toAmino(e) : undefined); + } else { + obj.file = message.file; + } + return obj; + }, + fromAminoMsg(object: FileDescriptorSetAminoMsg): FileDescriptorSet { + return FileDescriptorSet.fromAmino(object.value); + }, + fromProtoMsg(message: FileDescriptorSetProtoMsg): FileDescriptorSet { + return FileDescriptorSet.decode(message.value); + }, + toProto(message: FileDescriptorSet): Uint8Array { + return FileDescriptorSet.encode(message).finish(); + }, + toProtoMsg(message: FileDescriptorSet): FileDescriptorSetProtoMsg { + return { + typeUrl: "/google.protobuf.FileDescriptorSet", + value: FileDescriptorSet.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(FileDescriptorSet.typeUrl, FileDescriptorSet); +function createBaseFileDescriptorProto(): FileDescriptorProto { + return { + name: "", + package: "", + dependency: [], + publicDependency: [], + weakDependency: [], + messageType: [], + enumType: [], + service: [], + extension: [], + options: undefined, + sourceCodeInfo: undefined, + syntax: "", + edition: 1 + }; +} +export const FileDescriptorProto = { + typeUrl: "/google.protobuf.FileDescriptorProto", + is(o: any): o is FileDescriptorProto { + return o && (o.$typeUrl === FileDescriptorProto.typeUrl || typeof o.name === "string" && typeof o.package === "string" && Array.isArray(o.dependency) && (!o.dependency.length || typeof o.dependency[0] === "string") && Array.isArray(o.publicDependency) && (!o.publicDependency.length || typeof o.publicDependency[0] === "number") && Array.isArray(o.weakDependency) && (!o.weakDependency.length || typeof o.weakDependency[0] === "number") && Array.isArray(o.messageType) && (!o.messageType.length || DescriptorProto.is(o.messageType[0])) && Array.isArray(o.enumType) && (!o.enumType.length || EnumDescriptorProto.is(o.enumType[0])) && Array.isArray(o.service) && (!o.service.length || ServiceDescriptorProto.is(o.service[0])) && Array.isArray(o.extension) && (!o.extension.length || FieldDescriptorProto.is(o.extension[0])) && typeof o.syntax === "string" && isSet(o.edition)); + }, + isAmino(o: any): o is FileDescriptorProtoAmino { + return o && (o.$typeUrl === FileDescriptorProto.typeUrl || typeof o.name === "string" && typeof o.package === "string" && Array.isArray(o.dependency) && (!o.dependency.length || typeof o.dependency[0] === "string") && Array.isArray(o.public_dependency) && (!o.public_dependency.length || typeof o.public_dependency[0] === "number") && Array.isArray(o.weak_dependency) && (!o.weak_dependency.length || typeof o.weak_dependency[0] === "number") && Array.isArray(o.message_type) && (!o.message_type.length || DescriptorProto.isAmino(o.message_type[0])) && Array.isArray(o.enum_type) && (!o.enum_type.length || EnumDescriptorProto.isAmino(o.enum_type[0])) && Array.isArray(o.service) && (!o.service.length || ServiceDescriptorProto.isAmino(o.service[0])) && Array.isArray(o.extension) && (!o.extension.length || FieldDescriptorProto.isAmino(o.extension[0])) && typeof o.syntax === "string" && isSet(o.edition)); + }, + encode(message: FileDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.package !== "") { + writer.uint32(18).string(message.package); + } + for (const v of message.dependency) { + writer.uint32(26).string(v!); + } + writer.uint32(82).fork(); + for (const v of message.publicDependency) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(90).fork(); + for (const v of message.weakDependency) { + writer.int32(v); + } + writer.ldelim(); + for (const v of message.messageType) { + DescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + } + for (const v of message.enumType) { + EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.service) { + ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.extension) { + FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).ldelim(); + } + if (message.options !== undefined) { + FileOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + } + if (message.sourceCodeInfo !== undefined) { + SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).ldelim(); + } + if (message.syntax !== "") { + writer.uint32(98).string(message.syntax); + } + if (message.edition !== 1) { + writer.uint32(112).int32(message.edition); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFileDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.package = reader.string(); + break; + case 3: + message.dependency.push(reader.string()); + break; + case 10: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.publicDependency.push(reader.int32()); + } + } else { + message.publicDependency.push(reader.int32()); + } + break; + case 11: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.weakDependency.push(reader.int32()); + } + } else { + message.weakDependency.push(reader.int32()); + } + break; + case 4: + message.messageType.push(DescriptorProto.decode(reader, reader.uint32())); + break; + case 5: + message.enumType.push(EnumDescriptorProto.decode(reader, reader.uint32())); + break; + case 6: + message.service.push(ServiceDescriptorProto.decode(reader, reader.uint32())); + break; + case 7: + message.extension.push(FieldDescriptorProto.decode(reader, reader.uint32())); + break; + case 8: + message.options = FileOptions.decode(reader, reader.uint32()); + break; + case 9: + message.sourceCodeInfo = SourceCodeInfo.decode(reader, reader.uint32()); + break; + case 12: + message.syntax = reader.string(); + break; + case 14: + message.edition = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): FileDescriptorProto { + const message = createBaseFileDescriptorProto(); + message.name = object.name ?? ""; + message.package = object.package ?? ""; + message.dependency = object.dependency?.map(e => e) || []; + message.publicDependency = object.publicDependency?.map(e => e) || []; + message.weakDependency = object.weakDependency?.map(e => e) || []; + message.messageType = object.messageType?.map(e => DescriptorProto.fromPartial(e)) || []; + message.enumType = object.enumType?.map(e => EnumDescriptorProto.fromPartial(e)) || []; + message.service = object.service?.map(e => ServiceDescriptorProto.fromPartial(e)) || []; + message.extension = object.extension?.map(e => FieldDescriptorProto.fromPartial(e)) || []; + message.options = object.options !== undefined && object.options !== null ? FileOptions.fromPartial(object.options) : undefined; + message.sourceCodeInfo = object.sourceCodeInfo !== undefined && object.sourceCodeInfo !== null ? SourceCodeInfo.fromPartial(object.sourceCodeInfo) : undefined; + message.syntax = object.syntax ?? ""; + message.edition = object.edition ?? 1; + return message; + }, + fromAmino(object: FileDescriptorProtoAmino): FileDescriptorProto { + const message = createBaseFileDescriptorProto(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.package !== undefined && object.package !== null) { + message.package = object.package; + } + message.dependency = object.dependency?.map(e => e) || []; + message.publicDependency = object.public_dependency?.map(e => e) || []; + message.weakDependency = object.weak_dependency?.map(e => e) || []; + message.messageType = object.message_type?.map(e => DescriptorProto.fromAmino(e)) || []; + message.enumType = object.enum_type?.map(e => EnumDescriptorProto.fromAmino(e)) || []; + message.service = object.service?.map(e => ServiceDescriptorProto.fromAmino(e)) || []; + message.extension = object.extension?.map(e => FieldDescriptorProto.fromAmino(e)) || []; + if (object.options !== undefined && object.options !== null) { + message.options = FileOptions.fromAmino(object.options); + } + if (object.source_code_info !== undefined && object.source_code_info !== null) { + message.sourceCodeInfo = SourceCodeInfo.fromAmino(object.source_code_info); + } + if (object.syntax !== undefined && object.syntax !== null) { + message.syntax = object.syntax; + } + if (object.edition !== undefined && object.edition !== null) { + message.edition = object.edition; + } + return message; + }, + toAmino(message: FileDescriptorProto): FileDescriptorProtoAmino { + const obj: any = {}; + obj.name = message.name === "" ? undefined : message.name; + obj.package = message.package === "" ? undefined : message.package; + if (message.dependency) { + obj.dependency = message.dependency.map(e => e); + } else { + obj.dependency = message.dependency; + } + if (message.publicDependency) { + obj.public_dependency = message.publicDependency.map(e => e); + } else { + obj.public_dependency = message.publicDependency; + } + if (message.weakDependency) { + obj.weak_dependency = message.weakDependency.map(e => e); + } else { + obj.weak_dependency = message.weakDependency; + } + if (message.messageType) { + obj.message_type = message.messageType.map(e => e ? DescriptorProto.toAmino(e) : undefined); + } else { + obj.message_type = message.messageType; + } + if (message.enumType) { + obj.enum_type = message.enumType.map(e => e ? EnumDescriptorProto.toAmino(e) : undefined); + } else { + obj.enum_type = message.enumType; + } + if (message.service) { + obj.service = message.service.map(e => e ? ServiceDescriptorProto.toAmino(e) : undefined); + } else { + obj.service = message.service; + } + if (message.extension) { + obj.extension = message.extension.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); + } else { + obj.extension = message.extension; + } + obj.options = message.options ? FileOptions.toAmino(message.options) : undefined; + obj.source_code_info = message.sourceCodeInfo ? SourceCodeInfo.toAmino(message.sourceCodeInfo) : undefined; + obj.syntax = message.syntax === "" ? undefined : message.syntax; + obj.edition = message.edition === 1 ? undefined : message.edition; + return obj; + }, + fromAminoMsg(object: FileDescriptorProtoAminoMsg): FileDescriptorProto { + return FileDescriptorProto.fromAmino(object.value); + }, + fromProtoMsg(message: FileDescriptorProtoProtoMsg): FileDescriptorProto { + return FileDescriptorProto.decode(message.value); + }, + toProto(message: FileDescriptorProto): Uint8Array { + return FileDescriptorProto.encode(message).finish(); + }, + toProtoMsg(message: FileDescriptorProto): FileDescriptorProtoProtoMsg { + return { + typeUrl: "/google.protobuf.FileDescriptorProto", + value: FileDescriptorProto.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(FileDescriptorProto.typeUrl, FileDescriptorProto); +function createBaseDescriptorProto(): DescriptorProto { + return { + name: "", + field: [], + extension: [], + nestedType: [], + enumType: [], + extensionRange: [], + oneofDecl: [], + options: undefined, + reservedRange: [], + reservedName: [] + }; +} +export const DescriptorProto = { + typeUrl: "/google.protobuf.DescriptorProto", + is(o: any): o is DescriptorProto { + return o && (o.$typeUrl === DescriptorProto.typeUrl || typeof o.name === "string" && Array.isArray(o.field) && (!o.field.length || FieldDescriptorProto.is(o.field[0])) && Array.isArray(o.extension) && (!o.extension.length || FieldDescriptorProto.is(o.extension[0])) && Array.isArray(o.nestedType) && (!o.nestedType.length || DescriptorProto.is(o.nestedType[0])) && Array.isArray(o.enumType) && (!o.enumType.length || EnumDescriptorProto.is(o.enumType[0])) && Array.isArray(o.extensionRange) && (!o.extensionRange.length || DescriptorProto_ExtensionRange.is(o.extensionRange[0])) && Array.isArray(o.oneofDecl) && (!o.oneofDecl.length || OneofDescriptorProto.is(o.oneofDecl[0])) && Array.isArray(o.reservedRange) && (!o.reservedRange.length || DescriptorProto_ReservedRange.is(o.reservedRange[0])) && Array.isArray(o.reservedName) && (!o.reservedName.length || typeof o.reservedName[0] === "string")); + }, + isAmino(o: any): o is DescriptorProtoAmino { + return o && (o.$typeUrl === DescriptorProto.typeUrl || typeof o.name === "string" && Array.isArray(o.field) && (!o.field.length || FieldDescriptorProto.isAmino(o.field[0])) && Array.isArray(o.extension) && (!o.extension.length || FieldDescriptorProto.isAmino(o.extension[0])) && Array.isArray(o.nested_type) && (!o.nested_type.length || DescriptorProto.isAmino(o.nested_type[0])) && Array.isArray(o.enum_type) && (!o.enum_type.length || EnumDescriptorProto.isAmino(o.enum_type[0])) && Array.isArray(o.extension_range) && (!o.extension_range.length || DescriptorProto_ExtensionRange.isAmino(o.extension_range[0])) && Array.isArray(o.oneof_decl) && (!o.oneof_decl.length || OneofDescriptorProto.isAmino(o.oneof_decl[0])) && Array.isArray(o.reserved_range) && (!o.reserved_range.length || DescriptorProto_ReservedRange.isAmino(o.reserved_range[0])) && Array.isArray(o.reserved_name) && (!o.reserved_name.length || typeof o.reserved_name[0] === "string")); + }, + encode(message: DescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.field) { + FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.extension) { + FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.nestedType) { + DescriptorProto.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.enumType) { + EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + } + for (const v of message.extensionRange) { + DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.oneofDecl) { + OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).ldelim(); + } + if (message.options !== undefined) { + MessageOptions.encode(message.options, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.reservedRange) { + DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).ldelim(); + } + for (const v of message.reservedName) { + writer.uint32(82).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.field.push(FieldDescriptorProto.decode(reader, reader.uint32())); + break; + case 6: + message.extension.push(FieldDescriptorProto.decode(reader, reader.uint32())); + break; + case 3: + message.nestedType.push(DescriptorProto.decode(reader, reader.uint32())); + break; + case 4: + message.enumType.push(EnumDescriptorProto.decode(reader, reader.uint32())); + break; + case 5: + message.extensionRange.push(DescriptorProto_ExtensionRange.decode(reader, reader.uint32())); + break; + case 8: + message.oneofDecl.push(OneofDescriptorProto.decode(reader, reader.uint32())); + break; + case 7: + message.options = MessageOptions.decode(reader, reader.uint32()); + break; + case 9: + message.reservedRange.push(DescriptorProto_ReservedRange.decode(reader, reader.uint32())); + break; + case 10: + message.reservedName.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): DescriptorProto { + const message = createBaseDescriptorProto(); + message.name = object.name ?? ""; + message.field = object.field?.map(e => FieldDescriptorProto.fromPartial(e)) || []; + message.extension = object.extension?.map(e => FieldDescriptorProto.fromPartial(e)) || []; + message.nestedType = object.nestedType?.map(e => DescriptorProto.fromPartial(e)) || []; + message.enumType = object.enumType?.map(e => EnumDescriptorProto.fromPartial(e)) || []; + message.extensionRange = object.extensionRange?.map(e => DescriptorProto_ExtensionRange.fromPartial(e)) || []; + message.oneofDecl = object.oneofDecl?.map(e => OneofDescriptorProto.fromPartial(e)) || []; + message.options = object.options !== undefined && object.options !== null ? MessageOptions.fromPartial(object.options) : undefined; + message.reservedRange = object.reservedRange?.map(e => DescriptorProto_ReservedRange.fromPartial(e)) || []; + message.reservedName = object.reservedName?.map(e => e) || []; + return message; + }, + fromAmino(object: DescriptorProtoAmino): DescriptorProto { + const message = createBaseDescriptorProto(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + message.field = object.field?.map(e => FieldDescriptorProto.fromAmino(e)) || []; + message.extension = object.extension?.map(e => FieldDescriptorProto.fromAmino(e)) || []; + message.nestedType = object.nested_type?.map(e => DescriptorProto.fromAmino(e)) || []; + message.enumType = object.enum_type?.map(e => EnumDescriptorProto.fromAmino(e)) || []; + message.extensionRange = object.extension_range?.map(e => DescriptorProto_ExtensionRange.fromAmino(e)) || []; + message.oneofDecl = object.oneof_decl?.map(e => OneofDescriptorProto.fromAmino(e)) || []; + if (object.options !== undefined && object.options !== null) { + message.options = MessageOptions.fromAmino(object.options); + } + message.reservedRange = object.reserved_range?.map(e => DescriptorProto_ReservedRange.fromAmino(e)) || []; + message.reservedName = object.reserved_name?.map(e => e) || []; + return message; + }, + toAmino(message: DescriptorProto): DescriptorProtoAmino { + const obj: any = {}; + obj.name = message.name === "" ? undefined : message.name; + if (message.field) { + obj.field = message.field.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); + } else { + obj.field = message.field; + } + if (message.extension) { + obj.extension = message.extension.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); + } else { + obj.extension = message.extension; + } + if (message.nestedType) { + obj.nested_type = message.nestedType.map(e => e ? DescriptorProto.toAmino(e) : undefined); + } else { + obj.nested_type = message.nestedType; + } + if (message.enumType) { + obj.enum_type = message.enumType.map(e => e ? EnumDescriptorProto.toAmino(e) : undefined); + } else { + obj.enum_type = message.enumType; + } + if (message.extensionRange) { + obj.extension_range = message.extensionRange.map(e => e ? DescriptorProto_ExtensionRange.toAmino(e) : undefined); + } else { + obj.extension_range = message.extensionRange; + } + if (message.oneofDecl) { + obj.oneof_decl = message.oneofDecl.map(e => e ? OneofDescriptorProto.toAmino(e) : undefined); + } else { + obj.oneof_decl = message.oneofDecl; + } + obj.options = message.options ? MessageOptions.toAmino(message.options) : undefined; + if (message.reservedRange) { + obj.reserved_range = message.reservedRange.map(e => e ? DescriptorProto_ReservedRange.toAmino(e) : undefined); + } else { + obj.reserved_range = message.reservedRange; + } + if (message.reservedName) { + obj.reserved_name = message.reservedName.map(e => e); + } else { + obj.reserved_name = message.reservedName; + } + return obj; + }, + fromAminoMsg(object: DescriptorProtoAminoMsg): DescriptorProto { + return DescriptorProto.fromAmino(object.value); + }, + fromProtoMsg(message: DescriptorProtoProtoMsg): DescriptorProto { + return DescriptorProto.decode(message.value); + }, + toProto(message: DescriptorProto): Uint8Array { + return DescriptorProto.encode(message).finish(); + }, + toProtoMsg(message: DescriptorProto): DescriptorProtoProtoMsg { + return { + typeUrl: "/google.protobuf.DescriptorProto", + value: DescriptorProto.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(DescriptorProto.typeUrl, DescriptorProto); +function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRange { + return { + start: 0, + end: 0, + options: undefined + }; +} +export const DescriptorProto_ExtensionRange = { + typeUrl: "/google.protobuf.ExtensionRange", + is(o: any): o is DescriptorProto_ExtensionRange { + return o && (o.$typeUrl === DescriptorProto_ExtensionRange.typeUrl || typeof o.start === "number" && typeof o.end === "number"); + }, + isAmino(o: any): o is DescriptorProto_ExtensionRangeAmino { + return o && (o.$typeUrl === DescriptorProto_ExtensionRange.typeUrl || typeof o.start === "number" && typeof o.end === "number"); + }, + encode(message: DescriptorProto_ExtensionRange, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.start !== 0) { + writer.uint32(8).int32(message.start); + } + if (message.end !== 0) { + writer.uint32(16).int32(message.end); + } + if (message.options !== undefined) { + ExtensionRangeOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDescriptorProto_ExtensionRange(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.start = reader.int32(); + break; + case 2: + message.end = reader.int32(); + break; + case 3: + message.options = ExtensionRangeOptions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): DescriptorProto_ExtensionRange { + const message = createBaseDescriptorProto_ExtensionRange(); + message.start = object.start ?? 0; + message.end = object.end ?? 0; + message.options = object.options !== undefined && object.options !== null ? ExtensionRangeOptions.fromPartial(object.options) : undefined; + return message; + }, + fromAmino(object: DescriptorProto_ExtensionRangeAmino): DescriptorProto_ExtensionRange { + const message = createBaseDescriptorProto_ExtensionRange(); + if (object.start !== undefined && object.start !== null) { + message.start = object.start; + } + if (object.end !== undefined && object.end !== null) { + message.end = object.end; + } + if (object.options !== undefined && object.options !== null) { + message.options = ExtensionRangeOptions.fromAmino(object.options); + } + return message; + }, + toAmino(message: DescriptorProto_ExtensionRange): DescriptorProto_ExtensionRangeAmino { + const obj: any = {}; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; + obj.options = message.options ? ExtensionRangeOptions.toAmino(message.options) : undefined; + return obj; + }, + fromAminoMsg(object: DescriptorProto_ExtensionRangeAminoMsg): DescriptorProto_ExtensionRange { + return DescriptorProto_ExtensionRange.fromAmino(object.value); + }, + fromProtoMsg(message: DescriptorProto_ExtensionRangeProtoMsg): DescriptorProto_ExtensionRange { + return DescriptorProto_ExtensionRange.decode(message.value); + }, + toProto(message: DescriptorProto_ExtensionRange): Uint8Array { + return DescriptorProto_ExtensionRange.encode(message).finish(); + }, + toProtoMsg(message: DescriptorProto_ExtensionRange): DescriptorProto_ExtensionRangeProtoMsg { + return { + typeUrl: "/google.protobuf.ExtensionRange", + value: DescriptorProto_ExtensionRange.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(DescriptorProto_ExtensionRange.typeUrl, DescriptorProto_ExtensionRange); +function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRange { + return { + start: 0, + end: 0 + }; +} +export const DescriptorProto_ReservedRange = { + typeUrl: "/google.protobuf.ReservedRange", + is(o: any): o is DescriptorProto_ReservedRange { + return o && (o.$typeUrl === DescriptorProto_ReservedRange.typeUrl || typeof o.start === "number" && typeof o.end === "number"); + }, + isAmino(o: any): o is DescriptorProto_ReservedRangeAmino { + return o && (o.$typeUrl === DescriptorProto_ReservedRange.typeUrl || typeof o.start === "number" && typeof o.end === "number"); + }, + encode(message: DescriptorProto_ReservedRange, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.start !== 0) { + writer.uint32(8).int32(message.start); + } + if (message.end !== 0) { + writer.uint32(16).int32(message.end); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDescriptorProto_ReservedRange(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.start = reader.int32(); + break; + case 2: + message.end = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): DescriptorProto_ReservedRange { + const message = createBaseDescriptorProto_ReservedRange(); + message.start = object.start ?? 0; + message.end = object.end ?? 0; + return message; + }, + fromAmino(object: DescriptorProto_ReservedRangeAmino): DescriptorProto_ReservedRange { + const message = createBaseDescriptorProto_ReservedRange(); + if (object.start !== undefined && object.start !== null) { + message.start = object.start; + } + if (object.end !== undefined && object.end !== null) { + message.end = object.end; + } + return message; + }, + toAmino(message: DescriptorProto_ReservedRange): DescriptorProto_ReservedRangeAmino { + const obj: any = {}; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; + return obj; + }, + fromAminoMsg(object: DescriptorProto_ReservedRangeAminoMsg): DescriptorProto_ReservedRange { + return DescriptorProto_ReservedRange.fromAmino(object.value); + }, + fromProtoMsg(message: DescriptorProto_ReservedRangeProtoMsg): DescriptorProto_ReservedRange { + return DescriptorProto_ReservedRange.decode(message.value); + }, + toProto(message: DescriptorProto_ReservedRange): Uint8Array { + return DescriptorProto_ReservedRange.encode(message).finish(); + }, + toProtoMsg(message: DescriptorProto_ReservedRange): DescriptorProto_ReservedRangeProtoMsg { + return { + typeUrl: "/google.protobuf.ReservedRange", + value: DescriptorProto_ReservedRange.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(DescriptorProto_ReservedRange.typeUrl, DescriptorProto_ReservedRange); +function createBaseExtensionRangeOptions(): ExtensionRangeOptions { + return { + uninterpretedOption: [], + declaration: [], + features: undefined, + verification: 1 + }; +} +export const ExtensionRangeOptions = { + typeUrl: "/google.protobuf.ExtensionRangeOptions", + is(o: any): o is ExtensionRangeOptions { + return o && (o.$typeUrl === ExtensionRangeOptions.typeUrl || Array.isArray(o.uninterpretedOption) && (!o.uninterpretedOption.length || UninterpretedOption.is(o.uninterpretedOption[0])) && Array.isArray(o.declaration) && (!o.declaration.length || ExtensionRangeOptions_Declaration.is(o.declaration[0])) && isSet(o.verification)); + }, + isAmino(o: any): o is ExtensionRangeOptionsAmino { + return o && (o.$typeUrl === ExtensionRangeOptions.typeUrl || Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isAmino(o.uninterpreted_option[0])) && Array.isArray(o.declaration) && (!o.declaration.length || ExtensionRangeOptions_Declaration.isAmino(o.declaration[0])) && isSet(o.verification)); + }, + encode(message: ExtensionRangeOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + for (const v of message.declaration) { + ExtensionRangeOptions_Declaration.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).ldelim(); + } + if (message.verification !== 1) { + writer.uint32(24).int32(message.verification); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 999: + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + case 2: + message.declaration.push(ExtensionRangeOptions_Declaration.decode(reader, reader.uint32())); + break; + case 50: + message.features = FeatureSet.decode(reader, reader.uint32()); + break; + case 3: + message.verification = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ExtensionRangeOptions { + const message = createBaseExtensionRangeOptions(); + message.uninterpretedOption = object.uninterpretedOption?.map(e => UninterpretedOption.fromPartial(e)) || []; + message.declaration = object.declaration?.map(e => ExtensionRangeOptions_Declaration.fromPartial(e)) || []; + message.features = object.features !== undefined && object.features !== null ? FeatureSet.fromPartial(object.features) : undefined; + message.verification = object.verification ?? 1; + return message; + }, + fromAmino(object: ExtensionRangeOptionsAmino): ExtensionRangeOptions { + const message = createBaseExtensionRangeOptions(); + message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; + message.declaration = object.declaration?.map(e => ExtensionRangeOptions_Declaration.fromAmino(e)) || []; + if (object.features !== undefined && object.features !== null) { + message.features = FeatureSet.fromAmino(object.features); + } + if (object.verification !== undefined && object.verification !== null) { + message.verification = object.verification; + } + return message; + }, + toAmino(message: ExtensionRangeOptions): ExtensionRangeOptionsAmino { + const obj: any = {}; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); + } else { + obj.uninterpreted_option = message.uninterpretedOption; + } + if (message.declaration) { + obj.declaration = message.declaration.map(e => e ? ExtensionRangeOptions_Declaration.toAmino(e) : undefined); + } else { + obj.declaration = message.declaration; + } + obj.features = message.features ? FeatureSet.toAmino(message.features) : undefined; + obj.verification = message.verification === 1 ? undefined : message.verification; + return obj; + }, + fromAminoMsg(object: ExtensionRangeOptionsAminoMsg): ExtensionRangeOptions { + return ExtensionRangeOptions.fromAmino(object.value); + }, + fromProtoMsg(message: ExtensionRangeOptionsProtoMsg): ExtensionRangeOptions { + return ExtensionRangeOptions.decode(message.value); + }, + toProto(message: ExtensionRangeOptions): Uint8Array { + return ExtensionRangeOptions.encode(message).finish(); + }, + toProtoMsg(message: ExtensionRangeOptions): ExtensionRangeOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.ExtensionRangeOptions", + value: ExtensionRangeOptions.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ExtensionRangeOptions.typeUrl, ExtensionRangeOptions); +function createBaseExtensionRangeOptions_Declaration(): ExtensionRangeOptions_Declaration { + return { + number: 0, + fullName: "", + type: "", + reserved: false, + repeated: false + }; +} +export const ExtensionRangeOptions_Declaration = { + typeUrl: "/google.protobuf.Declaration", + is(o: any): o is ExtensionRangeOptions_Declaration { + return o && (o.$typeUrl === ExtensionRangeOptions_Declaration.typeUrl || typeof o.number === "number" && typeof o.fullName === "string" && typeof o.type === "string" && typeof o.reserved === "boolean" && typeof o.repeated === "boolean"); + }, + isAmino(o: any): o is ExtensionRangeOptions_DeclarationAmino { + return o && (o.$typeUrl === ExtensionRangeOptions_Declaration.typeUrl || typeof o.number === "number" && typeof o.full_name === "string" && typeof o.type === "string" && typeof o.reserved === "boolean" && typeof o.repeated === "boolean"); + }, + encode(message: ExtensionRangeOptions_Declaration, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.number !== 0) { + writer.uint32(8).int32(message.number); + } + if (message.fullName !== "") { + writer.uint32(18).string(message.fullName); + } + if (message.type !== "") { + writer.uint32(26).string(message.type); + } + if (message.reserved === true) { + writer.uint32(40).bool(message.reserved); + } + if (message.repeated === true) { + writer.uint32(48).bool(message.repeated); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions_Declaration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions_Declaration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.number = reader.int32(); + break; + case 2: + message.fullName = reader.string(); + break; + case 3: + message.type = reader.string(); + break; + case 5: + message.reserved = reader.bool(); + break; + case 6: + message.repeated = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ExtensionRangeOptions_Declaration { + const message = createBaseExtensionRangeOptions_Declaration(); + message.number = object.number ?? 0; + message.fullName = object.fullName ?? ""; + message.type = object.type ?? ""; + message.reserved = object.reserved ?? false; + message.repeated = object.repeated ?? false; + return message; + }, + fromAmino(object: ExtensionRangeOptions_DeclarationAmino): ExtensionRangeOptions_Declaration { + const message = createBaseExtensionRangeOptions_Declaration(); + if (object.number !== undefined && object.number !== null) { + message.number = object.number; + } + if (object.full_name !== undefined && object.full_name !== null) { + message.fullName = object.full_name; + } + if (object.type !== undefined && object.type !== null) { + message.type = object.type; + } + if (object.reserved !== undefined && object.reserved !== null) { + message.reserved = object.reserved; + } + if (object.repeated !== undefined && object.repeated !== null) { + message.repeated = object.repeated; + } + return message; + }, + toAmino(message: ExtensionRangeOptions_Declaration): ExtensionRangeOptions_DeclarationAmino { + const obj: any = {}; + obj.number = message.number === 0 ? undefined : message.number; + obj.full_name = message.fullName === "" ? undefined : message.fullName; + obj.type = message.type === "" ? undefined : message.type; + obj.reserved = message.reserved === false ? undefined : message.reserved; + obj.repeated = message.repeated === false ? undefined : message.repeated; + return obj; + }, + fromAminoMsg(object: ExtensionRangeOptions_DeclarationAminoMsg): ExtensionRangeOptions_Declaration { + return ExtensionRangeOptions_Declaration.fromAmino(object.value); + }, + fromProtoMsg(message: ExtensionRangeOptions_DeclarationProtoMsg): ExtensionRangeOptions_Declaration { + return ExtensionRangeOptions_Declaration.decode(message.value); + }, + toProto(message: ExtensionRangeOptions_Declaration): Uint8Array { + return ExtensionRangeOptions_Declaration.encode(message).finish(); + }, + toProtoMsg(message: ExtensionRangeOptions_Declaration): ExtensionRangeOptions_DeclarationProtoMsg { + return { + typeUrl: "/google.protobuf.Declaration", + value: ExtensionRangeOptions_Declaration.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ExtensionRangeOptions_Declaration.typeUrl, ExtensionRangeOptions_Declaration); +function createBaseFieldDescriptorProto(): FieldDescriptorProto { + return { + name: "", + number: 0, + label: 1, + type: 1, + typeName: "", + extendee: "", + defaultValue: "", + oneofIndex: 0, + jsonName: "", + options: undefined, + proto3Optional: false + }; +} +export const FieldDescriptorProto = { + typeUrl: "/google.protobuf.FieldDescriptorProto", + is(o: any): o is FieldDescriptorProto { + return o && (o.$typeUrl === FieldDescriptorProto.typeUrl || typeof o.name === "string" && typeof o.number === "number" && isSet(o.label) && isSet(o.type) && typeof o.typeName === "string" && typeof o.extendee === "string" && typeof o.defaultValue === "string" && typeof o.oneofIndex === "number" && typeof o.jsonName === "string" && typeof o.proto3Optional === "boolean"); + }, + isAmino(o: any): o is FieldDescriptorProtoAmino { + return o && (o.$typeUrl === FieldDescriptorProto.typeUrl || typeof o.name === "string" && typeof o.number === "number" && isSet(o.label) && isSet(o.type) && typeof o.type_name === "string" && typeof o.extendee === "string" && typeof o.default_value === "string" && typeof o.oneof_index === "number" && typeof o.json_name === "string" && typeof o.proto3_optional === "boolean"); + }, + encode(message: FieldDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== 0) { + writer.uint32(24).int32(message.number); + } + if (message.label !== 1) { + writer.uint32(32).int32(message.label); + } + if (message.type !== 1) { + writer.uint32(40).int32(message.type); + } + if (message.typeName !== "") { + writer.uint32(50).string(message.typeName); + } + if (message.extendee !== "") { + writer.uint32(18).string(message.extendee); + } + if (message.defaultValue !== "") { + writer.uint32(58).string(message.defaultValue); + } + if (message.oneofIndex !== 0) { + writer.uint32(72).int32(message.oneofIndex); + } + if (message.jsonName !== "") { + writer.uint32(82).string(message.jsonName); + } + if (message.options !== undefined) { + FieldOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + } + if (message.proto3Optional === true) { + writer.uint32(136).bool(message.proto3Optional); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): FieldDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFieldDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 3: + message.number = reader.int32(); + break; + case 4: + message.label = (reader.int32() as any); + break; + case 5: + message.type = (reader.int32() as any); + break; + case 6: + message.typeName = reader.string(); + break; + case 2: + message.extendee = reader.string(); + break; + case 7: + message.defaultValue = reader.string(); + break; + case 9: + message.oneofIndex = reader.int32(); + break; + case 10: + message.jsonName = reader.string(); + break; + case 8: + message.options = FieldOptions.decode(reader, reader.uint32()); + break; + case 17: + message.proto3Optional = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): FieldDescriptorProto { + const message = createBaseFieldDescriptorProto(); + message.name = object.name ?? ""; + message.number = object.number ?? 0; + message.label = object.label ?? 1; + message.type = object.type ?? 1; + message.typeName = object.typeName ?? ""; + message.extendee = object.extendee ?? ""; + message.defaultValue = object.defaultValue ?? ""; + message.oneofIndex = object.oneofIndex ?? 0; + message.jsonName = object.jsonName ?? ""; + message.options = object.options !== undefined && object.options !== null ? FieldOptions.fromPartial(object.options) : undefined; + message.proto3Optional = object.proto3Optional ?? false; + return message; + }, + fromAmino(object: FieldDescriptorProtoAmino): FieldDescriptorProto { + const message = createBaseFieldDescriptorProto(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.number !== undefined && object.number !== null) { + message.number = object.number; + } + if (object.label !== undefined && object.label !== null) { + message.label = object.label; + } + if (object.type !== undefined && object.type !== null) { + message.type = object.type; + } + if (object.type_name !== undefined && object.type_name !== null) { + message.typeName = object.type_name; + } + if (object.extendee !== undefined && object.extendee !== null) { + message.extendee = object.extendee; + } + if (object.default_value !== undefined && object.default_value !== null) { + message.defaultValue = object.default_value; + } + if (object.oneof_index !== undefined && object.oneof_index !== null) { + message.oneofIndex = object.oneof_index; + } + if (object.json_name !== undefined && object.json_name !== null) { + message.jsonName = object.json_name; + } + if (object.options !== undefined && object.options !== null) { + message.options = FieldOptions.fromAmino(object.options); + } + if (object.proto3_optional !== undefined && object.proto3_optional !== null) { + message.proto3Optional = object.proto3_optional; + } + return message; + }, + toAmino(message: FieldDescriptorProto): FieldDescriptorProtoAmino { + const obj: any = {}; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; + obj.label = message.label === 1 ? undefined : message.label; + obj.type = message.type === 1 ? undefined : message.type; + obj.type_name = message.typeName === "" ? undefined : message.typeName; + obj.extendee = message.extendee === "" ? undefined : message.extendee; + obj.default_value = message.defaultValue === "" ? undefined : message.defaultValue; + obj.oneof_index = message.oneofIndex === 0 ? undefined : message.oneofIndex; + obj.json_name = message.jsonName === "" ? undefined : message.jsonName; + obj.options = message.options ? FieldOptions.toAmino(message.options) : undefined; + obj.proto3_optional = message.proto3Optional === false ? undefined : message.proto3Optional; + return obj; + }, + fromAminoMsg(object: FieldDescriptorProtoAminoMsg): FieldDescriptorProto { + return FieldDescriptorProto.fromAmino(object.value); + }, + fromProtoMsg(message: FieldDescriptorProtoProtoMsg): FieldDescriptorProto { + return FieldDescriptorProto.decode(message.value); + }, + toProto(message: FieldDescriptorProto): Uint8Array { + return FieldDescriptorProto.encode(message).finish(); + }, + toProtoMsg(message: FieldDescriptorProto): FieldDescriptorProtoProtoMsg { + return { + typeUrl: "/google.protobuf.FieldDescriptorProto", + value: FieldDescriptorProto.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(FieldDescriptorProto.typeUrl, FieldDescriptorProto); +function createBaseOneofDescriptorProto(): OneofDescriptorProto { + return { + name: "", + options: undefined + }; +} +export const OneofDescriptorProto = { + typeUrl: "/google.protobuf.OneofDescriptorProto", + is(o: any): o is OneofDescriptorProto { + return o && (o.$typeUrl === OneofDescriptorProto.typeUrl || typeof o.name === "string"); + }, + isAmino(o: any): o is OneofDescriptorProtoAmino { + return o && (o.$typeUrl === OneofDescriptorProto.typeUrl || typeof o.name === "string"); + }, + encode(message: OneofDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.options !== undefined) { + OneofOptions.encode(message.options, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): OneofDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.options = OneofOptions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): OneofDescriptorProto { + const message = createBaseOneofDescriptorProto(); + message.name = object.name ?? ""; + message.options = object.options !== undefined && object.options !== null ? OneofOptions.fromPartial(object.options) : undefined; + return message; + }, + fromAmino(object: OneofDescriptorProtoAmino): OneofDescriptorProto { + const message = createBaseOneofDescriptorProto(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.options !== undefined && object.options !== null) { + message.options = OneofOptions.fromAmino(object.options); + } + return message; + }, + toAmino(message: OneofDescriptorProto): OneofDescriptorProtoAmino { + const obj: any = {}; + obj.name = message.name === "" ? undefined : message.name; + obj.options = message.options ? OneofOptions.toAmino(message.options) : undefined; + return obj; + }, + fromAminoMsg(object: OneofDescriptorProtoAminoMsg): OneofDescriptorProto { + return OneofDescriptorProto.fromAmino(object.value); + }, + fromProtoMsg(message: OneofDescriptorProtoProtoMsg): OneofDescriptorProto { + return OneofDescriptorProto.decode(message.value); + }, + toProto(message: OneofDescriptorProto): Uint8Array { + return OneofDescriptorProto.encode(message).finish(); + }, + toProtoMsg(message: OneofDescriptorProto): OneofDescriptorProtoProtoMsg { + return { + typeUrl: "/google.protobuf.OneofDescriptorProto", + value: OneofDescriptorProto.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(OneofDescriptorProto.typeUrl, OneofDescriptorProto); +function createBaseEnumDescriptorProto(): EnumDescriptorProto { + return { + name: "", + value: [], + options: undefined, + reservedRange: [], + reservedName: [] + }; +} +export const EnumDescriptorProto = { + typeUrl: "/google.protobuf.EnumDescriptorProto", + is(o: any): o is EnumDescriptorProto { + return o && (o.$typeUrl === EnumDescriptorProto.typeUrl || typeof o.name === "string" && Array.isArray(o.value) && (!o.value.length || EnumValueDescriptorProto.is(o.value[0])) && Array.isArray(o.reservedRange) && (!o.reservedRange.length || EnumDescriptorProto_EnumReservedRange.is(o.reservedRange[0])) && Array.isArray(o.reservedName) && (!o.reservedName.length || typeof o.reservedName[0] === "string")); + }, + isAmino(o: any): o is EnumDescriptorProtoAmino { + return o && (o.$typeUrl === EnumDescriptorProto.typeUrl || typeof o.name === "string" && Array.isArray(o.value) && (!o.value.length || EnumValueDescriptorProto.isAmino(o.value[0])) && Array.isArray(o.reserved_range) && (!o.reserved_range.length || EnumDescriptorProto_EnumReservedRange.isAmino(o.reserved_range[0])) && Array.isArray(o.reserved_name) && (!o.reserved_name.length || typeof o.reserved_name[0] === "string")); + }, + encode(message: EnumDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.value) { + EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.options !== undefined) { + EnumOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.reservedRange) { + EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).ldelim(); + } + for (const v of message.reservedName) { + writer.uint32(42).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.value.push(EnumValueDescriptorProto.decode(reader, reader.uint32())); + break; + case 3: + message.options = EnumOptions.decode(reader, reader.uint32()); + break; + case 4: + message.reservedRange.push(EnumDescriptorProto_EnumReservedRange.decode(reader, reader.uint32())); + break; + case 5: + message.reservedName.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): EnumDescriptorProto { + const message = createBaseEnumDescriptorProto(); + message.name = object.name ?? ""; + message.value = object.value?.map(e => EnumValueDescriptorProto.fromPartial(e)) || []; + message.options = object.options !== undefined && object.options !== null ? EnumOptions.fromPartial(object.options) : undefined; + message.reservedRange = object.reservedRange?.map(e => EnumDescriptorProto_EnumReservedRange.fromPartial(e)) || []; + message.reservedName = object.reservedName?.map(e => e) || []; + return message; + }, + fromAmino(object: EnumDescriptorProtoAmino): EnumDescriptorProto { + const message = createBaseEnumDescriptorProto(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + message.value = object.value?.map(e => EnumValueDescriptorProto.fromAmino(e)) || []; + if (object.options !== undefined && object.options !== null) { + message.options = EnumOptions.fromAmino(object.options); + } + message.reservedRange = object.reserved_range?.map(e => EnumDescriptorProto_EnumReservedRange.fromAmino(e)) || []; + message.reservedName = object.reserved_name?.map(e => e) || []; + return message; + }, + toAmino(message: EnumDescriptorProto): EnumDescriptorProtoAmino { + const obj: any = {}; + obj.name = message.name === "" ? undefined : message.name; + if (message.value) { + obj.value = message.value.map(e => e ? EnumValueDescriptorProto.toAmino(e) : undefined); + } else { + obj.value = message.value; + } + obj.options = message.options ? EnumOptions.toAmino(message.options) : undefined; + if (message.reservedRange) { + obj.reserved_range = message.reservedRange.map(e => e ? EnumDescriptorProto_EnumReservedRange.toAmino(e) : undefined); + } else { + obj.reserved_range = message.reservedRange; + } + if (message.reservedName) { + obj.reserved_name = message.reservedName.map(e => e); + } else { + obj.reserved_name = message.reservedName; + } + return obj; + }, + fromAminoMsg(object: EnumDescriptorProtoAminoMsg): EnumDescriptorProto { + return EnumDescriptorProto.fromAmino(object.value); + }, + fromProtoMsg(message: EnumDescriptorProtoProtoMsg): EnumDescriptorProto { + return EnumDescriptorProto.decode(message.value); + }, + toProto(message: EnumDescriptorProto): Uint8Array { + return EnumDescriptorProto.encode(message).finish(); + }, + toProtoMsg(message: EnumDescriptorProto): EnumDescriptorProtoProtoMsg { + return { + typeUrl: "/google.protobuf.EnumDescriptorProto", + value: EnumDescriptorProto.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(EnumDescriptorProto.typeUrl, EnumDescriptorProto); +function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_EnumReservedRange { + return { + start: 0, + end: 0 + }; +} +export const EnumDescriptorProto_EnumReservedRange = { + typeUrl: "/google.protobuf.EnumReservedRange", + is(o: any): o is EnumDescriptorProto_EnumReservedRange { + return o && (o.$typeUrl === EnumDescriptorProto_EnumReservedRange.typeUrl || typeof o.start === "number" && typeof o.end === "number"); + }, + isAmino(o: any): o is EnumDescriptorProto_EnumReservedRangeAmino { + return o && (o.$typeUrl === EnumDescriptorProto_EnumReservedRange.typeUrl || typeof o.start === "number" && typeof o.end === "number"); + }, + encode(message: EnumDescriptorProto_EnumReservedRange, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.start !== 0) { + writer.uint32(8).int32(message.start); + } + if (message.end !== 0) { + writer.uint32(16).int32(message.end); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto_EnumReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumDescriptorProto_EnumReservedRange(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.start = reader.int32(); + break; + case 2: + message.end = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): EnumDescriptorProto_EnumReservedRange { + const message = createBaseEnumDescriptorProto_EnumReservedRange(); + message.start = object.start ?? 0; + message.end = object.end ?? 0; + return message; + }, + fromAmino(object: EnumDescriptorProto_EnumReservedRangeAmino): EnumDescriptorProto_EnumReservedRange { + const message = createBaseEnumDescriptorProto_EnumReservedRange(); + if (object.start !== undefined && object.start !== null) { + message.start = object.start; + } + if (object.end !== undefined && object.end !== null) { + message.end = object.end; + } + return message; + }, + toAmino(message: EnumDescriptorProto_EnumReservedRange): EnumDescriptorProto_EnumReservedRangeAmino { + const obj: any = {}; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; + return obj; + }, + fromAminoMsg(object: EnumDescriptorProto_EnumReservedRangeAminoMsg): EnumDescriptorProto_EnumReservedRange { + return EnumDescriptorProto_EnumReservedRange.fromAmino(object.value); + }, + fromProtoMsg(message: EnumDescriptorProto_EnumReservedRangeProtoMsg): EnumDescriptorProto_EnumReservedRange { + return EnumDescriptorProto_EnumReservedRange.decode(message.value); + }, + toProto(message: EnumDescriptorProto_EnumReservedRange): Uint8Array { + return EnumDescriptorProto_EnumReservedRange.encode(message).finish(); + }, + toProtoMsg(message: EnumDescriptorProto_EnumReservedRange): EnumDescriptorProto_EnumReservedRangeProtoMsg { + return { + typeUrl: "/google.protobuf.EnumReservedRange", + value: EnumDescriptorProto_EnumReservedRange.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(EnumDescriptorProto_EnumReservedRange.typeUrl, EnumDescriptorProto_EnumReservedRange); +function createBaseEnumValueDescriptorProto(): EnumValueDescriptorProto { + return { + name: "", + number: 0, + options: undefined + }; +} +export const EnumValueDescriptorProto = { + typeUrl: "/google.protobuf.EnumValueDescriptorProto", + is(o: any): o is EnumValueDescriptorProto { + return o && (o.$typeUrl === EnumValueDescriptorProto.typeUrl || typeof o.name === "string" && typeof o.number === "number"); + }, + isAmino(o: any): o is EnumValueDescriptorProtoAmino { + return o && (o.$typeUrl === EnumValueDescriptorProto.typeUrl || typeof o.name === "string" && typeof o.number === "number"); + }, + encode(message: EnumValueDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.number !== 0) { + writer.uint32(16).int32(message.number); + } + if (message.options !== undefined) { + EnumValueOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumValueDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.number = reader.int32(); + break; + case 3: + message.options = EnumValueOptions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): EnumValueDescriptorProto { + const message = createBaseEnumValueDescriptorProto(); + message.name = object.name ?? ""; + message.number = object.number ?? 0; + message.options = object.options !== undefined && object.options !== null ? EnumValueOptions.fromPartial(object.options) : undefined; + return message; + }, + fromAmino(object: EnumValueDescriptorProtoAmino): EnumValueDescriptorProto { + const message = createBaseEnumValueDescriptorProto(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.number !== undefined && object.number !== null) { + message.number = object.number; + } + if (object.options !== undefined && object.options !== null) { + message.options = EnumValueOptions.fromAmino(object.options); + } + return message; + }, + toAmino(message: EnumValueDescriptorProto): EnumValueDescriptorProtoAmino { + const obj: any = {}; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; + obj.options = message.options ? EnumValueOptions.toAmino(message.options) : undefined; + return obj; + }, + fromAminoMsg(object: EnumValueDescriptorProtoAminoMsg): EnumValueDescriptorProto { + return EnumValueDescriptorProto.fromAmino(object.value); + }, + fromProtoMsg(message: EnumValueDescriptorProtoProtoMsg): EnumValueDescriptorProto { + return EnumValueDescriptorProto.decode(message.value); + }, + toProto(message: EnumValueDescriptorProto): Uint8Array { + return EnumValueDescriptorProto.encode(message).finish(); + }, + toProtoMsg(message: EnumValueDescriptorProto): EnumValueDescriptorProtoProtoMsg { + return { + typeUrl: "/google.protobuf.EnumValueDescriptorProto", + value: EnumValueDescriptorProto.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(EnumValueDescriptorProto.typeUrl, EnumValueDescriptorProto); +function createBaseServiceDescriptorProto(): ServiceDescriptorProto { + return { + name: "", + method: [], + options: undefined + }; +} +export const ServiceDescriptorProto = { + typeUrl: "/google.protobuf.ServiceDescriptorProto", + is(o: any): o is ServiceDescriptorProto { + return o && (o.$typeUrl === ServiceDescriptorProto.typeUrl || typeof o.name === "string" && Array.isArray(o.method) && (!o.method.length || MethodDescriptorProto.is(o.method[0]))); + }, + isAmino(o: any): o is ServiceDescriptorProtoAmino { + return o && (o.$typeUrl === ServiceDescriptorProto.typeUrl || typeof o.name === "string" && Array.isArray(o.method) && (!o.method.length || MethodDescriptorProto.isAmino(o.method[0]))); + }, + encode(message: ServiceDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.method) { + MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.options !== undefined) { + ServiceOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ServiceDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServiceDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.method.push(MethodDescriptorProto.decode(reader, reader.uint32())); + break; + case 3: + message.options = ServiceOptions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ServiceDescriptorProto { + const message = createBaseServiceDescriptorProto(); + message.name = object.name ?? ""; + message.method = object.method?.map(e => MethodDescriptorProto.fromPartial(e)) || []; + message.options = object.options !== undefined && object.options !== null ? ServiceOptions.fromPartial(object.options) : undefined; + return message; + }, + fromAmino(object: ServiceDescriptorProtoAmino): ServiceDescriptorProto { + const message = createBaseServiceDescriptorProto(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + message.method = object.method?.map(e => MethodDescriptorProto.fromAmino(e)) || []; + if (object.options !== undefined && object.options !== null) { + message.options = ServiceOptions.fromAmino(object.options); + } + return message; + }, + toAmino(message: ServiceDescriptorProto): ServiceDescriptorProtoAmino { + const obj: any = {}; + obj.name = message.name === "" ? undefined : message.name; + if (message.method) { + obj.method = message.method.map(e => e ? MethodDescriptorProto.toAmino(e) : undefined); + } else { + obj.method = message.method; + } + obj.options = message.options ? ServiceOptions.toAmino(message.options) : undefined; + return obj; + }, + fromAminoMsg(object: ServiceDescriptorProtoAminoMsg): ServiceDescriptorProto { + return ServiceDescriptorProto.fromAmino(object.value); + }, + fromProtoMsg(message: ServiceDescriptorProtoProtoMsg): ServiceDescriptorProto { + return ServiceDescriptorProto.decode(message.value); + }, + toProto(message: ServiceDescriptorProto): Uint8Array { + return ServiceDescriptorProto.encode(message).finish(); + }, + toProtoMsg(message: ServiceDescriptorProto): ServiceDescriptorProtoProtoMsg { + return { + typeUrl: "/google.protobuf.ServiceDescriptorProto", + value: ServiceDescriptorProto.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ServiceDescriptorProto.typeUrl, ServiceDescriptorProto); +function createBaseMethodDescriptorProto(): MethodDescriptorProto { + return { + name: "", + inputType: "", + outputType: "", + options: undefined, + clientStreaming: false, + serverStreaming: false + }; +} +export const MethodDescriptorProto = { + typeUrl: "/google.protobuf.MethodDescriptorProto", + is(o: any): o is MethodDescriptorProto { + return o && (o.$typeUrl === MethodDescriptorProto.typeUrl || typeof o.name === "string" && typeof o.inputType === "string" && typeof o.outputType === "string" && typeof o.clientStreaming === "boolean" && typeof o.serverStreaming === "boolean"); + }, + isAmino(o: any): o is MethodDescriptorProtoAmino { + return o && (o.$typeUrl === MethodDescriptorProto.typeUrl || typeof o.name === "string" && typeof o.input_type === "string" && typeof o.output_type === "string" && typeof o.client_streaming === "boolean" && typeof o.server_streaming === "boolean"); + }, + encode(message: MethodDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.inputType !== "") { + writer.uint32(18).string(message.inputType); + } + if (message.outputType !== "") { + writer.uint32(26).string(message.outputType); + } + if (message.options !== undefined) { + MethodOptions.encode(message.options, writer.uint32(34).fork()).ldelim(); + } + if (message.clientStreaming === true) { + writer.uint32(40).bool(message.clientStreaming); + } + if (message.serverStreaming === true) { + writer.uint32(48).bool(message.serverStreaming); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MethodDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMethodDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.inputType = reader.string(); + break; + case 3: + message.outputType = reader.string(); + break; + case 4: + message.options = MethodOptions.decode(reader, reader.uint32()); + break; + case 5: + message.clientStreaming = reader.bool(); + break; + case 6: + message.serverStreaming = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MethodDescriptorProto { + const message = createBaseMethodDescriptorProto(); + message.name = object.name ?? ""; + message.inputType = object.inputType ?? ""; + message.outputType = object.outputType ?? ""; + message.options = object.options !== undefined && object.options !== null ? MethodOptions.fromPartial(object.options) : undefined; + message.clientStreaming = object.clientStreaming ?? false; + message.serverStreaming = object.serverStreaming ?? false; + return message; + }, + fromAmino(object: MethodDescriptorProtoAmino): MethodDescriptorProto { + const message = createBaseMethodDescriptorProto(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.input_type !== undefined && object.input_type !== null) { + message.inputType = object.input_type; + } + if (object.output_type !== undefined && object.output_type !== null) { + message.outputType = object.output_type; + } + if (object.options !== undefined && object.options !== null) { + message.options = MethodOptions.fromAmino(object.options); + } + if (object.client_streaming !== undefined && object.client_streaming !== null) { + message.clientStreaming = object.client_streaming; + } + if (object.server_streaming !== undefined && object.server_streaming !== null) { + message.serverStreaming = object.server_streaming; + } + return message; + }, + toAmino(message: MethodDescriptorProto): MethodDescriptorProtoAmino { + const obj: any = {}; + obj.name = message.name === "" ? undefined : message.name; + obj.input_type = message.inputType === "" ? undefined : message.inputType; + obj.output_type = message.outputType === "" ? undefined : message.outputType; + obj.options = message.options ? MethodOptions.toAmino(message.options) : undefined; + obj.client_streaming = message.clientStreaming === false ? undefined : message.clientStreaming; + obj.server_streaming = message.serverStreaming === false ? undefined : message.serverStreaming; + return obj; + }, + fromAminoMsg(object: MethodDescriptorProtoAminoMsg): MethodDescriptorProto { + return MethodDescriptorProto.fromAmino(object.value); + }, + fromProtoMsg(message: MethodDescriptorProtoProtoMsg): MethodDescriptorProto { + return MethodDescriptorProto.decode(message.value); + }, + toProto(message: MethodDescriptorProto): Uint8Array { + return MethodDescriptorProto.encode(message).finish(); + }, + toProtoMsg(message: MethodDescriptorProto): MethodDescriptorProtoProtoMsg { + return { + typeUrl: "/google.protobuf.MethodDescriptorProto", + value: MethodDescriptorProto.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MethodDescriptorProto.typeUrl, MethodDescriptorProto); +function createBaseFileOptions(): FileOptions { + return { + javaPackage: "", + javaOuterClassname: "", + javaMultipleFiles: false, + javaGenerateEqualsAndHash: false, + javaStringCheckUtf8: false, + optimizeFor: 1, + goPackage: "", + ccGenericServices: false, + javaGenericServices: false, + pyGenericServices: false, + deprecated: false, + ccEnableArenas: false, + objcClassPrefix: "", + csharpNamespace: "", + swiftPrefix: "", + phpClassPrefix: "", + phpNamespace: "", + phpMetadataNamespace: "", + rubyPackage: "", + features: undefined, + uninterpretedOption: [] + }; +} +export const FileOptions = { + typeUrl: "/google.protobuf.FileOptions", + is(o: any): o is FileOptions { + return o && (o.$typeUrl === FileOptions.typeUrl || typeof o.javaPackage === "string" && typeof o.javaOuterClassname === "string" && typeof o.javaMultipleFiles === "boolean" && typeof o.javaGenerateEqualsAndHash === "boolean" && typeof o.javaStringCheckUtf8 === "boolean" && isSet(o.optimizeFor) && typeof o.goPackage === "string" && typeof o.ccGenericServices === "boolean" && typeof o.javaGenericServices === "boolean" && typeof o.pyGenericServices === "boolean" && typeof o.deprecated === "boolean" && typeof o.ccEnableArenas === "boolean" && typeof o.objcClassPrefix === "string" && typeof o.csharpNamespace === "string" && typeof o.swiftPrefix === "string" && typeof o.phpClassPrefix === "string" && typeof o.phpNamespace === "string" && typeof o.phpMetadataNamespace === "string" && typeof o.rubyPackage === "string" && Array.isArray(o.uninterpretedOption) && (!o.uninterpretedOption.length || UninterpretedOption.is(o.uninterpretedOption[0]))); + }, + isAmino(o: any): o is FileOptionsAmino { + return o && (o.$typeUrl === FileOptions.typeUrl || typeof o.java_package === "string" && typeof o.java_outer_classname === "string" && typeof o.java_multiple_files === "boolean" && typeof o.java_generate_equals_and_hash === "boolean" && typeof o.java_string_check_utf8 === "boolean" && isSet(o.optimize_for) && typeof o.go_package === "string" && typeof o.cc_generic_services === "boolean" && typeof o.java_generic_services === "boolean" && typeof o.py_generic_services === "boolean" && typeof o.deprecated === "boolean" && typeof o.cc_enable_arenas === "boolean" && typeof o.objc_class_prefix === "string" && typeof o.csharp_namespace === "string" && typeof o.swift_prefix === "string" && typeof o.php_class_prefix === "string" && typeof o.php_namespace === "string" && typeof o.php_metadata_namespace === "string" && typeof o.ruby_package === "string" && Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isAmino(o.uninterpreted_option[0]))); + }, + encode(message: FileOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.javaPackage !== "") { + writer.uint32(10).string(message.javaPackage); + } + if (message.javaOuterClassname !== "") { + writer.uint32(66).string(message.javaOuterClassname); + } + if (message.javaMultipleFiles === true) { + writer.uint32(80).bool(message.javaMultipleFiles); + } + if (message.javaGenerateEqualsAndHash === true) { + writer.uint32(160).bool(message.javaGenerateEqualsAndHash); + } + if (message.javaStringCheckUtf8 === true) { + writer.uint32(216).bool(message.javaStringCheckUtf8); + } + if (message.optimizeFor !== 1) { + writer.uint32(72).int32(message.optimizeFor); + } + if (message.goPackage !== "") { + writer.uint32(90).string(message.goPackage); + } + if (message.ccGenericServices === true) { + writer.uint32(128).bool(message.ccGenericServices); + } + if (message.javaGenericServices === true) { + writer.uint32(136).bool(message.javaGenericServices); + } + if (message.pyGenericServices === true) { + writer.uint32(144).bool(message.pyGenericServices); + } + if (message.deprecated === true) { + writer.uint32(184).bool(message.deprecated); + } + if (message.ccEnableArenas === true) { + writer.uint32(248).bool(message.ccEnableArenas); + } + if (message.objcClassPrefix !== "") { + writer.uint32(290).string(message.objcClassPrefix); + } + if (message.csharpNamespace !== "") { + writer.uint32(298).string(message.csharpNamespace); + } + if (message.swiftPrefix !== "") { + writer.uint32(314).string(message.swiftPrefix); + } + if (message.phpClassPrefix !== "") { + writer.uint32(322).string(message.phpClassPrefix); + } + if (message.phpNamespace !== "") { + writer.uint32(330).string(message.phpNamespace); + } + if (message.phpMetadataNamespace !== "") { + writer.uint32(354).string(message.phpMetadataNamespace); + } + if (message.rubyPackage !== "") { + writer.uint32(362).string(message.rubyPackage); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(402).fork()).ldelim(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): FileOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFileOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.javaPackage = reader.string(); + break; + case 8: + message.javaOuterClassname = reader.string(); + break; + case 10: + message.javaMultipleFiles = reader.bool(); + break; + case 20: + message.javaGenerateEqualsAndHash = reader.bool(); + break; + case 27: + message.javaStringCheckUtf8 = reader.bool(); + break; + case 9: + message.optimizeFor = (reader.int32() as any); + break; + case 11: + message.goPackage = reader.string(); + break; + case 16: + message.ccGenericServices = reader.bool(); + break; + case 17: + message.javaGenericServices = reader.bool(); + break; + case 18: + message.pyGenericServices = reader.bool(); + break; + case 23: + message.deprecated = reader.bool(); + break; + case 31: + message.ccEnableArenas = reader.bool(); + break; + case 36: + message.objcClassPrefix = reader.string(); + break; + case 37: + message.csharpNamespace = reader.string(); + break; + case 39: + message.swiftPrefix = reader.string(); + break; + case 40: + message.phpClassPrefix = reader.string(); + break; + case 41: + message.phpNamespace = reader.string(); + break; + case 44: + message.phpMetadataNamespace = reader.string(); + break; + case 45: + message.rubyPackage = reader.string(); + break; + case 50: + message.features = FeatureSet.decode(reader, reader.uint32()); + break; + case 999: + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): FileOptions { + const message = createBaseFileOptions(); + message.javaPackage = object.javaPackage ?? ""; + message.javaOuterClassname = object.javaOuterClassname ?? ""; + message.javaMultipleFiles = object.javaMultipleFiles ?? false; + message.javaGenerateEqualsAndHash = object.javaGenerateEqualsAndHash ?? false; + message.javaStringCheckUtf8 = object.javaStringCheckUtf8 ?? false; + message.optimizeFor = object.optimizeFor ?? 1; + message.goPackage = object.goPackage ?? ""; + message.ccGenericServices = object.ccGenericServices ?? false; + message.javaGenericServices = object.javaGenericServices ?? false; + message.pyGenericServices = object.pyGenericServices ?? false; + message.deprecated = object.deprecated ?? false; + message.ccEnableArenas = object.ccEnableArenas ?? false; + message.objcClassPrefix = object.objcClassPrefix ?? ""; + message.csharpNamespace = object.csharpNamespace ?? ""; + message.swiftPrefix = object.swiftPrefix ?? ""; + message.phpClassPrefix = object.phpClassPrefix ?? ""; + message.phpNamespace = object.phpNamespace ?? ""; + message.phpMetadataNamespace = object.phpMetadataNamespace ?? ""; + message.rubyPackage = object.rubyPackage ?? ""; + message.features = object.features !== undefined && object.features !== null ? FeatureSet.fromPartial(object.features) : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map(e => UninterpretedOption.fromPartial(e)) || []; + return message; + }, + fromAmino(object: FileOptionsAmino): FileOptions { + const message = createBaseFileOptions(); + if (object.java_package !== undefined && object.java_package !== null) { + message.javaPackage = object.java_package; + } + if (object.java_outer_classname !== undefined && object.java_outer_classname !== null) { + message.javaOuterClassname = object.java_outer_classname; + } + if (object.java_multiple_files !== undefined && object.java_multiple_files !== null) { + message.javaMultipleFiles = object.java_multiple_files; + } + if (object.java_generate_equals_and_hash !== undefined && object.java_generate_equals_and_hash !== null) { + message.javaGenerateEqualsAndHash = object.java_generate_equals_and_hash; + } + if (object.java_string_check_utf8 !== undefined && object.java_string_check_utf8 !== null) { + message.javaStringCheckUtf8 = object.java_string_check_utf8; + } + if (object.optimize_for !== undefined && object.optimize_for !== null) { + message.optimizeFor = object.optimize_for; + } + if (object.go_package !== undefined && object.go_package !== null) { + message.goPackage = object.go_package; + } + if (object.cc_generic_services !== undefined && object.cc_generic_services !== null) { + message.ccGenericServices = object.cc_generic_services; + } + if (object.java_generic_services !== undefined && object.java_generic_services !== null) { + message.javaGenericServices = object.java_generic_services; + } + if (object.py_generic_services !== undefined && object.py_generic_services !== null) { + message.pyGenericServices = object.py_generic_services; + } + if (object.deprecated !== undefined && object.deprecated !== null) { + message.deprecated = object.deprecated; + } + if (object.cc_enable_arenas !== undefined && object.cc_enable_arenas !== null) { + message.ccEnableArenas = object.cc_enable_arenas; + } + if (object.objc_class_prefix !== undefined && object.objc_class_prefix !== null) { + message.objcClassPrefix = object.objc_class_prefix; + } + if (object.csharp_namespace !== undefined && object.csharp_namespace !== null) { + message.csharpNamespace = object.csharp_namespace; + } + if (object.swift_prefix !== undefined && object.swift_prefix !== null) { + message.swiftPrefix = object.swift_prefix; + } + if (object.php_class_prefix !== undefined && object.php_class_prefix !== null) { + message.phpClassPrefix = object.php_class_prefix; + } + if (object.php_namespace !== undefined && object.php_namespace !== null) { + message.phpNamespace = object.php_namespace; + } + if (object.php_metadata_namespace !== undefined && object.php_metadata_namespace !== null) { + message.phpMetadataNamespace = object.php_metadata_namespace; + } + if (object.ruby_package !== undefined && object.ruby_package !== null) { + message.rubyPackage = object.ruby_package; + } + if (object.features !== undefined && object.features !== null) { + message.features = FeatureSet.fromAmino(object.features); + } + message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; + return message; + }, + toAmino(message: FileOptions): FileOptionsAmino { + const obj: any = {}; + obj.java_package = message.javaPackage === "" ? undefined : message.javaPackage; + obj.java_outer_classname = message.javaOuterClassname === "" ? undefined : message.javaOuterClassname; + obj.java_multiple_files = message.javaMultipleFiles === false ? undefined : message.javaMultipleFiles; + obj.java_generate_equals_and_hash = message.javaGenerateEqualsAndHash === false ? undefined : message.javaGenerateEqualsAndHash; + obj.java_string_check_utf8 = message.javaStringCheckUtf8 === false ? undefined : message.javaStringCheckUtf8; + obj.optimize_for = message.optimizeFor === 1 ? undefined : message.optimizeFor; + obj.go_package = message.goPackage === "" ? undefined : message.goPackage; + obj.cc_generic_services = message.ccGenericServices === false ? undefined : message.ccGenericServices; + obj.java_generic_services = message.javaGenericServices === false ? undefined : message.javaGenericServices; + obj.py_generic_services = message.pyGenericServices === false ? undefined : message.pyGenericServices; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.cc_enable_arenas = message.ccEnableArenas === false ? undefined : message.ccEnableArenas; + obj.objc_class_prefix = message.objcClassPrefix === "" ? undefined : message.objcClassPrefix; + obj.csharp_namespace = message.csharpNamespace === "" ? undefined : message.csharpNamespace; + obj.swift_prefix = message.swiftPrefix === "" ? undefined : message.swiftPrefix; + obj.php_class_prefix = message.phpClassPrefix === "" ? undefined : message.phpClassPrefix; + obj.php_namespace = message.phpNamespace === "" ? undefined : message.phpNamespace; + obj.php_metadata_namespace = message.phpMetadataNamespace === "" ? undefined : message.phpMetadataNamespace; + obj.ruby_package = message.rubyPackage === "" ? undefined : message.rubyPackage; + obj.features = message.features ? FeatureSet.toAmino(message.features) : undefined; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); + } else { + obj.uninterpreted_option = message.uninterpretedOption; + } + return obj; + }, + fromAminoMsg(object: FileOptionsAminoMsg): FileOptions { + return FileOptions.fromAmino(object.value); + }, + fromProtoMsg(message: FileOptionsProtoMsg): FileOptions { + return FileOptions.decode(message.value); + }, + toProto(message: FileOptions): Uint8Array { + return FileOptions.encode(message).finish(); + }, + toProtoMsg(message: FileOptions): FileOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.FileOptions", + value: FileOptions.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(FileOptions.typeUrl, FileOptions); +function createBaseMessageOptions(): MessageOptions { + return { + messageSetWireFormat: false, + noStandardDescriptorAccessor: false, + deprecated: false, + mapEntry: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, + uninterpretedOption: [] + }; +} +export const MessageOptions = { + typeUrl: "/google.protobuf.MessageOptions", + is(o: any): o is MessageOptions { + return o && (o.$typeUrl === MessageOptions.typeUrl || typeof o.messageSetWireFormat === "boolean" && typeof o.noStandardDescriptorAccessor === "boolean" && typeof o.deprecated === "boolean" && typeof o.mapEntry === "boolean" && typeof o.deprecatedLegacyJsonFieldConflicts === "boolean" && Array.isArray(o.uninterpretedOption) && (!o.uninterpretedOption.length || UninterpretedOption.is(o.uninterpretedOption[0]))); + }, + isAmino(o: any): o is MessageOptionsAmino { + return o && (o.$typeUrl === MessageOptions.typeUrl || typeof o.message_set_wire_format === "boolean" && typeof o.no_standard_descriptor_accessor === "boolean" && typeof o.deprecated === "boolean" && typeof o.map_entry === "boolean" && typeof o.deprecated_legacy_json_field_conflicts === "boolean" && Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isAmino(o.uninterpreted_option[0]))); + }, + encode(message: MessageOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.messageSetWireFormat === true) { + writer.uint32(8).bool(message.messageSetWireFormat); + } + if (message.noStandardDescriptorAccessor === true) { + writer.uint32(16).bool(message.noStandardDescriptorAccessor); + } + if (message.deprecated === true) { + writer.uint32(24).bool(message.deprecated); + } + if (message.mapEntry === true) { + writer.uint32(56).bool(message.mapEntry); + } + if (message.deprecatedLegacyJsonFieldConflicts === true) { + writer.uint32(88).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(98).fork()).ldelim(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MessageOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMessageOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.messageSetWireFormat = reader.bool(); + break; + case 2: + message.noStandardDescriptorAccessor = reader.bool(); + break; + case 3: + message.deprecated = reader.bool(); + break; + case 7: + message.mapEntry = reader.bool(); + break; + case 11: + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + break; + case 12: + message.features = FeatureSet.decode(reader, reader.uint32()); + break; + case 999: + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MessageOptions { + const message = createBaseMessageOptions(); + message.messageSetWireFormat = object.messageSetWireFormat ?? false; + message.noStandardDescriptorAccessor = object.noStandardDescriptorAccessor ?? false; + message.deprecated = object.deprecated ?? false; + message.mapEntry = object.mapEntry ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = object.features !== undefined && object.features !== null ? FeatureSet.fromPartial(object.features) : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map(e => UninterpretedOption.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MessageOptionsAmino): MessageOptions { + const message = createBaseMessageOptions(); + if (object.message_set_wire_format !== undefined && object.message_set_wire_format !== null) { + message.messageSetWireFormat = object.message_set_wire_format; + } + if (object.no_standard_descriptor_accessor !== undefined && object.no_standard_descriptor_accessor !== null) { + message.noStandardDescriptorAccessor = object.no_standard_descriptor_accessor; + } + if (object.deprecated !== undefined && object.deprecated !== null) { + message.deprecated = object.deprecated; + } + if (object.map_entry !== undefined && object.map_entry !== null) { + message.mapEntry = object.map_entry; + } + if (object.deprecated_legacy_json_field_conflicts !== undefined && object.deprecated_legacy_json_field_conflicts !== null) { + message.deprecatedLegacyJsonFieldConflicts = object.deprecated_legacy_json_field_conflicts; + } + if (object.features !== undefined && object.features !== null) { + message.features = FeatureSet.fromAmino(object.features); + } + message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; + return message; + }, + toAmino(message: MessageOptions): MessageOptionsAmino { + const obj: any = {}; + obj.message_set_wire_format = message.messageSetWireFormat === false ? undefined : message.messageSetWireFormat; + obj.no_standard_descriptor_accessor = message.noStandardDescriptorAccessor === false ? undefined : message.noStandardDescriptorAccessor; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.map_entry = message.mapEntry === false ? undefined : message.mapEntry; + obj.deprecated_legacy_json_field_conflicts = message.deprecatedLegacyJsonFieldConflicts === false ? undefined : message.deprecatedLegacyJsonFieldConflicts; + obj.features = message.features ? FeatureSet.toAmino(message.features) : undefined; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); + } else { + obj.uninterpreted_option = message.uninterpretedOption; + } + return obj; + }, + fromAminoMsg(object: MessageOptionsAminoMsg): MessageOptions { + return MessageOptions.fromAmino(object.value); + }, + fromProtoMsg(message: MessageOptionsProtoMsg): MessageOptions { + return MessageOptions.decode(message.value); + }, + toProto(message: MessageOptions): Uint8Array { + return MessageOptions.encode(message).finish(); + }, + toProtoMsg(message: MessageOptions): MessageOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.MessageOptions", + value: MessageOptions.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MessageOptions.typeUrl, MessageOptions); +function createBaseFieldOptions(): FieldOptions { + return { + ctype: 1, + packed: false, + jstype: 1, + lazy: false, + unverifiedLazy: false, + deprecated: false, + weak: false, + debugRedact: false, + retention: 1, + targets: [], + editionDefaults: [], + features: undefined, + featureSupport: undefined, + uninterpretedOption: [] + }; +} +export const FieldOptions = { + typeUrl: "/google.protobuf.FieldOptions", + is(o: any): o is FieldOptions { + return o && (o.$typeUrl === FieldOptions.typeUrl || isSet(o.ctype) && typeof o.packed === "boolean" && isSet(o.jstype) && typeof o.lazy === "boolean" && typeof o.unverifiedLazy === "boolean" && typeof o.deprecated === "boolean" && typeof o.weak === "boolean" && typeof o.debugRedact === "boolean" && isSet(o.retention) && Array.isArray(o.targets) && Array.isArray(o.editionDefaults) && (!o.editionDefaults.length || FieldOptions_EditionDefault.is(o.editionDefaults[0])) && Array.isArray(o.uninterpretedOption) && (!o.uninterpretedOption.length || UninterpretedOption.is(o.uninterpretedOption[0]))); + }, + isAmino(o: any): o is FieldOptionsAmino { + return o && (o.$typeUrl === FieldOptions.typeUrl || isSet(o.ctype) && typeof o.packed === "boolean" && isSet(o.jstype) && typeof o.lazy === "boolean" && typeof o.unverified_lazy === "boolean" && typeof o.deprecated === "boolean" && typeof o.weak === "boolean" && typeof o.debug_redact === "boolean" && isSet(o.retention) && Array.isArray(o.targets) && Array.isArray(o.edition_defaults) && (!o.edition_defaults.length || FieldOptions_EditionDefault.isAmino(o.edition_defaults[0])) && Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isAmino(o.uninterpreted_option[0]))); + }, + encode(message: FieldOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.ctype !== 1) { + writer.uint32(8).int32(message.ctype); + } + if (message.packed === true) { + writer.uint32(16).bool(message.packed); + } + if (message.jstype !== 1) { + writer.uint32(48).int32(message.jstype); + } + if (message.lazy === true) { + writer.uint32(40).bool(message.lazy); + } + if (message.unverifiedLazy === true) { + writer.uint32(120).bool(message.unverifiedLazy); + } + if (message.deprecated === true) { + writer.uint32(24).bool(message.deprecated); + } + if (message.weak === true) { + writer.uint32(80).bool(message.weak); + } + if (message.debugRedact === true) { + writer.uint32(128).bool(message.debugRedact); + } + if (message.retention !== 1) { + writer.uint32(136).int32(message.retention); + } + writer.uint32(154).fork(); + for (const v of message.targets) { + writer.int32(v); + } + writer.ldelim(); + for (const v of message.editionDefaults) { + FieldOptions_EditionDefault.encode(v!, writer.uint32(162).fork()).ldelim(); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(170).fork()).ldelim(); + } + if (message.featureSupport !== undefined) { + FieldOptions_FeatureSupport.encode(message.featureSupport, writer.uint32(178).fork()).ldelim(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFieldOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.ctype = (reader.int32() as any); + break; + case 2: + message.packed = reader.bool(); + break; + case 6: + message.jstype = (reader.int32() as any); + break; + case 5: + message.lazy = reader.bool(); + break; + case 15: + message.unverifiedLazy = reader.bool(); + break; + case 3: + message.deprecated = reader.bool(); + break; + case 10: + message.weak = reader.bool(); + break; + case 16: + message.debugRedact = reader.bool(); + break; + case 17: + message.retention = (reader.int32() as any); + break; + case 19: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.targets.push((reader.int32() as any)); + } + } else { + message.targets.push((reader.int32() as any)); + } + break; + case 20: + message.editionDefaults.push(FieldOptions_EditionDefault.decode(reader, reader.uint32())); + break; + case 21: + message.features = FeatureSet.decode(reader, reader.uint32()); + break; + case 22: + message.featureSupport = FieldOptions_FeatureSupport.decode(reader, reader.uint32()); + break; + case 999: + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): FieldOptions { + const message = createBaseFieldOptions(); + message.ctype = object.ctype ?? 1; + message.packed = object.packed ?? false; + message.jstype = object.jstype ?? 1; + message.lazy = object.lazy ?? false; + message.unverifiedLazy = object.unverifiedLazy ?? false; + message.deprecated = object.deprecated ?? false; + message.weak = object.weak ?? false; + message.debugRedact = object.debugRedact ?? false; + message.retention = object.retention ?? 1; + message.targets = object.targets?.map(e => e) || []; + message.editionDefaults = object.editionDefaults?.map(e => FieldOptions_EditionDefault.fromPartial(e)) || []; + message.features = object.features !== undefined && object.features !== null ? FeatureSet.fromPartial(object.features) : undefined; + message.featureSupport = object.featureSupport !== undefined && object.featureSupport !== null ? FieldOptions_FeatureSupport.fromPartial(object.featureSupport) : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map(e => UninterpretedOption.fromPartial(e)) || []; + return message; + }, + fromAmino(object: FieldOptionsAmino): FieldOptions { + const message = createBaseFieldOptions(); + if (object.ctype !== undefined && object.ctype !== null) { + message.ctype = object.ctype; + } + if (object.packed !== undefined && object.packed !== null) { + message.packed = object.packed; + } + if (object.jstype !== undefined && object.jstype !== null) { + message.jstype = object.jstype; + } + if (object.lazy !== undefined && object.lazy !== null) { + message.lazy = object.lazy; + } + if (object.unverified_lazy !== undefined && object.unverified_lazy !== null) { + message.unverifiedLazy = object.unverified_lazy; + } + if (object.deprecated !== undefined && object.deprecated !== null) { + message.deprecated = object.deprecated; + } + if (object.weak !== undefined && object.weak !== null) { + message.weak = object.weak; + } + if (object.debug_redact !== undefined && object.debug_redact !== null) { + message.debugRedact = object.debug_redact; + } + if (object.retention !== undefined && object.retention !== null) { + message.retention = object.retention; + } + message.targets = object.targets?.map(e => e) || []; + message.editionDefaults = object.edition_defaults?.map(e => FieldOptions_EditionDefault.fromAmino(e)) || []; + if (object.features !== undefined && object.features !== null) { + message.features = FeatureSet.fromAmino(object.features); + } + if (object.feature_support !== undefined && object.feature_support !== null) { + message.featureSupport = FieldOptions_FeatureSupport.fromAmino(object.feature_support); + } + message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; + return message; + }, + toAmino(message: FieldOptions): FieldOptionsAmino { + const obj: any = {}; + obj.ctype = message.ctype === 1 ? undefined : message.ctype; + obj.packed = message.packed === false ? undefined : message.packed; + obj.jstype = message.jstype === 1 ? undefined : message.jstype; + obj.lazy = message.lazy === false ? undefined : message.lazy; + obj.unverified_lazy = message.unverifiedLazy === false ? undefined : message.unverifiedLazy; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.weak = message.weak === false ? undefined : message.weak; + obj.debug_redact = message.debugRedact === false ? undefined : message.debugRedact; + obj.retention = message.retention === 1 ? undefined : message.retention; + if (message.targets) { + obj.targets = message.targets.map(e => e); + } else { + obj.targets = message.targets; + } + if (message.editionDefaults) { + obj.edition_defaults = message.editionDefaults.map(e => e ? FieldOptions_EditionDefault.toAmino(e) : undefined); + } else { + obj.edition_defaults = message.editionDefaults; + } + obj.features = message.features ? FeatureSet.toAmino(message.features) : undefined; + obj.feature_support = message.featureSupport ? FieldOptions_FeatureSupport.toAmino(message.featureSupport) : undefined; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); + } else { + obj.uninterpreted_option = message.uninterpretedOption; + } + return obj; + }, + fromAminoMsg(object: FieldOptionsAminoMsg): FieldOptions { + return FieldOptions.fromAmino(object.value); + }, + fromProtoMsg(message: FieldOptionsProtoMsg): FieldOptions { + return FieldOptions.decode(message.value); + }, + toProto(message: FieldOptions): Uint8Array { + return FieldOptions.encode(message).finish(); + }, + toProtoMsg(message: FieldOptions): FieldOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.FieldOptions", + value: FieldOptions.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(FieldOptions.typeUrl, FieldOptions); +function createBaseFieldOptions_EditionDefault(): FieldOptions_EditionDefault { + return { + edition: 1, + value: "" + }; +} +export const FieldOptions_EditionDefault = { + typeUrl: "/google.protobuf.EditionDefault", + is(o: any): o is FieldOptions_EditionDefault { + return o && (o.$typeUrl === FieldOptions_EditionDefault.typeUrl || isSet(o.edition) && typeof o.value === "string"); + }, + isAmino(o: any): o is FieldOptions_EditionDefaultAmino { + return o && (o.$typeUrl === FieldOptions_EditionDefault.typeUrl || isSet(o.edition) && typeof o.value === "string"); + }, + encode(message: FieldOptions_EditionDefault, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.edition !== 1) { + writer.uint32(24).int32(message.edition); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_EditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFieldOptions_EditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + message.edition = (reader.int32() as any); + break; + case 2: + message.value = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): FieldOptions_EditionDefault { + const message = createBaseFieldOptions_EditionDefault(); + message.edition = object.edition ?? 1; + message.value = object.value ?? ""; + return message; + }, + fromAmino(object: FieldOptions_EditionDefaultAmino): FieldOptions_EditionDefault { + const message = createBaseFieldOptions_EditionDefault(); + if (object.edition !== undefined && object.edition !== null) { + message.edition = object.edition; + } + if (object.value !== undefined && object.value !== null) { + message.value = object.value; + } + return message; + }, + toAmino(message: FieldOptions_EditionDefault): FieldOptions_EditionDefaultAmino { + const obj: any = {}; + obj.edition = message.edition === 1 ? undefined : message.edition; + obj.value = message.value === "" ? undefined : message.value; + return obj; + }, + fromAminoMsg(object: FieldOptions_EditionDefaultAminoMsg): FieldOptions_EditionDefault { + return FieldOptions_EditionDefault.fromAmino(object.value); + }, + fromProtoMsg(message: FieldOptions_EditionDefaultProtoMsg): FieldOptions_EditionDefault { + return FieldOptions_EditionDefault.decode(message.value); + }, + toProto(message: FieldOptions_EditionDefault): Uint8Array { + return FieldOptions_EditionDefault.encode(message).finish(); + }, + toProtoMsg(message: FieldOptions_EditionDefault): FieldOptions_EditionDefaultProtoMsg { + return { + typeUrl: "/google.protobuf.EditionDefault", + value: FieldOptions_EditionDefault.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(FieldOptions_EditionDefault.typeUrl, FieldOptions_EditionDefault); +function createBaseFieldOptions_FeatureSupport(): FieldOptions_FeatureSupport { + return { + editionIntroduced: 1, + editionDeprecated: 1, + deprecationWarning: "", + editionRemoved: 1 + }; +} +export const FieldOptions_FeatureSupport = { + typeUrl: "/google.protobuf.FeatureSupport", + is(o: any): o is FieldOptions_FeatureSupport { + return o && (o.$typeUrl === FieldOptions_FeatureSupport.typeUrl || isSet(o.editionIntroduced) && isSet(o.editionDeprecated) && typeof o.deprecationWarning === "string" && isSet(o.editionRemoved)); + }, + isAmino(o: any): o is FieldOptions_FeatureSupportAmino { + return o && (o.$typeUrl === FieldOptions_FeatureSupport.typeUrl || isSet(o.edition_introduced) && isSet(o.edition_deprecated) && typeof o.deprecation_warning === "string" && isSet(o.edition_removed)); + }, + encode(message: FieldOptions_FeatureSupport, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.editionIntroduced !== 1) { + writer.uint32(8).int32(message.editionIntroduced); + } + if (message.editionDeprecated !== 1) { + writer.uint32(16).int32(message.editionDeprecated); + } + if (message.deprecationWarning !== "") { + writer.uint32(26).string(message.deprecationWarning); + } + if (message.editionRemoved !== 1) { + writer.uint32(32).int32(message.editionRemoved); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions_FeatureSupport { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFieldOptions_FeatureSupport(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.editionIntroduced = (reader.int32() as any); + break; + case 2: + message.editionDeprecated = (reader.int32() as any); + break; + case 3: + message.deprecationWarning = reader.string(); + break; + case 4: + message.editionRemoved = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): FieldOptions_FeatureSupport { + const message = createBaseFieldOptions_FeatureSupport(); + message.editionIntroduced = object.editionIntroduced ?? 1; + message.editionDeprecated = object.editionDeprecated ?? 1; + message.deprecationWarning = object.deprecationWarning ?? ""; + message.editionRemoved = object.editionRemoved ?? 1; + return message; + }, + fromAmino(object: FieldOptions_FeatureSupportAmino): FieldOptions_FeatureSupport { + const message = createBaseFieldOptions_FeatureSupport(); + if (object.edition_introduced !== undefined && object.edition_introduced !== null) { + message.editionIntroduced = object.edition_introduced; + } + if (object.edition_deprecated !== undefined && object.edition_deprecated !== null) { + message.editionDeprecated = object.edition_deprecated; + } + if (object.deprecation_warning !== undefined && object.deprecation_warning !== null) { + message.deprecationWarning = object.deprecation_warning; + } + if (object.edition_removed !== undefined && object.edition_removed !== null) { + message.editionRemoved = object.edition_removed; + } + return message; + }, + toAmino(message: FieldOptions_FeatureSupport): FieldOptions_FeatureSupportAmino { + const obj: any = {}; + obj.edition_introduced = message.editionIntroduced === 1 ? undefined : message.editionIntroduced; + obj.edition_deprecated = message.editionDeprecated === 1 ? undefined : message.editionDeprecated; + obj.deprecation_warning = message.deprecationWarning === "" ? undefined : message.deprecationWarning; + obj.edition_removed = message.editionRemoved === 1 ? undefined : message.editionRemoved; + return obj; + }, + fromAminoMsg(object: FieldOptions_FeatureSupportAminoMsg): FieldOptions_FeatureSupport { + return FieldOptions_FeatureSupport.fromAmino(object.value); + }, + fromProtoMsg(message: FieldOptions_FeatureSupportProtoMsg): FieldOptions_FeatureSupport { + return FieldOptions_FeatureSupport.decode(message.value); + }, + toProto(message: FieldOptions_FeatureSupport): Uint8Array { + return FieldOptions_FeatureSupport.encode(message).finish(); + }, + toProtoMsg(message: FieldOptions_FeatureSupport): FieldOptions_FeatureSupportProtoMsg { + return { + typeUrl: "/google.protobuf.FeatureSupport", + value: FieldOptions_FeatureSupport.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(FieldOptions_FeatureSupport.typeUrl, FieldOptions_FeatureSupport); +function createBaseOneofOptions(): OneofOptions { + return { + features: undefined, + uninterpretedOption: [] + }; +} +export const OneofOptions = { + typeUrl: "/google.protobuf.OneofOptions", + is(o: any): o is OneofOptions { + return o && (o.$typeUrl === OneofOptions.typeUrl || Array.isArray(o.uninterpretedOption) && (!o.uninterpretedOption.length || UninterpretedOption.is(o.uninterpretedOption[0]))); + }, + isAmino(o: any): o is OneofOptionsAmino { + return o && (o.$typeUrl === OneofOptions.typeUrl || Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isAmino(o.uninterpreted_option[0]))); + }, + encode(message: OneofOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): OneofOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.features = FeatureSet.decode(reader, reader.uint32()); + break; + case 999: + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): OneofOptions { + const message = createBaseOneofOptions(); + message.features = object.features !== undefined && object.features !== null ? FeatureSet.fromPartial(object.features) : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map(e => UninterpretedOption.fromPartial(e)) || []; + return message; + }, + fromAmino(object: OneofOptionsAmino): OneofOptions { + const message = createBaseOneofOptions(); + if (object.features !== undefined && object.features !== null) { + message.features = FeatureSet.fromAmino(object.features); + } + message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; + return message; + }, + toAmino(message: OneofOptions): OneofOptionsAmino { + const obj: any = {}; + obj.features = message.features ? FeatureSet.toAmino(message.features) : undefined; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); + } else { + obj.uninterpreted_option = message.uninterpretedOption; + } + return obj; + }, + fromAminoMsg(object: OneofOptionsAminoMsg): OneofOptions { + return OneofOptions.fromAmino(object.value); + }, + fromProtoMsg(message: OneofOptionsProtoMsg): OneofOptions { + return OneofOptions.decode(message.value); + }, + toProto(message: OneofOptions): Uint8Array { + return OneofOptions.encode(message).finish(); + }, + toProtoMsg(message: OneofOptions): OneofOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.OneofOptions", + value: OneofOptions.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(OneofOptions.typeUrl, OneofOptions); +function createBaseEnumOptions(): EnumOptions { + return { + allowAlias: false, + deprecated: false, + deprecatedLegacyJsonFieldConflicts: false, + features: undefined, + uninterpretedOption: [] + }; +} +export const EnumOptions = { + typeUrl: "/google.protobuf.EnumOptions", + is(o: any): o is EnumOptions { + return o && (o.$typeUrl === EnumOptions.typeUrl || typeof o.allowAlias === "boolean" && typeof o.deprecated === "boolean" && typeof o.deprecatedLegacyJsonFieldConflicts === "boolean" && Array.isArray(o.uninterpretedOption) && (!o.uninterpretedOption.length || UninterpretedOption.is(o.uninterpretedOption[0]))); + }, + isAmino(o: any): o is EnumOptionsAmino { + return o && (o.$typeUrl === EnumOptions.typeUrl || typeof o.allow_alias === "boolean" && typeof o.deprecated === "boolean" && typeof o.deprecated_legacy_json_field_conflicts === "boolean" && Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isAmino(o.uninterpreted_option[0]))); + }, + encode(message: EnumOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.allowAlias === true) { + writer.uint32(16).bool(message.allowAlias); + } + if (message.deprecated === true) { + writer.uint32(24).bool(message.deprecated); + } + if (message.deprecatedLegacyJsonFieldConflicts === true) { + writer.uint32(48).bool(message.deprecatedLegacyJsonFieldConflicts); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EnumOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.allowAlias = reader.bool(); + break; + case 3: + message.deprecated = reader.bool(); + break; + case 6: + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + break; + case 7: + message.features = FeatureSet.decode(reader, reader.uint32()); + break; + case 999: + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): EnumOptions { + const message = createBaseEnumOptions(); + message.allowAlias = object.allowAlias ?? false; + message.deprecated = object.deprecated ?? false; + message.deprecatedLegacyJsonFieldConflicts = object.deprecatedLegacyJsonFieldConflicts ?? false; + message.features = object.features !== undefined && object.features !== null ? FeatureSet.fromPartial(object.features) : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map(e => UninterpretedOption.fromPartial(e)) || []; + return message; + }, + fromAmino(object: EnumOptionsAmino): EnumOptions { + const message = createBaseEnumOptions(); + if (object.allow_alias !== undefined && object.allow_alias !== null) { + message.allowAlias = object.allow_alias; + } + if (object.deprecated !== undefined && object.deprecated !== null) { + message.deprecated = object.deprecated; + } + if (object.deprecated_legacy_json_field_conflicts !== undefined && object.deprecated_legacy_json_field_conflicts !== null) { + message.deprecatedLegacyJsonFieldConflicts = object.deprecated_legacy_json_field_conflicts; + } + if (object.features !== undefined && object.features !== null) { + message.features = FeatureSet.fromAmino(object.features); + } + message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; + return message; + }, + toAmino(message: EnumOptions): EnumOptionsAmino { + const obj: any = {}; + obj.allow_alias = message.allowAlias === false ? undefined : message.allowAlias; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.deprecated_legacy_json_field_conflicts = message.deprecatedLegacyJsonFieldConflicts === false ? undefined : message.deprecatedLegacyJsonFieldConflicts; + obj.features = message.features ? FeatureSet.toAmino(message.features) : undefined; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); + } else { + obj.uninterpreted_option = message.uninterpretedOption; + } + return obj; + }, + fromAminoMsg(object: EnumOptionsAminoMsg): EnumOptions { + return EnumOptions.fromAmino(object.value); + }, + fromProtoMsg(message: EnumOptionsProtoMsg): EnumOptions { + return EnumOptions.decode(message.value); + }, + toProto(message: EnumOptions): Uint8Array { + return EnumOptions.encode(message).finish(); + }, + toProtoMsg(message: EnumOptions): EnumOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.EnumOptions", + value: EnumOptions.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(EnumOptions.typeUrl, EnumOptions); +function createBaseEnumValueOptions(): EnumValueOptions { + return { + deprecated: false, + features: undefined, + debugRedact: false, + uninterpretedOption: [] + }; +} +export const EnumValueOptions = { + typeUrl: "/google.protobuf.EnumValueOptions", + is(o: any): o is EnumValueOptions { + return o && (o.$typeUrl === EnumValueOptions.typeUrl || typeof o.deprecated === "boolean" && typeof o.debugRedact === "boolean" && Array.isArray(o.uninterpretedOption) && (!o.uninterpretedOption.length || UninterpretedOption.is(o.uninterpretedOption[0]))); + }, + isAmino(o: any): o is EnumValueOptionsAmino { + return o && (o.$typeUrl === EnumValueOptions.typeUrl || typeof o.deprecated === "boolean" && typeof o.debug_redact === "boolean" && Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isAmino(o.uninterpreted_option[0]))); + }, + encode(message: EnumValueOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.deprecated === true) { + writer.uint32(8).bool(message.deprecated); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(18).fork()).ldelim(); + } + if (message.debugRedact === true) { + writer.uint32(24).bool(message.debugRedact); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumValueOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.deprecated = reader.bool(); + break; + case 2: + message.features = FeatureSet.decode(reader, reader.uint32()); + break; + case 3: + message.debugRedact = reader.bool(); + break; + case 999: + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): EnumValueOptions { + const message = createBaseEnumValueOptions(); + message.deprecated = object.deprecated ?? false; + message.features = object.features !== undefined && object.features !== null ? FeatureSet.fromPartial(object.features) : undefined; + message.debugRedact = object.debugRedact ?? false; + message.uninterpretedOption = object.uninterpretedOption?.map(e => UninterpretedOption.fromPartial(e)) || []; + return message; + }, + fromAmino(object: EnumValueOptionsAmino): EnumValueOptions { + const message = createBaseEnumValueOptions(); + if (object.deprecated !== undefined && object.deprecated !== null) { + message.deprecated = object.deprecated; + } + if (object.features !== undefined && object.features !== null) { + message.features = FeatureSet.fromAmino(object.features); + } + if (object.debug_redact !== undefined && object.debug_redact !== null) { + message.debugRedact = object.debug_redact; + } + message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; + return message; + }, + toAmino(message: EnumValueOptions): EnumValueOptionsAmino { + const obj: any = {}; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.features = message.features ? FeatureSet.toAmino(message.features) : undefined; + obj.debug_redact = message.debugRedact === false ? undefined : message.debugRedact; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); + } else { + obj.uninterpreted_option = message.uninterpretedOption; + } + return obj; + }, + fromAminoMsg(object: EnumValueOptionsAminoMsg): EnumValueOptions { + return EnumValueOptions.fromAmino(object.value); + }, + fromProtoMsg(message: EnumValueOptionsProtoMsg): EnumValueOptions { + return EnumValueOptions.decode(message.value); + }, + toProto(message: EnumValueOptions): Uint8Array { + return EnumValueOptions.encode(message).finish(); + }, + toProtoMsg(message: EnumValueOptions): EnumValueOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.EnumValueOptions", + value: EnumValueOptions.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(EnumValueOptions.typeUrl, EnumValueOptions); +function createBaseServiceOptions(): ServiceOptions { + return { + features: undefined, + deprecated: false, + uninterpretedOption: [] + }; +} +export const ServiceOptions = { + typeUrl: "/google.protobuf.ServiceOptions", + is(o: any): o is ServiceOptions { + return o && (o.$typeUrl === ServiceOptions.typeUrl || typeof o.deprecated === "boolean" && Array.isArray(o.uninterpretedOption) && (!o.uninterpretedOption.length || UninterpretedOption.is(o.uninterpretedOption[0]))); + }, + isAmino(o: any): o is ServiceOptionsAmino { + return o && (o.$typeUrl === ServiceOptions.typeUrl || typeof o.deprecated === "boolean" && Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isAmino(o.uninterpreted_option[0]))); + }, + encode(message: ServiceOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(274).fork()).ldelim(); + } + if (message.deprecated === true) { + writer.uint32(264).bool(message.deprecated); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ServiceOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServiceOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 34: + message.features = FeatureSet.decode(reader, reader.uint32()); + break; + case 33: + message.deprecated = reader.bool(); + break; + case 999: + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ServiceOptions { + const message = createBaseServiceOptions(); + message.features = object.features !== undefined && object.features !== null ? FeatureSet.fromPartial(object.features) : undefined; + message.deprecated = object.deprecated ?? false; + message.uninterpretedOption = object.uninterpretedOption?.map(e => UninterpretedOption.fromPartial(e)) || []; + return message; + }, + fromAmino(object: ServiceOptionsAmino): ServiceOptions { + const message = createBaseServiceOptions(); + if (object.features !== undefined && object.features !== null) { + message.features = FeatureSet.fromAmino(object.features); + } + if (object.deprecated !== undefined && object.deprecated !== null) { + message.deprecated = object.deprecated; + } + message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; + return message; + }, + toAmino(message: ServiceOptions): ServiceOptionsAmino { + const obj: any = {}; + obj.features = message.features ? FeatureSet.toAmino(message.features) : undefined; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); + } else { + obj.uninterpreted_option = message.uninterpretedOption; + } + return obj; + }, + fromAminoMsg(object: ServiceOptionsAminoMsg): ServiceOptions { + return ServiceOptions.fromAmino(object.value); + }, + fromProtoMsg(message: ServiceOptionsProtoMsg): ServiceOptions { + return ServiceOptions.decode(message.value); + }, + toProto(message: ServiceOptions): Uint8Array { + return ServiceOptions.encode(message).finish(); + }, + toProtoMsg(message: ServiceOptions): ServiceOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.ServiceOptions", + value: ServiceOptions.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ServiceOptions.typeUrl, ServiceOptions); +function createBaseMethodOptions(): MethodOptions { + return { + deprecated: false, + idempotencyLevel: 1, + features: undefined, + uninterpretedOption: [] + }; +} +export const MethodOptions = { + typeUrl: "/google.protobuf.MethodOptions", + is(o: any): o is MethodOptions { + return o && (o.$typeUrl === MethodOptions.typeUrl || typeof o.deprecated === "boolean" && isSet(o.idempotencyLevel) && Array.isArray(o.uninterpretedOption) && (!o.uninterpretedOption.length || UninterpretedOption.is(o.uninterpretedOption[0]))); + }, + isAmino(o: any): o is MethodOptionsAmino { + return o && (o.$typeUrl === MethodOptions.typeUrl || typeof o.deprecated === "boolean" && isSet(o.idempotency_level) && Array.isArray(o.uninterpreted_option) && (!o.uninterpreted_option.length || UninterpretedOption.isAmino(o.uninterpreted_option[0]))); + }, + encode(message: MethodOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.deprecated === true) { + writer.uint32(264).bool(message.deprecated); + } + if (message.idempotencyLevel !== 1) { + writer.uint32(272).int32(message.idempotencyLevel); + } + if (message.features !== undefined) { + FeatureSet.encode(message.features, writer.uint32(282).fork()).ldelim(); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MethodOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMethodOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 33: + message.deprecated = reader.bool(); + break; + case 34: + message.idempotencyLevel = (reader.int32() as any); + break; + case 35: + message.features = FeatureSet.decode(reader, reader.uint32()); + break; + case 999: + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MethodOptions { + const message = createBaseMethodOptions(); + message.deprecated = object.deprecated ?? false; + message.idempotencyLevel = object.idempotencyLevel ?? 1; + message.features = object.features !== undefined && object.features !== null ? FeatureSet.fromPartial(object.features) : undefined; + message.uninterpretedOption = object.uninterpretedOption?.map(e => UninterpretedOption.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MethodOptionsAmino): MethodOptions { + const message = createBaseMethodOptions(); + if (object.deprecated !== undefined && object.deprecated !== null) { + message.deprecated = object.deprecated; + } + if (object.idempotency_level !== undefined && object.idempotency_level !== null) { + message.idempotencyLevel = object.idempotency_level; + } + if (object.features !== undefined && object.features !== null) { + message.features = FeatureSet.fromAmino(object.features); + } + message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; + return message; + }, + toAmino(message: MethodOptions): MethodOptionsAmino { + const obj: any = {}; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.idempotency_level = message.idempotencyLevel === 1 ? undefined : message.idempotencyLevel; + obj.features = message.features ? FeatureSet.toAmino(message.features) : undefined; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); + } else { + obj.uninterpreted_option = message.uninterpretedOption; + } + return obj; + }, + fromAminoMsg(object: MethodOptionsAminoMsg): MethodOptions { + return MethodOptions.fromAmino(object.value); + }, + fromProtoMsg(message: MethodOptionsProtoMsg): MethodOptions { + return MethodOptions.decode(message.value); + }, + toProto(message: MethodOptions): Uint8Array { + return MethodOptions.encode(message).finish(); + }, + toProtoMsg(message: MethodOptions): MethodOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.MethodOptions", + value: MethodOptions.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MethodOptions.typeUrl, MethodOptions); +function createBaseUninterpretedOption(): UninterpretedOption { + return { + name: [], + identifierValue: "", + positiveIntValue: BigInt(0), + negativeIntValue: BigInt(0), + doubleValue: 0, + stringValue: new Uint8Array(), + aggregateValue: "" + }; +} +export const UninterpretedOption = { + typeUrl: "/google.protobuf.UninterpretedOption", + is(o: any): o is UninterpretedOption { + return o && (o.$typeUrl === UninterpretedOption.typeUrl || Array.isArray(o.name) && (!o.name.length || UninterpretedOption_NamePart.is(o.name[0])) && typeof o.identifierValue === "string" && typeof o.positiveIntValue === "bigint" && typeof o.negativeIntValue === "bigint" && typeof o.doubleValue === "number" && (o.stringValue instanceof Uint8Array || typeof o.stringValue === "string") && typeof o.aggregateValue === "string"); + }, + isAmino(o: any): o is UninterpretedOptionAmino { + return o && (o.$typeUrl === UninterpretedOption.typeUrl || Array.isArray(o.name) && (!o.name.length || UninterpretedOption_NamePart.isAmino(o.name[0])) && typeof o.identifier_value === "string" && typeof o.positive_int_value === "bigint" && typeof o.negative_int_value === "bigint" && typeof o.double_value === "number" && (o.string_value instanceof Uint8Array || typeof o.string_value === "string") && typeof o.aggregate_value === "string"); + }, + encode(message: UninterpretedOption, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.name) { + UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.identifierValue !== "") { + writer.uint32(26).string(message.identifierValue); + } + if (message.positiveIntValue !== BigInt(0)) { + writer.uint32(32).uint64(message.positiveIntValue); + } + if (message.negativeIntValue !== BigInt(0)) { + writer.uint32(40).int64(message.negativeIntValue); + } + if (message.doubleValue !== 0) { + writer.uint32(49).double(message.doubleValue); + } + if (message.stringValue.length !== 0) { + writer.uint32(58).bytes(message.stringValue); + } + if (message.aggregateValue !== "") { + writer.uint32(66).string(message.aggregateValue); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUninterpretedOption(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.name.push(UninterpretedOption_NamePart.decode(reader, reader.uint32())); + break; + case 3: + message.identifierValue = reader.string(); + break; + case 4: + message.positiveIntValue = reader.uint64(); + break; + case 5: + message.negativeIntValue = reader.int64(); + break; + case 6: + message.doubleValue = reader.double(); + break; + case 7: + message.stringValue = reader.bytes(); + break; + case 8: + message.aggregateValue = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): UninterpretedOption { + const message = createBaseUninterpretedOption(); + message.name = object.name?.map(e => UninterpretedOption_NamePart.fromPartial(e)) || []; + message.identifierValue = object.identifierValue ?? ""; + message.positiveIntValue = object.positiveIntValue !== undefined && object.positiveIntValue !== null ? BigInt(object.positiveIntValue.toString()) : BigInt(0); + message.negativeIntValue = object.negativeIntValue !== undefined && object.negativeIntValue !== null ? BigInt(object.negativeIntValue.toString()) : BigInt(0); + message.doubleValue = object.doubleValue ?? 0; + message.stringValue = object.stringValue ?? new Uint8Array(); + message.aggregateValue = object.aggregateValue ?? ""; + return message; + }, + fromAmino(object: UninterpretedOptionAmino): UninterpretedOption { + const message = createBaseUninterpretedOption(); + message.name = object.name?.map(e => UninterpretedOption_NamePart.fromAmino(e)) || []; + if (object.identifier_value !== undefined && object.identifier_value !== null) { + message.identifierValue = object.identifier_value; + } + if (object.positive_int_value !== undefined && object.positive_int_value !== null) { + message.positiveIntValue = BigInt(object.positive_int_value); + } + if (object.negative_int_value !== undefined && object.negative_int_value !== null) { + message.negativeIntValue = BigInt(object.negative_int_value); + } + if (object.double_value !== undefined && object.double_value !== null) { + message.doubleValue = object.double_value; + } + if (object.string_value !== undefined && object.string_value !== null) { + message.stringValue = bytesFromBase64(object.string_value); + } + if (object.aggregate_value !== undefined && object.aggregate_value !== null) { + message.aggregateValue = object.aggregate_value; + } + return message; + }, + toAmino(message: UninterpretedOption): UninterpretedOptionAmino { + const obj: any = {}; + if (message.name) { + obj.name = message.name.map(e => e ? UninterpretedOption_NamePart.toAmino(e) : undefined); + } else { + obj.name = message.name; + } + obj.identifier_value = message.identifierValue === "" ? undefined : message.identifierValue; + obj.positive_int_value = message.positiveIntValue !== BigInt(0) ? message.positiveIntValue?.toString() : undefined; + obj.negative_int_value = message.negativeIntValue !== BigInt(0) ? message.negativeIntValue?.toString() : undefined; + obj.double_value = message.doubleValue === 0 ? undefined : message.doubleValue; + obj.string_value = message.stringValue ? base64FromBytes(message.stringValue) : undefined; + obj.aggregate_value = message.aggregateValue === "" ? undefined : message.aggregateValue; + return obj; + }, + fromAminoMsg(object: UninterpretedOptionAminoMsg): UninterpretedOption { + return UninterpretedOption.fromAmino(object.value); + }, + fromProtoMsg(message: UninterpretedOptionProtoMsg): UninterpretedOption { + return UninterpretedOption.decode(message.value); + }, + toProto(message: UninterpretedOption): Uint8Array { + return UninterpretedOption.encode(message).finish(); + }, + toProtoMsg(message: UninterpretedOption): UninterpretedOptionProtoMsg { + return { + typeUrl: "/google.protobuf.UninterpretedOption", + value: UninterpretedOption.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(UninterpretedOption.typeUrl, UninterpretedOption); +function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart { + return { + namePart: "", + isExtension: false + }; +} +export const UninterpretedOption_NamePart = { + typeUrl: "/google.protobuf.NamePart", + is(o: any): o is UninterpretedOption_NamePart { + return o && (o.$typeUrl === UninterpretedOption_NamePart.typeUrl || typeof o.namePart === "string" && typeof o.isExtension === "boolean"); + }, + isAmino(o: any): o is UninterpretedOption_NamePartAmino { + return o && (o.$typeUrl === UninterpretedOption_NamePart.typeUrl || typeof o.name_part === "string" && typeof o.is_extension === "boolean"); + }, + encode(message: UninterpretedOption_NamePart, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.namePart !== "") { + writer.uint32(10).string(message.namePart); + } + if (message.isExtension === true) { + writer.uint32(16).bool(message.isExtension); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption_NamePart { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUninterpretedOption_NamePart(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.namePart = reader.string(); + break; + case 2: + message.isExtension = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): UninterpretedOption_NamePart { + const message = createBaseUninterpretedOption_NamePart(); + message.namePart = object.namePart ?? ""; + message.isExtension = object.isExtension ?? false; + return message; + }, + fromAmino(object: UninterpretedOption_NamePartAmino): UninterpretedOption_NamePart { + const message = createBaseUninterpretedOption_NamePart(); + if (object.name_part !== undefined && object.name_part !== null) { + message.namePart = object.name_part; + } + if (object.is_extension !== undefined && object.is_extension !== null) { + message.isExtension = object.is_extension; + } + return message; + }, + toAmino(message: UninterpretedOption_NamePart): UninterpretedOption_NamePartAmino { + const obj: any = {}; + obj.name_part = message.namePart === "" ? undefined : message.namePart; + obj.is_extension = message.isExtension === false ? undefined : message.isExtension; + return obj; + }, + fromAminoMsg(object: UninterpretedOption_NamePartAminoMsg): UninterpretedOption_NamePart { + return UninterpretedOption_NamePart.fromAmino(object.value); + }, + fromProtoMsg(message: UninterpretedOption_NamePartProtoMsg): UninterpretedOption_NamePart { + return UninterpretedOption_NamePart.decode(message.value); + }, + toProto(message: UninterpretedOption_NamePart): Uint8Array { + return UninterpretedOption_NamePart.encode(message).finish(); + }, + toProtoMsg(message: UninterpretedOption_NamePart): UninterpretedOption_NamePartProtoMsg { + return { + typeUrl: "/google.protobuf.NamePart", + value: UninterpretedOption_NamePart.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(UninterpretedOption_NamePart.typeUrl, UninterpretedOption_NamePart); +function createBaseFeatureSet(): FeatureSet { + return { + fieldPresence: 1, + enumType: 1, + repeatedFieldEncoding: 1, + utf8Validation: 0, + messageEncoding: 1, + jsonFormat: 1 + }; +} +export const FeatureSet = { + typeUrl: "/google.protobuf.FeatureSet", + is(o: any): o is FeatureSet { + return o && (o.$typeUrl === FeatureSet.typeUrl || isSet(o.fieldPresence) && isSet(o.enumType) && isSet(o.repeatedFieldEncoding) && isSet(o.utf8Validation) && isSet(o.messageEncoding) && isSet(o.jsonFormat)); + }, + isAmino(o: any): o is FeatureSetAmino { + return o && (o.$typeUrl === FeatureSet.typeUrl || isSet(o.field_presence) && isSet(o.enum_type) && isSet(o.repeated_field_encoding) && isSet(o.utf8_validation) && isSet(o.message_encoding) && isSet(o.json_format)); + }, + encode(message: FeatureSet, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.fieldPresence !== 1) { + writer.uint32(8).int32(message.fieldPresence); + } + if (message.enumType !== 1) { + writer.uint32(16).int32(message.enumType); + } + if (message.repeatedFieldEncoding !== 1) { + writer.uint32(24).int32(message.repeatedFieldEncoding); + } + if (message.utf8Validation !== 0) { + writer.uint32(32).int32(message.utf8Validation); + } + if (message.messageEncoding !== 1) { + writer.uint32(40).int32(message.messageEncoding); + } + if (message.jsonFormat !== 1) { + writer.uint32(48).int32(message.jsonFormat); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.fieldPresence = (reader.int32() as any); + break; + case 2: + message.enumType = (reader.int32() as any); + break; + case 3: + message.repeatedFieldEncoding = (reader.int32() as any); + break; + case 4: + message.utf8Validation = (reader.int32() as any); + break; + case 5: + message.messageEncoding = (reader.int32() as any); + break; + case 6: + message.jsonFormat = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): FeatureSet { + const message = createBaseFeatureSet(); + message.fieldPresence = object.fieldPresence ?? 1; + message.enumType = object.enumType ?? 1; + message.repeatedFieldEncoding = object.repeatedFieldEncoding ?? 1; + message.utf8Validation = object.utf8Validation ?? 0; + message.messageEncoding = object.messageEncoding ?? 1; + message.jsonFormat = object.jsonFormat ?? 1; + return message; + }, + fromAmino(object: FeatureSetAmino): FeatureSet { + const message = createBaseFeatureSet(); + if (object.field_presence !== undefined && object.field_presence !== null) { + message.fieldPresence = object.field_presence; + } + if (object.enum_type !== undefined && object.enum_type !== null) { + message.enumType = object.enum_type; + } + if (object.repeated_field_encoding !== undefined && object.repeated_field_encoding !== null) { + message.repeatedFieldEncoding = object.repeated_field_encoding; + } + if (object.utf8_validation !== undefined && object.utf8_validation !== null) { + message.utf8Validation = object.utf8_validation; + } + if (object.message_encoding !== undefined && object.message_encoding !== null) { + message.messageEncoding = object.message_encoding; + } + if (object.json_format !== undefined && object.json_format !== null) { + message.jsonFormat = object.json_format; + } + return message; + }, + toAmino(message: FeatureSet): FeatureSetAmino { + const obj: any = {}; + obj.field_presence = message.fieldPresence === 1 ? undefined : message.fieldPresence; + obj.enum_type = message.enumType === 1 ? undefined : message.enumType; + obj.repeated_field_encoding = message.repeatedFieldEncoding === 1 ? undefined : message.repeatedFieldEncoding; + obj.utf8_validation = message.utf8Validation === 0 ? undefined : message.utf8Validation; + obj.message_encoding = message.messageEncoding === 1 ? undefined : message.messageEncoding; + obj.json_format = message.jsonFormat === 1 ? undefined : message.jsonFormat; + return obj; + }, + fromAminoMsg(object: FeatureSetAminoMsg): FeatureSet { + return FeatureSet.fromAmino(object.value); + }, + fromProtoMsg(message: FeatureSetProtoMsg): FeatureSet { + return FeatureSet.decode(message.value); + }, + toProto(message: FeatureSet): Uint8Array { + return FeatureSet.encode(message).finish(); + }, + toProtoMsg(message: FeatureSet): FeatureSetProtoMsg { + return { + typeUrl: "/google.protobuf.FeatureSet", + value: FeatureSet.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(FeatureSet.typeUrl, FeatureSet); +function createBaseFeatureSetDefaults(): FeatureSetDefaults { + return { + defaults: [], + minimumEdition: 1, + maximumEdition: 1 + }; +} +export const FeatureSetDefaults = { + typeUrl: "/google.protobuf.FeatureSetDefaults", + is(o: any): o is FeatureSetDefaults { + return o && (o.$typeUrl === FeatureSetDefaults.typeUrl || Array.isArray(o.defaults) && (!o.defaults.length || FeatureSetDefaults_FeatureSetEditionDefault.is(o.defaults[0])) && isSet(o.minimumEdition) && isSet(o.maximumEdition)); + }, + isAmino(o: any): o is FeatureSetDefaultsAmino { + return o && (o.$typeUrl === FeatureSetDefaults.typeUrl || Array.isArray(o.defaults) && (!o.defaults.length || FeatureSetDefaults_FeatureSetEditionDefault.isAmino(o.defaults[0])) && isSet(o.minimum_edition) && isSet(o.maximum_edition)); + }, + encode(message: FeatureSetDefaults, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.defaults) { + FeatureSetDefaults_FeatureSetEditionDefault.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.minimumEdition !== 1) { + writer.uint32(32).int32(message.minimumEdition); + } + if (message.maximumEdition !== 1) { + writer.uint32(40).int32(message.maximumEdition); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.defaults.push(FeatureSetDefaults_FeatureSetEditionDefault.decode(reader, reader.uint32())); + break; + case 4: + message.minimumEdition = (reader.int32() as any); + break; + case 5: + message.maximumEdition = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): FeatureSetDefaults { + const message = createBaseFeatureSetDefaults(); + message.defaults = object.defaults?.map(e => FeatureSetDefaults_FeatureSetEditionDefault.fromPartial(e)) || []; + message.minimumEdition = object.minimumEdition ?? 1; + message.maximumEdition = object.maximumEdition ?? 1; + return message; + }, + fromAmino(object: FeatureSetDefaultsAmino): FeatureSetDefaults { + const message = createBaseFeatureSetDefaults(); + message.defaults = object.defaults?.map(e => FeatureSetDefaults_FeatureSetEditionDefault.fromAmino(e)) || []; + if (object.minimum_edition !== undefined && object.minimum_edition !== null) { + message.minimumEdition = object.minimum_edition; + } + if (object.maximum_edition !== undefined && object.maximum_edition !== null) { + message.maximumEdition = object.maximum_edition; + } + return message; + }, + toAmino(message: FeatureSetDefaults): FeatureSetDefaultsAmino { + const obj: any = {}; + if (message.defaults) { + obj.defaults = message.defaults.map(e => e ? FeatureSetDefaults_FeatureSetEditionDefault.toAmino(e) : undefined); + } else { + obj.defaults = message.defaults; + } + obj.minimum_edition = message.minimumEdition === 1 ? undefined : message.minimumEdition; + obj.maximum_edition = message.maximumEdition === 1 ? undefined : message.maximumEdition; + return obj; + }, + fromAminoMsg(object: FeatureSetDefaultsAminoMsg): FeatureSetDefaults { + return FeatureSetDefaults.fromAmino(object.value); + }, + fromProtoMsg(message: FeatureSetDefaultsProtoMsg): FeatureSetDefaults { + return FeatureSetDefaults.decode(message.value); + }, + toProto(message: FeatureSetDefaults): Uint8Array { + return FeatureSetDefaults.encode(message).finish(); + }, + toProtoMsg(message: FeatureSetDefaults): FeatureSetDefaultsProtoMsg { + return { + typeUrl: "/google.protobuf.FeatureSetDefaults", + value: FeatureSetDefaults.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(FeatureSetDefaults.typeUrl, FeatureSetDefaults); +function createBaseFeatureSetDefaults_FeatureSetEditionDefault(): FeatureSetDefaults_FeatureSetEditionDefault { + return { + edition: 1, + overridableFeatures: undefined, + fixedFeatures: undefined + }; +} +export const FeatureSetDefaults_FeatureSetEditionDefault = { + typeUrl: "/google.protobuf.FeatureSetEditionDefault", + is(o: any): o is FeatureSetDefaults_FeatureSetEditionDefault { + return o && (o.$typeUrl === FeatureSetDefaults_FeatureSetEditionDefault.typeUrl || isSet(o.edition)); + }, + isAmino(o: any): o is FeatureSetDefaults_FeatureSetEditionDefaultAmino { + return o && (o.$typeUrl === FeatureSetDefaults_FeatureSetEditionDefault.typeUrl || isSet(o.edition)); + }, + encode(message: FeatureSetDefaults_FeatureSetEditionDefault, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.edition !== 1) { + writer.uint32(24).int32(message.edition); + } + if (message.overridableFeatures !== undefined) { + FeatureSet.encode(message.overridableFeatures, writer.uint32(34).fork()).ldelim(); + } + if (message.fixedFeatures !== undefined) { + FeatureSet.encode(message.fixedFeatures, writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): FeatureSetDefaults_FeatureSetEditionDefault { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + message.edition = (reader.int32() as any); + break; + case 4: + message.overridableFeatures = FeatureSet.decode(reader, reader.uint32()); + break; + case 5: + message.fixedFeatures = FeatureSet.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): FeatureSetDefaults_FeatureSetEditionDefault { + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + message.edition = object.edition ?? 1; + message.overridableFeatures = object.overridableFeatures !== undefined && object.overridableFeatures !== null ? FeatureSet.fromPartial(object.overridableFeatures) : undefined; + message.fixedFeatures = object.fixedFeatures !== undefined && object.fixedFeatures !== null ? FeatureSet.fromPartial(object.fixedFeatures) : undefined; + return message; + }, + fromAmino(object: FeatureSetDefaults_FeatureSetEditionDefaultAmino): FeatureSetDefaults_FeatureSetEditionDefault { + const message = createBaseFeatureSetDefaults_FeatureSetEditionDefault(); + if (object.edition !== undefined && object.edition !== null) { + message.edition = object.edition; + } + if (object.overridable_features !== undefined && object.overridable_features !== null) { + message.overridableFeatures = FeatureSet.fromAmino(object.overridable_features); + } + if (object.fixed_features !== undefined && object.fixed_features !== null) { + message.fixedFeatures = FeatureSet.fromAmino(object.fixed_features); + } + return message; + }, + toAmino(message: FeatureSetDefaults_FeatureSetEditionDefault): FeatureSetDefaults_FeatureSetEditionDefaultAmino { + const obj: any = {}; + obj.edition = message.edition === 1 ? undefined : message.edition; + obj.overridable_features = message.overridableFeatures ? FeatureSet.toAmino(message.overridableFeatures) : undefined; + obj.fixed_features = message.fixedFeatures ? FeatureSet.toAmino(message.fixedFeatures) : undefined; + return obj; + }, + fromAminoMsg(object: FeatureSetDefaults_FeatureSetEditionDefaultAminoMsg): FeatureSetDefaults_FeatureSetEditionDefault { + return FeatureSetDefaults_FeatureSetEditionDefault.fromAmino(object.value); + }, + fromProtoMsg(message: FeatureSetDefaults_FeatureSetEditionDefaultProtoMsg): FeatureSetDefaults_FeatureSetEditionDefault { + return FeatureSetDefaults_FeatureSetEditionDefault.decode(message.value); + }, + toProto(message: FeatureSetDefaults_FeatureSetEditionDefault): Uint8Array { + return FeatureSetDefaults_FeatureSetEditionDefault.encode(message).finish(); + }, + toProtoMsg(message: FeatureSetDefaults_FeatureSetEditionDefault): FeatureSetDefaults_FeatureSetEditionDefaultProtoMsg { + return { + typeUrl: "/google.protobuf.FeatureSetEditionDefault", + value: FeatureSetDefaults_FeatureSetEditionDefault.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(FeatureSetDefaults_FeatureSetEditionDefault.typeUrl, FeatureSetDefaults_FeatureSetEditionDefault); +function createBaseSourceCodeInfo(): SourceCodeInfo { + return { + location: [] + }; +} +export const SourceCodeInfo = { + typeUrl: "/google.protobuf.SourceCodeInfo", + is(o: any): o is SourceCodeInfo { + return o && (o.$typeUrl === SourceCodeInfo.typeUrl || Array.isArray(o.location) && (!o.location.length || SourceCodeInfo_Location.is(o.location[0]))); + }, + isAmino(o: any): o is SourceCodeInfoAmino { + return o && (o.$typeUrl === SourceCodeInfo.typeUrl || Array.isArray(o.location) && (!o.location.length || SourceCodeInfo_Location.isAmino(o.location[0]))); + }, + encode(message: SourceCodeInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.location) { + SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSourceCodeInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.location.push(SourceCodeInfo_Location.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SourceCodeInfo { + const message = createBaseSourceCodeInfo(); + message.location = object.location?.map(e => SourceCodeInfo_Location.fromPartial(e)) || []; + return message; + }, + fromAmino(object: SourceCodeInfoAmino): SourceCodeInfo { + const message = createBaseSourceCodeInfo(); + message.location = object.location?.map(e => SourceCodeInfo_Location.fromAmino(e)) || []; + return message; + }, + toAmino(message: SourceCodeInfo): SourceCodeInfoAmino { + const obj: any = {}; + if (message.location) { + obj.location = message.location.map(e => e ? SourceCodeInfo_Location.toAmino(e) : undefined); + } else { + obj.location = message.location; + } + return obj; + }, + fromAminoMsg(object: SourceCodeInfoAminoMsg): SourceCodeInfo { + return SourceCodeInfo.fromAmino(object.value); + }, + fromProtoMsg(message: SourceCodeInfoProtoMsg): SourceCodeInfo { + return SourceCodeInfo.decode(message.value); + }, + toProto(message: SourceCodeInfo): Uint8Array { + return SourceCodeInfo.encode(message).finish(); + }, + toProtoMsg(message: SourceCodeInfo): SourceCodeInfoProtoMsg { + return { + typeUrl: "/google.protobuf.SourceCodeInfo", + value: SourceCodeInfo.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(SourceCodeInfo.typeUrl, SourceCodeInfo); +function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { + return { + path: [], + span: [], + leadingComments: "", + trailingComments: "", + leadingDetachedComments: [] + }; +} +export const SourceCodeInfo_Location = { + typeUrl: "/google.protobuf.Location", + is(o: any): o is SourceCodeInfo_Location { + return o && (o.$typeUrl === SourceCodeInfo_Location.typeUrl || Array.isArray(o.path) && (!o.path.length || typeof o.path[0] === "number") && Array.isArray(o.span) && (!o.span.length || typeof o.span[0] === "number") && typeof o.leadingComments === "string" && typeof o.trailingComments === "string" && Array.isArray(o.leadingDetachedComments) && (!o.leadingDetachedComments.length || typeof o.leadingDetachedComments[0] === "string")); + }, + isAmino(o: any): o is SourceCodeInfo_LocationAmino { + return o && (o.$typeUrl === SourceCodeInfo_Location.typeUrl || Array.isArray(o.path) && (!o.path.length || typeof o.path[0] === "number") && Array.isArray(o.span) && (!o.span.length || typeof o.span[0] === "number") && typeof o.leading_comments === "string" && typeof o.trailing_comments === "string" && Array.isArray(o.leading_detached_comments) && (!o.leading_detached_comments.length || typeof o.leading_detached_comments[0] === "string")); + }, + encode(message: SourceCodeInfo_Location, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + writer.uint32(10).fork(); + for (const v of message.path) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(18).fork(); + for (const v of message.span) { + writer.int32(v); + } + writer.ldelim(); + if (message.leadingComments !== "") { + writer.uint32(26).string(message.leadingComments); + } + if (message.trailingComments !== "") { + writer.uint32(34).string(message.trailingComments); + } + for (const v of message.leadingDetachedComments) { + writer.uint32(50).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo_Location { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSourceCodeInfo_Location(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.path.push(reader.int32()); + } + } else { + message.path.push(reader.int32()); + } + break; + case 2: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.span.push(reader.int32()); + } + } else { + message.span.push(reader.int32()); + } + break; + case 3: + message.leadingComments = reader.string(); + break; + case 4: + message.trailingComments = reader.string(); + break; + case 6: + message.leadingDetachedComments.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SourceCodeInfo_Location { + const message = createBaseSourceCodeInfo_Location(); + message.path = object.path?.map(e => e) || []; + message.span = object.span?.map(e => e) || []; + message.leadingComments = object.leadingComments ?? ""; + message.trailingComments = object.trailingComments ?? ""; + message.leadingDetachedComments = object.leadingDetachedComments?.map(e => e) || []; + return message; + }, + fromAmino(object: SourceCodeInfo_LocationAmino): SourceCodeInfo_Location { + const message = createBaseSourceCodeInfo_Location(); + message.path = object.path?.map(e => e) || []; + message.span = object.span?.map(e => e) || []; + if (object.leading_comments !== undefined && object.leading_comments !== null) { + message.leadingComments = object.leading_comments; + } + if (object.trailing_comments !== undefined && object.trailing_comments !== null) { + message.trailingComments = object.trailing_comments; + } + message.leadingDetachedComments = object.leading_detached_comments?.map(e => e) || []; + return message; + }, + toAmino(message: SourceCodeInfo_Location): SourceCodeInfo_LocationAmino { + const obj: any = {}; + if (message.path) { + obj.path = message.path.map(e => e); + } else { + obj.path = message.path; + } + if (message.span) { + obj.span = message.span.map(e => e); + } else { + obj.span = message.span; + } + obj.leading_comments = message.leadingComments === "" ? undefined : message.leadingComments; + obj.trailing_comments = message.trailingComments === "" ? undefined : message.trailingComments; + if (message.leadingDetachedComments) { + obj.leading_detached_comments = message.leadingDetachedComments.map(e => e); + } else { + obj.leading_detached_comments = message.leadingDetachedComments; + } + return obj; + }, + fromAminoMsg(object: SourceCodeInfo_LocationAminoMsg): SourceCodeInfo_Location { + return SourceCodeInfo_Location.fromAmino(object.value); + }, + fromProtoMsg(message: SourceCodeInfo_LocationProtoMsg): SourceCodeInfo_Location { + return SourceCodeInfo_Location.decode(message.value); + }, + toProto(message: SourceCodeInfo_Location): Uint8Array { + return SourceCodeInfo_Location.encode(message).finish(); + }, + toProtoMsg(message: SourceCodeInfo_Location): SourceCodeInfo_LocationProtoMsg { + return { + typeUrl: "/google.protobuf.Location", + value: SourceCodeInfo_Location.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(SourceCodeInfo_Location.typeUrl, SourceCodeInfo_Location); +function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { + return { + annotation: [] + }; +} +export const GeneratedCodeInfo = { + typeUrl: "/google.protobuf.GeneratedCodeInfo", + is(o: any): o is GeneratedCodeInfo { + return o && (o.$typeUrl === GeneratedCodeInfo.typeUrl || Array.isArray(o.annotation) && (!o.annotation.length || GeneratedCodeInfo_Annotation.is(o.annotation[0]))); + }, + isAmino(o: any): o is GeneratedCodeInfoAmino { + return o && (o.$typeUrl === GeneratedCodeInfo.typeUrl || Array.isArray(o.annotation) && (!o.annotation.length || GeneratedCodeInfo_Annotation.isAmino(o.annotation[0]))); + }, + encode(message: GeneratedCodeInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.annotation) { + GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneratedCodeInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.annotation.push(GeneratedCodeInfo_Annotation.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): GeneratedCodeInfo { + const message = createBaseGeneratedCodeInfo(); + message.annotation = object.annotation?.map(e => GeneratedCodeInfo_Annotation.fromPartial(e)) || []; + return message; + }, + fromAmino(object: GeneratedCodeInfoAmino): GeneratedCodeInfo { + const message = createBaseGeneratedCodeInfo(); + message.annotation = object.annotation?.map(e => GeneratedCodeInfo_Annotation.fromAmino(e)) || []; + return message; + }, + toAmino(message: GeneratedCodeInfo): GeneratedCodeInfoAmino { + const obj: any = {}; + if (message.annotation) { + obj.annotation = message.annotation.map(e => e ? GeneratedCodeInfo_Annotation.toAmino(e) : undefined); + } else { + obj.annotation = message.annotation; + } + return obj; + }, + fromAminoMsg(object: GeneratedCodeInfoAminoMsg): GeneratedCodeInfo { + return GeneratedCodeInfo.fromAmino(object.value); + }, + fromProtoMsg(message: GeneratedCodeInfoProtoMsg): GeneratedCodeInfo { + return GeneratedCodeInfo.decode(message.value); + }, + toProto(message: GeneratedCodeInfo): Uint8Array { + return GeneratedCodeInfo.encode(message).finish(); + }, + toProtoMsg(message: GeneratedCodeInfo): GeneratedCodeInfoProtoMsg { + return { + typeUrl: "/google.protobuf.GeneratedCodeInfo", + value: GeneratedCodeInfo.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(GeneratedCodeInfo.typeUrl, GeneratedCodeInfo); +function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { + return { + path: [], + sourceFile: "", + begin: 0, + end: 0, + semantic: 1 + }; +} +export const GeneratedCodeInfo_Annotation = { + typeUrl: "/google.protobuf.Annotation", + is(o: any): o is GeneratedCodeInfo_Annotation { + return o && (o.$typeUrl === GeneratedCodeInfo_Annotation.typeUrl || Array.isArray(o.path) && (!o.path.length || typeof o.path[0] === "number") && typeof o.sourceFile === "string" && typeof o.begin === "number" && typeof o.end === "number" && isSet(o.semantic)); + }, + isAmino(o: any): o is GeneratedCodeInfo_AnnotationAmino { + return o && (o.$typeUrl === GeneratedCodeInfo_Annotation.typeUrl || Array.isArray(o.path) && (!o.path.length || typeof o.path[0] === "number") && typeof o.source_file === "string" && typeof o.begin === "number" && typeof o.end === "number" && isSet(o.semantic)); + }, + encode(message: GeneratedCodeInfo_Annotation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + writer.uint32(10).fork(); + for (const v of message.path) { + writer.int32(v); + } + writer.ldelim(); + if (message.sourceFile !== "") { + writer.uint32(18).string(message.sourceFile); + } + if (message.begin !== 0) { + writer.uint32(24).int32(message.begin); + } + if (message.end !== 0) { + writer.uint32(32).int32(message.end); + } + if (message.semantic !== 1) { + writer.uint32(40).int32(message.semantic); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneratedCodeInfo_Annotation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.path.push(reader.int32()); + } + } else { + message.path.push(reader.int32()); + } + break; + case 2: + message.sourceFile = reader.string(); + break; + case 3: + message.begin = reader.int32(); + break; + case 4: + message.end = reader.int32(); + break; + case 5: + message.semantic = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): GeneratedCodeInfo_Annotation { + const message = createBaseGeneratedCodeInfo_Annotation(); + message.path = object.path?.map(e => e) || []; + message.sourceFile = object.sourceFile ?? ""; + message.begin = object.begin ?? 0; + message.end = object.end ?? 0; + message.semantic = object.semantic ?? 1; + return message; + }, + fromAmino(object: GeneratedCodeInfo_AnnotationAmino): GeneratedCodeInfo_Annotation { + const message = createBaseGeneratedCodeInfo_Annotation(); + message.path = object.path?.map(e => e) || []; + if (object.source_file !== undefined && object.source_file !== null) { + message.sourceFile = object.source_file; + } + if (object.begin !== undefined && object.begin !== null) { + message.begin = object.begin; + } + if (object.end !== undefined && object.end !== null) { + message.end = object.end; + } + if (object.semantic !== undefined && object.semantic !== null) { + message.semantic = object.semantic; + } + return message; + }, + toAmino(message: GeneratedCodeInfo_Annotation): GeneratedCodeInfo_AnnotationAmino { + const obj: any = {}; + if (message.path) { + obj.path = message.path.map(e => e); + } else { + obj.path = message.path; + } + obj.source_file = message.sourceFile === "" ? undefined : message.sourceFile; + obj.begin = message.begin === 0 ? undefined : message.begin; + obj.end = message.end === 0 ? undefined : message.end; + obj.semantic = message.semantic === 1 ? undefined : message.semantic; + return obj; + }, + fromAminoMsg(object: GeneratedCodeInfo_AnnotationAminoMsg): GeneratedCodeInfo_Annotation { + return GeneratedCodeInfo_Annotation.fromAmino(object.value); + }, + fromProtoMsg(message: GeneratedCodeInfo_AnnotationProtoMsg): GeneratedCodeInfo_Annotation { + return GeneratedCodeInfo_Annotation.decode(message.value); + }, + toProto(message: GeneratedCodeInfo_Annotation): Uint8Array { + return GeneratedCodeInfo_Annotation.encode(message).finish(); + }, + toProtoMsg(message: GeneratedCodeInfo_Annotation): GeneratedCodeInfo_AnnotationProtoMsg { + return { + typeUrl: "/google.protobuf.Annotation", + value: GeneratedCodeInfo_Annotation.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(GeneratedCodeInfo_Annotation.typeUrl, GeneratedCodeInfo_Annotation); \ No newline at end of file diff --git a/libs/interchain-query/src/google/protobuf/duration.ts b/libs/interchain-query/src/google/protobuf/duration.ts new file mode 100644 index 00000000..6e3e301a --- /dev/null +++ b/libs/interchain-query/src/google/protobuf/duration.ts @@ -0,0 +1,225 @@ +import { BinaryReader, BinaryWriter } from "../../binary"; +import { DeepPartial } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; +/** + * A Duration represents a signed, fixed-length span of time represented + * as a count of seconds and fractions of seconds at nanosecond + * resolution. It is independent of any calendar and concepts like "day" + * or "month". It is related to Timestamp in that the difference between + * two Timestamp values is a Duration and it can be added or subtracted + * from a Timestamp. Range is approximately +-10,000 years. + * + * # Examples + * + * Example 1: Compute Duration from two Timestamps in pseudo code. + * + * Timestamp start = ...; + * Timestamp end = ...; + * Duration duration = ...; + * + * duration.seconds = end.seconds - start.seconds; + * duration.nanos = end.nanos - start.nanos; + * + * if (duration.seconds < 0 && duration.nanos > 0) { + * duration.seconds += 1; + * duration.nanos -= 1000000000; + * } else if (duration.seconds > 0 && duration.nanos < 0) { + * duration.seconds -= 1; + * duration.nanos += 1000000000; + * } + * + * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + * + * Timestamp start = ...; + * Duration duration = ...; + * Timestamp end = ...; + * + * end.seconds = start.seconds + duration.seconds; + * end.nanos = start.nanos + duration.nanos; + * + * if (end.nanos < 0) { + * end.seconds -= 1; + * end.nanos += 1000000000; + * } else if (end.nanos >= 1000000000) { + * end.seconds += 1; + * end.nanos -= 1000000000; + * } + * + * Example 3: Compute Duration from datetime.timedelta in Python. + * + * td = datetime.timedelta(days=3, minutes=10) + * duration = Duration() + * duration.FromTimedelta(td) + * + * # JSON Mapping + * + * In JSON format, the Duration type is encoded as a string rather than an + * object, where the string ends in the suffix "s" (indicating seconds) and + * is preceded by the number of seconds, with nanoseconds expressed as + * fractional seconds. For example, 3 seconds with 0 nanoseconds should be + * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + * be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + * microsecond should be expressed in JSON format as "3.000001s". + */ +export interface Duration { + /** + * Signed seconds of the span of time. Must be from -315,576,000,000 + * to +315,576,000,000 inclusive. Note: these bounds are computed from: + * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + */ + seconds: bigint; + /** + * Signed fractions of a second at nanosecond resolution of the span + * of time. Durations less than one second are represented with a 0 + * `seconds` field and a positive or negative `nanos` field. For durations + * of one second or more, a non-zero value for the `nanos` field must be + * of the same sign as the `seconds` field. Must be from -999,999,999 + * to +999,999,999 inclusive. + */ + nanos: number; +} +export interface DurationProtoMsg { + typeUrl: "/google.protobuf.Duration"; + value: Uint8Array; +} +/** + * A Duration represents a signed, fixed-length span of time represented + * as a count of seconds and fractions of seconds at nanosecond + * resolution. It is independent of any calendar and concepts like "day" + * or "month". It is related to Timestamp in that the difference between + * two Timestamp values is a Duration and it can be added or subtracted + * from a Timestamp. Range is approximately +-10,000 years. + * + * # Examples + * + * Example 1: Compute Duration from two Timestamps in pseudo code. + * + * Timestamp start = ...; + * Timestamp end = ...; + * Duration duration = ...; + * + * duration.seconds = end.seconds - start.seconds; + * duration.nanos = end.nanos - start.nanos; + * + * if (duration.seconds < 0 && duration.nanos > 0) { + * duration.seconds += 1; + * duration.nanos -= 1000000000; + * } else if (duration.seconds > 0 && duration.nanos < 0) { + * duration.seconds -= 1; + * duration.nanos += 1000000000; + * } + * + * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + * + * Timestamp start = ...; + * Duration duration = ...; + * Timestamp end = ...; + * + * end.seconds = start.seconds + duration.seconds; + * end.nanos = start.nanos + duration.nanos; + * + * if (end.nanos < 0) { + * end.seconds -= 1; + * end.nanos += 1000000000; + * } else if (end.nanos >= 1000000000) { + * end.seconds += 1; + * end.nanos -= 1000000000; + * } + * + * Example 3: Compute Duration from datetime.timedelta in Python. + * + * td = datetime.timedelta(days=3, minutes=10) + * duration = Duration() + * duration.FromTimedelta(td) + * + * # JSON Mapping + * + * In JSON format, the Duration type is encoded as a string rather than an + * object, where the string ends in the suffix "s" (indicating seconds) and + * is preceded by the number of seconds, with nanoseconds expressed as + * fractional seconds. For example, 3 seconds with 0 nanoseconds should be + * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + * be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + * microsecond should be expressed in JSON format as "3.000001s". + */ +export type DurationAmino = string; +export interface DurationAminoMsg { + type: "/google.protobuf.Duration"; + value: DurationAmino; +} +function createBaseDuration(): Duration { + return { + seconds: BigInt(0), + nanos: 0 + }; +} +export const Duration = { + typeUrl: "/google.protobuf.Duration", + is(o: any): o is Duration { + return o && (o.$typeUrl === Duration.typeUrl || typeof o.seconds === "bigint" && typeof o.nanos === "number"); + }, + isAmino(o: any): o is DurationAmino { + return o && (o.$typeUrl === Duration.typeUrl || typeof o.seconds === "bigint" && typeof o.nanos === "number"); + }, + encode(message: Duration, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.seconds !== BigInt(0)) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Duration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDuration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.seconds = reader.int64(); + break; + case 2: + message.nanos = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Duration { + const message = createBaseDuration(); + message.seconds = object.seconds !== undefined && object.seconds !== null ? BigInt(object.seconds.toString()) : BigInt(0); + message.nanos = object.nanos ?? 0; + return message; + }, + fromAmino(object: DurationAmino): Duration { + const value = BigInt(object); + return { + seconds: value / BigInt("1000000000"), + nanos: Number(value % BigInt("1000000000")) + }; + }, + toAmino(message: Duration): DurationAmino { + return (message.seconds * BigInt("1000000000") + BigInt(message.nanos)).toString(); + }, + fromAminoMsg(object: DurationAminoMsg): Duration { + return Duration.fromAmino(object.value); + }, + fromProtoMsg(message: DurationProtoMsg): Duration { + return Duration.decode(message.value); + }, + toProto(message: Duration): Uint8Array { + return Duration.encode(message).finish(); + }, + toProtoMsg(message: Duration): DurationProtoMsg { + return { + typeUrl: "/google.protobuf.Duration", + value: Duration.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Duration.typeUrl, Duration); \ No newline at end of file diff --git a/libs/interchain-query/src/google/protobuf/timestamp.ts b/libs/interchain-query/src/google/protobuf/timestamp.ts new file mode 100644 index 00000000..d4d255b3 --- /dev/null +++ b/libs/interchain-query/src/google/protobuf/timestamp.ts @@ -0,0 +1,281 @@ +import { BinaryReader, BinaryWriter } from "../../binary"; +import { DeepPartial, fromJsonTimestamp, fromTimestamp } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; +/** + * A Timestamp represents a point in time independent of any time zone or local + * calendar, encoded as a count of seconds and fractions of seconds at + * nanosecond resolution. The count is relative to an epoch at UTC midnight on + * January 1, 1970, in the proleptic Gregorian calendar which extends the + * Gregorian calendar backwards to year one. + * + * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap + * second table is needed for interpretation, using a [24-hour linear + * smear](https://developers.google.com/time/smear). + * + * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By + * restricting to that range, we ensure that we can convert to and from [RFC + * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. + * + * # Examples + * + * Example 1: Compute Timestamp from POSIX `time()`. + * + * Timestamp timestamp; + * timestamp.set_seconds(time(NULL)); + * timestamp.set_nanos(0); + * + * Example 2: Compute Timestamp from POSIX `gettimeofday()`. + * + * struct timeval tv; + * gettimeofday(&tv, NULL); + * + * Timestamp timestamp; + * timestamp.set_seconds(tv.tv_sec); + * timestamp.set_nanos(tv.tv_usec * 1000); + * + * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. + * + * FILETIME ft; + * GetSystemTimeAsFileTime(&ft); + * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; + * + * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z + * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. + * Timestamp timestamp; + * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); + * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); + * + * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. + * + * long millis = System.currentTimeMillis(); + * + * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) + * .setNanos((int) ((millis % 1000) * 1000000)).build(); + * + * Example 5: Compute Timestamp from Java `Instant.now()`. + * + * Instant now = Instant.now(); + * + * Timestamp timestamp = + * Timestamp.newBuilder().setSeconds(now.getEpochSecond()) + * .setNanos(now.getNano()).build(); + * + * Example 6: Compute Timestamp from current time in Python. + * + * timestamp = Timestamp() + * timestamp.GetCurrentTime() + * + * # JSON Mapping + * + * In JSON format, the Timestamp type is encoded as a string in the + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the + * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" + * where {year} is always expressed using four digits while {month}, {day}, + * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional + * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), + * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone + * is required. A proto3 JSON serializer should always use UTC (as indicated by + * "Z") when printing the Timestamp type and a proto3 JSON parser should be + * able to accept both UTC and other timezones (as indicated by an offset). + * + * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past + * 01:30 UTC on January 15, 2017. + * + * In JavaScript, one can convert a Date object to this format using the + * standard + * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) + * method. In Python, a standard `datetime.datetime` object can be converted + * to this format using + * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with + * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use + * the Joda Time's [`ISODateTimeFormat.dateTime()`]( + * http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime() + * ) to obtain a formatter capable of generating timestamps in this format. + */ +export interface Timestamp { + /** + * Represents seconds of UTC time since Unix epoch + * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to + * 9999-12-31T23:59:59Z inclusive. + */ + seconds: bigint; + /** + * Non-negative fractions of a second at nanosecond resolution. Negative + * second values with fractions must still have non-negative nanos values + * that count forward in time. Must be from 0 to 999,999,999 + * inclusive. + */ + nanos: number; +} +export interface TimestampProtoMsg { + typeUrl: "/google.protobuf.Timestamp"; + value: Uint8Array; +} +/** + * A Timestamp represents a point in time independent of any time zone or local + * calendar, encoded as a count of seconds and fractions of seconds at + * nanosecond resolution. The count is relative to an epoch at UTC midnight on + * January 1, 1970, in the proleptic Gregorian calendar which extends the + * Gregorian calendar backwards to year one. + * + * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap + * second table is needed for interpretation, using a [24-hour linear + * smear](https://developers.google.com/time/smear). + * + * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By + * restricting to that range, we ensure that we can convert to and from [RFC + * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. + * + * # Examples + * + * Example 1: Compute Timestamp from POSIX `time()`. + * + * Timestamp timestamp; + * timestamp.set_seconds(time(NULL)); + * timestamp.set_nanos(0); + * + * Example 2: Compute Timestamp from POSIX `gettimeofday()`. + * + * struct timeval tv; + * gettimeofday(&tv, NULL); + * + * Timestamp timestamp; + * timestamp.set_seconds(tv.tv_sec); + * timestamp.set_nanos(tv.tv_usec * 1000); + * + * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. + * + * FILETIME ft; + * GetSystemTimeAsFileTime(&ft); + * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; + * + * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z + * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. + * Timestamp timestamp; + * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); + * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); + * + * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. + * + * long millis = System.currentTimeMillis(); + * + * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) + * .setNanos((int) ((millis % 1000) * 1000000)).build(); + * + * Example 5: Compute Timestamp from Java `Instant.now()`. + * + * Instant now = Instant.now(); + * + * Timestamp timestamp = + * Timestamp.newBuilder().setSeconds(now.getEpochSecond()) + * .setNanos(now.getNano()).build(); + * + * Example 6: Compute Timestamp from current time in Python. + * + * timestamp = Timestamp() + * timestamp.GetCurrentTime() + * + * # JSON Mapping + * + * In JSON format, the Timestamp type is encoded as a string in the + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the + * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" + * where {year} is always expressed using four digits while {month}, {day}, + * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional + * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), + * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone + * is required. A proto3 JSON serializer should always use UTC (as indicated by + * "Z") when printing the Timestamp type and a proto3 JSON parser should be + * able to accept both UTC and other timezones (as indicated by an offset). + * + * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past + * 01:30 UTC on January 15, 2017. + * + * In JavaScript, one can convert a Date object to this format using the + * standard + * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) + * method. In Python, a standard `datetime.datetime` object can be converted + * to this format using + * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with + * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use + * the Joda Time's [`ISODateTimeFormat.dateTime()`]( + * http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime() + * ) to obtain a formatter capable of generating timestamps in this format. + */ +export type TimestampAmino = string; +export interface TimestampAminoMsg { + type: "/google.protobuf.Timestamp"; + value: TimestampAmino; +} +function createBaseTimestamp(): Timestamp { + return { + seconds: BigInt(0), + nanos: 0 + }; +} +export const Timestamp = { + typeUrl: "/google.protobuf.Timestamp", + is(o: any): o is Timestamp { + return o && (o.$typeUrl === Timestamp.typeUrl || typeof o.seconds === "bigint" && typeof o.nanos === "number"); + }, + isAmino(o: any): o is TimestampAmino { + return o && (o.$typeUrl === Timestamp.typeUrl || typeof o.seconds === "bigint" && typeof o.nanos === "number"); + }, + encode(message: Timestamp, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.seconds !== BigInt(0)) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Timestamp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTimestamp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.seconds = reader.int64(); + break; + case 2: + message.nanos = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Timestamp { + const message = createBaseTimestamp(); + message.seconds = object.seconds !== undefined && object.seconds !== null ? BigInt(object.seconds.toString()) : BigInt(0); + message.nanos = object.nanos ?? 0; + return message; + }, + fromAmino(object: TimestampAmino): Timestamp { + return fromJsonTimestamp(object); + }, + toAmino(message: Timestamp): TimestampAmino { + return fromTimestamp(message).toISOString().replace(/\.\d+Z$/, "Z"); + }, + fromAminoMsg(object: TimestampAminoMsg): Timestamp { + return Timestamp.fromAmino(object.value); + }, + fromProtoMsg(message: TimestampProtoMsg): Timestamp { + return Timestamp.decode(message.value); + }, + toProto(message: Timestamp): Uint8Array { + return Timestamp.encode(message).finish(); + }, + toProtoMsg(message: Timestamp): TimestampProtoMsg { + return { + typeUrl: "/google.protobuf.Timestamp", + value: Timestamp.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Timestamp.typeUrl, Timestamp); \ No newline at end of file diff --git a/libs/interchain-query/src/helper-func-types.ts b/libs/interchain-query/src/helper-func-types.ts new file mode 100644 index 00000000..9d6c2167 --- /dev/null +++ b/libs/interchain-query/src/helper-func-types.ts @@ -0,0 +1,191 @@ +/** +* This file and any referenced files were automatically generated by @cosmology/telescope@1.10.8 +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +import { HttpEndpoint } from "@interchainjs/types"; +import { BinaryReader, BinaryWriter } from "./binary"; +import { getRpcClient } from "./extern"; +import { isRpc, Rpc } from "./helpers"; + +export interface QueryBuilderOptions { + encode: (request: TReq, writer?: BinaryWriter) => BinaryWriter + decode: (input: BinaryReader | Uint8Array, length?: number) => TRes + service: string, + method: string, + clientResolver?: RpcResolver +} + +export function buildQuery(opts: QueryBuilderOptions) { + return async (request: TReq) => { + let rpc: Rpc | undefined; + + if(isRpc(opts.clientResolver)) { + rpc = opts.clientResolver; + } else { + rpc = opts.clientResolver ? await getRpcClient(opts.clientResolver) : undefined; + } + + if (!rpc) throw new Error("Query Rpc is not initialized"); + + const data = opts.encode(request).finish(); + const response = await rpc.request(opts.service, opts.method, data); + return opts.decode(response); + }; +} + +export interface ITxArgs { + signerAddress: string; + message: TMsg; + fee: StdFee | 'auto'; + memo: string; +} + +export function isISigningClient(client: unknown): client is ISigningClient { + return client !== null && client !== undefined + && typeof (client as ISigningClient).signAndBroadcast === 'function' + && typeof (client as ISigningClient).addConverters === 'function' + && typeof (client as ISigningClient).addEncoders === 'function'; +} + +export interface ISigningClient { + /** + * register converters + */ + addConverters: (converters: AminoConverter[]) => void; + /** + * register encoders + */ + addEncoders: (encoders: Encoder[]) => void; + + signAndBroadcast: ( + signerAddress: string, + message: Message[], + fee: StdFee | 'auto', + memo: string + ) => Promise; +} + +export interface TxBuilderOptions { + clientResolver?: SigningClientResolver, + typeUrl: string, + encoders?: Encoder[], + converters?: AminoConverter[], +} + +export function buildTx(opts: TxBuilderOptions) { + return async ( + signerAddress: string, + message: TMsg, + fee: StdFee | 'auto', + memo: string + ): Promise => { + let client: ISigningClient | undefined; + + // if opts.getSigningClient is a function, call it to get the SigningClient instance + if(isISigningClient(opts.clientResolver)) { + client = opts.clientResolver; + } + + if (!client) throw new Error("SigningClient is not initialized"); + + //register all related encoders and converters + client.addEncoders(opts.encoders ?? []); + client.addConverters(opts.converters ?? []); + + const data = [ + { + typeUrl: opts.typeUrl, + value: message, + }, + ]; + return client.signAndBroadcast!(signerAddress, data, fee, memo); + }; +} + +export interface Coin { + denom: string; + amount: string; +} + +export interface StdFee { + amount: Coin[]; + gas: string; + /** The granter address that is used for paying with feegrants */ + granter?: string; + /** The fee payer address. The payer must have signed the transaction. */ + payer?: string; +} + +/** + * The response after successfully broadcasting a transaction. + * Success or failure refer to the execution result. + */ +export interface DeliverTxResponse { + height: number; + /** The position of the transaction within the block. This is a 0-based index. */ + txIndex: number; + /** Error code. The transaction suceeded if and only if code is 0. */ + code: number; + transactionHash: string; + events: Event[]; + /** + * A string-based log document. + * + * This currently seems to merge attributes of multiple events into one event per type + * (https://github.com/tendermint/tendermint/issues/9595). You might want to use the `events` + * field instead. + */ + rawLog?: string; + /** @deprecated Use `msgResponses` instead. */ + data?: MsgData[]; + /** + * The message responses of the [TxMsgData](https://github.com/cosmos/cosmos-sdk/blob/v0.46.3/proto/cosmos/base/abci/v1beta1/abci.proto#L128-L140) + * as `Any`s. + * This field is an empty list for chains running Cosmos SDK < 0.46. + */ + msgResponses: Array<{ + typeUrl: string; + value: Uint8Array; + }>; + gasUsed: bigint; + gasWanted: bigint; +} + +export interface MsgData { + msgType: string; + data: Uint8Array; +} + +export interface Attribute { + key: string; + value: string; + index: boolean; +} +export interface Event { + type: string; + attributes: Attribute[]; +} + +export interface Message { + typeUrl: string; + value: T; +} + +export interface Encoder { + typeUrl: string; + fromPartial: (data: any) => any; + encode: (data: any) => Uint8Array; +} + +export interface AminoConverter { + typeUrl: string; + aminoType: string; + fromAmino: (data: any) => any; + toAmino: (data: any) => any; +} + +export type SigningClientResolver = string | HttpEndpoint | ISigningClient; +export type RpcResolver = string | HttpEndpoint | Rpc ; diff --git a/libs/interchain-query/src/helpers.ts b/libs/interchain-query/src/helpers.ts new file mode 100644 index 00000000..3f7213c0 --- /dev/null +++ b/libs/interchain-query/src/helpers.ts @@ -0,0 +1,259 @@ +/** +* This file and any referenced files were automatically generated by @cosmology/telescope@1.10.8 +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +declare var self: any | undefined; +declare var window: any | undefined; +declare var global: any | undefined; +var globalThis: any = (() => { + if (typeof globalThis !== 'undefined') return globalThis; + if (typeof self !== 'undefined') return self; + if (typeof window !== 'undefined') return window; + if (typeof global !== 'undefined') return global; + throw 'Unable to locate global object'; +})(); + +const atob: (b64: string) => string = + globalThis.atob || + ((b64) => globalThis.Buffer.from(b64, 'base64').toString('binary')); + +export function bytesFromBase64(b64: string): Uint8Array { + const bin = atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; +} + +const btoa: (bin: string) => string = + globalThis.btoa || + ((bin) => globalThis.Buffer.from(bin, 'binary').toString('base64')); + +export function base64FromBytes(arr: Uint8Array): string { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return btoa(bin.join('')); +} + +export interface AminoHeight { + readonly revision_number?: string; + readonly revision_height?: string; +} + +export function omitDefault( + input: T +): T | undefined { + if (typeof input === 'string') { + return input === '' ? undefined : input; + } + + if (typeof input === 'number') { + return input === 0 ? undefined : input; + } + + if (typeof input === "boolean"){ + return input === false ? undefined : input; + } + + if (typeof input === 'bigint') { + return input === BigInt(0) ? undefined : input; + } + + throw new Error(`Got unsupported type ${typeof input}`); +} + +interface Duration { + /** + * Signed seconds of the span of time. Must be from -315,576,000,000 + * to +315,576,000,000 inclusive. Note: these bounds are computed from: + * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + */ + seconds: bigint; + /** + * Signed fractions of a second at nanosecond resolution of the span + * of time. Durations less than one second are represented with a 0 + * `seconds` field and a positive or negative `nanos` field. For durations + * of one second or more, a non-zero value for the `nanos` field must be + * of the same sign as the `seconds` field. Must be from -999,999,999 + * to +999,999,999 inclusive. + */ + + nanos: number; +} + +export function toDuration(duration: string): Duration { + return { + seconds: BigInt(Math.floor(parseInt(duration) / 1000000000)), + nanos: parseInt(duration) % 1000000000 + }; +} + +export function fromDuration(duration: Duration): string { + return ( + parseInt(duration.seconds.toString()) * 1000000000 + + duration.nanos + ).toString(); +} + +export function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export function isObject(value: any): boolean { + return typeof value === 'object' && value !== null; +} + +export interface PageRequest { + key: Uint8Array; + offset: bigint; + limit: bigint; + countTotal: boolean; + reverse: boolean; +} + +export interface PageRequestParams { + 'pagination.key'?: string; + 'pagination.offset'?: string; + 'pagination.limit'?: string; + 'pagination.count_total'?: boolean; + 'pagination.reverse'?: boolean; +} + +export interface Params { + params: PageRequestParams; +} + +export const setPaginationParams = ( + options: Params, + pagination?: PageRequest +) => { + if (!pagination) { + return options; + } + + if (typeof pagination?.countTotal !== 'undefined') { + options.params['pagination.count_total'] = pagination.countTotal; + } + if (typeof pagination?.key !== 'undefined') { + // String to Uint8Array + // let uint8arr = new Uint8Array(Buffer.from(data,'base64')); + + // Uint8Array to String + options.params['pagination.key'] = Buffer.from(pagination.key).toString( + 'base64' + ); + } + if (typeof pagination?.limit !== 'undefined') { + options.params['pagination.limit'] = pagination.limit.toString(); + } + if (typeof pagination?.offset !== 'undefined') { + options.params['pagination.offset'] = pagination.offset.toString(); + } + if (typeof pagination?.reverse !== 'undefined') { + options.params['pagination.reverse'] = pagination.reverse; + } + + return options; +}; + +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | bigint + | boolean + | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & Record< + Exclude>, + never + >; + +export interface Rpc { + request( + service: string, + method: string, + data: Uint8Array + ): Promise; +} + +export function isRpc(rpc: unknown): rpc is Rpc { + return rpc !== null && rpc !== undefined && typeof (rpc as Rpc).request === 'function'; +} + +interface Timestamp { + /** + * Represents seconds of UTC time since Unix epoch + * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to + * 9999-12-31T23:59:59Z inclusive. + */ + seconds: bigint; + /** + * Non-negative fractions of a second at nanosecond resolution. Negative + * second values with fractions must still have non-negative nanos values + * that count forward in time. Must be from 0 to 999,999,999 + * inclusive. + */ + + nanos: number; +} + +export function toTimestamp(date: Date): Timestamp { + const seconds = numberToLong(date.getTime() / 1_000); + const nanos = (date.getTime() % 1000) * 1000000; + return { + seconds, + nanos + }; +} + +export function fromTimestamp(t: Timestamp): Date { + let millis = Number(t.seconds) * 1000; + millis += t.nanos / 1000000; + return new Date(millis); +} + +const timestampFromJSON = (object: any): Timestamp => { + return { + seconds: isSet(object.seconds) + ? BigInt(object.seconds.toString()) + : BigInt(0), + nanos: isSet(object.nanos) ? Number(object.nanos) : 0 + }; +}; + +export function fromJsonTimestamp(o: any): Timestamp { + if (o instanceof Date) { + return toTimestamp(o); + } else if (typeof o === 'string') { + return toTimestamp(new Date(o)); + } else { + return timestampFromJSON(o); + } +} + +function numberToLong(number: number) { + return BigInt(Math.trunc(number)); +} + diff --git a/libs/interchain-query/src/ibc/applications/transfer/v1/transfer.ts b/libs/interchain-query/src/ibc/applications/transfer/v1/transfer.ts new file mode 100644 index 00000000..41a63af9 --- /dev/null +++ b/libs/interchain-query/src/ibc/applications/transfer/v1/transfer.ts @@ -0,0 +1,137 @@ +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial } from "../../../../helpers"; +import { GlobalDecoderRegistry } from "../../../../registry"; +/** + * Params defines the set of IBC transfer parameters. + * NOTE: To prevent a single token from being transferred, set the + * TransfersEnabled parameter to true and then set the bank module's SendEnabled + * parameter for the denomination to false. + */ +export interface Params { + /** + * send_enabled enables or disables all cross-chain token transfers from this + * chain. + */ + sendEnabled: boolean; + /** + * receive_enabled enables or disables all cross-chain token transfers to this + * chain. + */ + receiveEnabled: boolean; +} +export interface ParamsProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.Params"; + value: Uint8Array; +} +/** + * Params defines the set of IBC transfer parameters. + * NOTE: To prevent a single token from being transferred, set the + * TransfersEnabled parameter to true and then set the bank module's SendEnabled + * parameter for the denomination to false. + */ +export interface ParamsAmino { + /** + * send_enabled enables or disables all cross-chain token transfers from this + * chain. + */ + send_enabled: boolean; + /** + * receive_enabled enables or disables all cross-chain token transfers to this + * chain. + */ + receive_enabled: boolean; +} +export interface ParamsAminoMsg { + type: "cosmos-sdk/Params"; + value: ParamsAmino; +} +function createBaseParams(): Params { + return { + sendEnabled: false, + receiveEnabled: false + }; +} +export const Params = { + typeUrl: "/ibc.applications.transfer.v1.Params", + aminoType: "cosmos-sdk/Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || typeof o.sendEnabled === "boolean" && typeof o.receiveEnabled === "boolean"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || typeof o.send_enabled === "boolean" && typeof o.receive_enabled === "boolean"); + }, + encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sendEnabled === true) { + writer.uint32(8).bool(message.sendEnabled); + } + if (message.receiveEnabled === true) { + writer.uint32(16).bool(message.receiveEnabled); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sendEnabled = reader.bool(); + break; + case 2: + message.receiveEnabled = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Params { + const message = createBaseParams(); + message.sendEnabled = object.sendEnabled ?? false; + message.receiveEnabled = object.receiveEnabled ?? false; + return message; + }, + fromAmino(object: ParamsAmino): Params { + const message = createBaseParams(); + if (object.send_enabled !== undefined && object.send_enabled !== null) { + message.sendEnabled = object.send_enabled; + } + if (object.receive_enabled !== undefined && object.receive_enabled !== null) { + message.receiveEnabled = object.receive_enabled; + } + return message; + }, + toAmino(message: Params): ParamsAmino { + const obj: any = {}; + obj.send_enabled = message.sendEnabled === false ? undefined : message.sendEnabled; + obj.receive_enabled = message.receiveEnabled === false ? undefined : message.receiveEnabled; + return obj; + }, + fromAminoMsg(object: ParamsAminoMsg): Params { + return Params.fromAmino(object.value); + }, + toAminoMsg(message: Params): ParamsAminoMsg { + return { + type: "cosmos-sdk/Params", + value: Params.toAmino(message) + }; + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: "/ibc.applications.transfer.v1.Params", + value: Params.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Params.typeUrl, Params); +GlobalDecoderRegistry.registerAminoProtoMapping(Params.aminoType, Params.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/ibc/applications/transfer/v1/tx.rpc.func.ts b/libs/interchain-query/src/ibc/applications/transfer/v1/tx.rpc.func.ts new file mode 100644 index 00000000..2e888d2c --- /dev/null +++ b/libs/interchain-query/src/ibc/applications/transfer/v1/tx.rpc.func.ts @@ -0,0 +1,22 @@ +import { buildTx, SigningClientResolver } from "../../../../helper-func-types"; +import { buildUseMutation } from "../../../../react-query"; +import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; +import { MsgTransfer, MsgUpdateParams } from "./tx"; +export const createTransfer = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgTransfer.typeUrl, + encoders: toEncoders(MsgTransfer), + converters: toConverters(MsgTransfer) +}); +export const useTransfer = buildUseMutation({ + builderMutationFn: createTransfer +}); +export const createUpdateParams = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgUpdateParams.typeUrl, + encoders: toEncoders(MsgUpdateParams), + converters: toConverters(MsgUpdateParams) +}); +export const useUpdateParams = buildUseMutation({ + builderMutationFn: createUpdateParams +}); \ No newline at end of file diff --git a/libs/interchain-query/src/ibc/applications/transfer/v1/tx.ts b/libs/interchain-query/src/ibc/applications/transfer/v1/tx.ts new file mode 100644 index 00000000..566edde6 --- /dev/null +++ b/libs/interchain-query/src/ibc/applications/transfer/v1/tx.ts @@ -0,0 +1,552 @@ +import { Coin, CoinAmino } from "../../../../cosmos/base/v1beta1/coin"; +import { Height, HeightAmino, Params, ParamsAmino } from "../../../core/client/v1/client"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial } from "../../../../helpers"; +import { GlobalDecoderRegistry } from "../../../../registry"; +/** + * MsgTransfer defines a msg to transfer fungible tokens (i.e Coins) between + * ICS20 enabled chains. See ICS Spec here: + * https://github.com/cosmos/ibc/tree/master/spec/app/ics-020-fungible-token-transfer#data-structures + */ +export interface MsgTransfer { + /** the port on which the packet will be sent */ + sourcePort: string; + /** the channel by which the packet will be sent */ + sourceChannel: string; + /** the token to be transferred. this field has been replaced by the tokens field. */ + /** @deprecated */ + token: Coin; + /** the sender address */ + sender: string; + /** the recipient address on the destination chain */ + receiver: string; + /** + * Timeout height relative to the current block height. + * The timeout is disabled when set to 0. + */ + timeoutHeight: Height; + /** + * Timeout timestamp in absolute nanoseconds since unix epoch. + * The timeout is disabled when set to 0. + */ + timeoutTimestamp: bigint; + /** optional memo */ + memo: string; + /** tokens to be transferred */ + tokens: Coin[]; +} +export interface MsgTransferProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.MsgTransfer"; + value: Uint8Array; +} +/** + * MsgTransfer defines a msg to transfer fungible tokens (i.e Coins) between + * ICS20 enabled chains. See ICS Spec here: + * https://github.com/cosmos/ibc/tree/master/spec/app/ics-020-fungible-token-transfer#data-structures + */ +export interface MsgTransferAmino { + /** the port on which the packet will be sent */ + source_port: string; + /** the channel by which the packet will be sent */ + source_channel: string; + /** the token to be transferred. this field has been replaced by the tokens field. */ + /** @deprecated */ + token: CoinAmino; + /** the sender address */ + sender: string; + /** the recipient address on the destination chain */ + receiver: string; + /** + * Timeout height relative to the current block height. + * The timeout is disabled when set to 0. + */ + timeout_height: HeightAmino; + /** + * Timeout timestamp in absolute nanoseconds since unix epoch. + * The timeout is disabled when set to 0. + */ + timeout_timestamp: string; + /** optional memo */ + memo: string; + /** tokens to be transferred */ + tokens: CoinAmino[]; +} +export interface MsgTransferAminoMsg { + type: "cosmos-sdk/MsgTransfer"; + value: MsgTransferAmino; +} +/** MsgTransferResponse defines the Msg/Transfer response type. */ +export interface MsgTransferResponse { + /** sequence number of the transfer packet sent */ + sequence: bigint; +} +export interface MsgTransferResponseProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.MsgTransferResponse"; + value: Uint8Array; +} +/** MsgTransferResponse defines the Msg/Transfer response type. */ +export interface MsgTransferResponseAmino { + /** sequence number of the transfer packet sent */ + sequence: string; +} +export interface MsgTransferResponseAminoMsg { + type: "cosmos-sdk/MsgTransferResponse"; + value: MsgTransferResponseAmino; +} +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParams { + /** signer address */ + signer: string; + /** + * params defines the transfer parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params; +} +export interface MsgUpdateParamsProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.MsgUpdateParams"; + value: Uint8Array; +} +/** MsgUpdateParams is the Msg/UpdateParams request type. */ +export interface MsgUpdateParamsAmino { + /** signer address */ + signer: string; + /** + * params defines the transfer parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: ParamsAmino; +} +export interface MsgUpdateParamsAminoMsg { + type: "cosmos-sdk/MsgUpdateParams"; + value: MsgUpdateParamsAmino; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponse {} +export interface MsgUpdateParamsResponseProtoMsg { + typeUrl: "/ibc.applications.transfer.v1.MsgUpdateParamsResponse"; + value: Uint8Array; +} +/** + * MsgUpdateParamsResponse defines the response structure for executing a + * MsgUpdateParams message. + */ +export interface MsgUpdateParamsResponseAmino {} +export interface MsgUpdateParamsResponseAminoMsg { + type: "cosmos-sdk/MsgUpdateParamsResponse"; + value: MsgUpdateParamsResponseAmino; +} +function createBaseMsgTransfer(): MsgTransfer { + return { + sourcePort: "", + sourceChannel: "", + token: Coin.fromPartial({}), + sender: "", + receiver: "", + timeoutHeight: Height.fromPartial({}), + timeoutTimestamp: BigInt(0), + memo: "", + tokens: [] + }; +} +export const MsgTransfer = { + typeUrl: "/ibc.applications.transfer.v1.MsgTransfer", + aminoType: "cosmos-sdk/MsgTransfer", + is(o: any): o is MsgTransfer { + return o && (o.$typeUrl === MsgTransfer.typeUrl || typeof o.sourcePort === "string" && typeof o.sourceChannel === "string" && Coin.is(o.token) && typeof o.sender === "string" && typeof o.receiver === "string" && Height.is(o.timeoutHeight) && typeof o.timeoutTimestamp === "bigint" && typeof o.memo === "string" && Array.isArray(o.tokens) && (!o.tokens.length || Coin.is(o.tokens[0]))); + }, + isAmino(o: any): o is MsgTransferAmino { + return o && (o.$typeUrl === MsgTransfer.typeUrl || typeof o.source_port === "string" && typeof o.source_channel === "string" && Coin.isAmino(o.token) && typeof o.sender === "string" && typeof o.receiver === "string" && Height.isAmino(o.timeout_height) && typeof o.timeout_timestamp === "bigint" && typeof o.memo === "string" && Array.isArray(o.tokens) && (!o.tokens.length || Coin.isAmino(o.tokens[0]))); + }, + encode(message: MsgTransfer, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sourcePort !== "") { + writer.uint32(10).string(message.sourcePort); + } + if (message.sourceChannel !== "") { + writer.uint32(18).string(message.sourceChannel); + } + if (message.token !== undefined) { + Coin.encode(message.token, writer.uint32(26).fork()).ldelim(); + } + if (message.sender !== "") { + writer.uint32(34).string(message.sender); + } + if (message.receiver !== "") { + writer.uint32(42).string(message.receiver); + } + if (message.timeoutHeight !== undefined) { + Height.encode(message.timeoutHeight, writer.uint32(50).fork()).ldelim(); + } + if (message.timeoutTimestamp !== BigInt(0)) { + writer.uint32(56).uint64(message.timeoutTimestamp); + } + if (message.memo !== "") { + writer.uint32(66).string(message.memo); + } + for (const v of message.tokens) { + Coin.encode(v!, writer.uint32(74).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgTransfer { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgTransfer(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sourcePort = reader.string(); + break; + case 2: + message.sourceChannel = reader.string(); + break; + case 3: + message.token = Coin.decode(reader, reader.uint32()); + break; + case 4: + message.sender = reader.string(); + break; + case 5: + message.receiver = reader.string(); + break; + case 6: + message.timeoutHeight = Height.decode(reader, reader.uint32()); + break; + case 7: + message.timeoutTimestamp = reader.uint64(); + break; + case 8: + message.memo = reader.string(); + break; + case 9: + message.tokens.push(Coin.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgTransfer { + const message = createBaseMsgTransfer(); + message.sourcePort = object.sourcePort ?? ""; + message.sourceChannel = object.sourceChannel ?? ""; + message.token = object.token !== undefined && object.token !== null ? Coin.fromPartial(object.token) : undefined; + message.sender = object.sender ?? ""; + message.receiver = object.receiver ?? ""; + message.timeoutHeight = object.timeoutHeight !== undefined && object.timeoutHeight !== null ? Height.fromPartial(object.timeoutHeight) : undefined; + message.timeoutTimestamp = object.timeoutTimestamp !== undefined && object.timeoutTimestamp !== null ? BigInt(object.timeoutTimestamp.toString()) : BigInt(0); + message.memo = object.memo ?? ""; + message.tokens = object.tokens?.map(e => Coin.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MsgTransferAmino): MsgTransfer { + const message = createBaseMsgTransfer(); + if (object.source_port !== undefined && object.source_port !== null) { + message.sourcePort = object.source_port; + } + if (object.source_channel !== undefined && object.source_channel !== null) { + message.sourceChannel = object.source_channel; + } + if (object.token !== undefined && object.token !== null) { + message.token = Coin.fromAmino(object.token); + } + if (object.sender !== undefined && object.sender !== null) { + message.sender = object.sender; + } + if (object.receiver !== undefined && object.receiver !== null) { + message.receiver = object.receiver; + } + if (object.timeout_height !== undefined && object.timeout_height !== null) { + message.timeoutHeight = Height.fromAmino(object.timeout_height); + } + if (object.timeout_timestamp !== undefined && object.timeout_timestamp !== null) { + message.timeoutTimestamp = BigInt(object.timeout_timestamp); + } + if (object.memo !== undefined && object.memo !== null) { + message.memo = object.memo; + } + message.tokens = object.tokens?.map(e => Coin.fromAmino(e)) || []; + return message; + }, + toAmino(message: MsgTransfer): MsgTransferAmino { + const obj: any = {}; + obj.source_port = message.sourcePort === "" ? undefined : message.sourcePort; + obj.source_channel = message.sourceChannel === "" ? undefined : message.sourceChannel; + obj.token = message.token ? Coin.toAmino(message.token) : Coin.toAmino(Coin.fromPartial({})); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.receiver = message.receiver === "" ? undefined : message.receiver; + obj.timeout_height = message.timeoutHeight ? Height.toAmino(message.timeoutHeight) : {}; + obj.timeout_timestamp = message.timeoutTimestamp !== BigInt(0) ? message.timeoutTimestamp?.toString() : undefined; + obj.memo = message.memo === "" ? undefined : message.memo; + if (message.tokens) { + obj.tokens = message.tokens.map(e => e ? Coin.toAmino(e) : undefined); + } else { + obj.tokens = message.tokens; + } + return obj; + }, + fromAminoMsg(object: MsgTransferAminoMsg): MsgTransfer { + return MsgTransfer.fromAmino(object.value); + }, + toAminoMsg(message: MsgTransfer): MsgTransferAminoMsg { + return { + type: "cosmos-sdk/MsgTransfer", + value: MsgTransfer.toAmino(message) + }; + }, + fromProtoMsg(message: MsgTransferProtoMsg): MsgTransfer { + return MsgTransfer.decode(message.value); + }, + toProto(message: MsgTransfer): Uint8Array { + return MsgTransfer.encode(message).finish(); + }, + toProtoMsg(message: MsgTransfer): MsgTransferProtoMsg { + return { + typeUrl: "/ibc.applications.transfer.v1.MsgTransfer", + value: MsgTransfer.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgTransfer.typeUrl, MsgTransfer); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgTransfer.aminoType, MsgTransfer.typeUrl); +function createBaseMsgTransferResponse(): MsgTransferResponse { + return { + sequence: BigInt(0) + }; +} +export const MsgTransferResponse = { + typeUrl: "/ibc.applications.transfer.v1.MsgTransferResponse", + aminoType: "cosmos-sdk/MsgTransferResponse", + is(o: any): o is MsgTransferResponse { + return o && (o.$typeUrl === MsgTransferResponse.typeUrl || typeof o.sequence === "bigint"); + }, + isAmino(o: any): o is MsgTransferResponseAmino { + return o && (o.$typeUrl === MsgTransferResponse.typeUrl || typeof o.sequence === "bigint"); + }, + encode(message: MsgTransferResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sequence !== BigInt(0)) { + writer.uint32(8).uint64(message.sequence); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgTransferResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgTransferResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgTransferResponse { + const message = createBaseMsgTransferResponse(); + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + return message; + }, + fromAmino(object: MsgTransferResponseAmino): MsgTransferResponse { + const message = createBaseMsgTransferResponse(); + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + return message; + }, + toAmino(message: MsgTransferResponse): MsgTransferResponseAmino { + const obj: any = {}; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: MsgTransferResponseAminoMsg): MsgTransferResponse { + return MsgTransferResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgTransferResponse): MsgTransferResponseAminoMsg { + return { + type: "cosmos-sdk/MsgTransferResponse", + value: MsgTransferResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgTransferResponseProtoMsg): MsgTransferResponse { + return MsgTransferResponse.decode(message.value); + }, + toProto(message: MsgTransferResponse): Uint8Array { + return MsgTransferResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgTransferResponse): MsgTransferResponseProtoMsg { + return { + typeUrl: "/ibc.applications.transfer.v1.MsgTransferResponse", + value: MsgTransferResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgTransferResponse.typeUrl, MsgTransferResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgTransferResponse.aminoType, MsgTransferResponse.typeUrl); +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { + signer: "", + params: Params.fromPartial({}) + }; +} +export const MsgUpdateParams = { + typeUrl: "/ibc.applications.transfer.v1.MsgUpdateParams", + aminoType: "cosmos-sdk/MsgUpdateParams", + is(o: any): o is MsgUpdateParams { + return o && (o.$typeUrl === MsgUpdateParams.typeUrl || typeof o.signer === "string" && Params.is(o.params)); + }, + isAmino(o: any): o is MsgUpdateParamsAmino { + return o && (o.$typeUrl === MsgUpdateParams.typeUrl || typeof o.signer === "string" && Params.isAmino(o.params)); + }, + encode(message: MsgUpdateParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.signer !== "") { + writer.uint32(10).string(message.signer); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signer = reader.string(); + break; + case 2: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + message.signer = object.signer ?? ""; + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: MsgUpdateParamsAmino): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: MsgUpdateParams): MsgUpdateParamsAmino { + const obj: any = {}; + obj.signer = message.signer === "" ? undefined : message.signer; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsAminoMsg): MsgUpdateParams { + return MsgUpdateParams.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParams): MsgUpdateParamsAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateParams", + value: MsgUpdateParams.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsProtoMsg): MsgUpdateParams { + return MsgUpdateParams.decode(message.value); + }, + toProto(message: MsgUpdateParams): Uint8Array { + return MsgUpdateParams.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParams): MsgUpdateParamsProtoMsg { + return { + typeUrl: "/ibc.applications.transfer.v1.MsgUpdateParams", + value: MsgUpdateParams.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgUpdateParams.typeUrl, MsgUpdateParams); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgUpdateParams.aminoType, MsgUpdateParams.typeUrl); +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} +export const MsgUpdateParamsResponse = { + typeUrl: "/ibc.applications.transfer.v1.MsgUpdateParamsResponse", + aminoType: "cosmos-sdk/MsgUpdateParamsResponse", + is(o: any): o is MsgUpdateParamsResponse { + return o && o.$typeUrl === MsgUpdateParamsResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateParamsResponseAmino { + return o && o.$typeUrl === MsgUpdateParamsResponse.typeUrl; + }, + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + fromAmino(_: MsgUpdateParamsResponseAmino): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + toAmino(_: MsgUpdateParamsResponse): MsgUpdateParamsResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsResponseAminoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsResponseProtoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.decode(message.value); + }, + toProto(message: MsgUpdateParamsResponse): Uint8Array { + return MsgUpdateParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseProtoMsg { + return { + typeUrl: "/ibc.applications.transfer.v1.MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgUpdateParamsResponse.typeUrl, MsgUpdateParamsResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgUpdateParamsResponse.aminoType, MsgUpdateParamsResponse.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/ibc/core/channel/v1/channel.ts b/libs/interchain-query/src/ibc/core/channel/v1/channel.ts new file mode 100644 index 00000000..6965c083 --- /dev/null +++ b/libs/interchain-query/src/ibc/core/channel/v1/channel.ts @@ -0,0 +1,1510 @@ +import { Height, HeightAmino } from "../../client/v1/client"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; +/** + * State defines if a channel is in one of the following states: + * CLOSED, INIT, TRYOPEN, OPEN, FLUSHING, FLUSHCOMPLETE or UNINITIALIZED. + */ +export enum State { + /** STATE_UNINITIALIZED_UNSPECIFIED - Default State */ + STATE_UNINITIALIZED_UNSPECIFIED = 0, + /** STATE_INIT - A channel has just started the opening handshake. */ + STATE_INIT = 1, + /** STATE_TRYOPEN - A channel has acknowledged the handshake step on the counterparty chain. */ + STATE_TRYOPEN = 2, + /** + * STATE_OPEN - A channel has completed the handshake. Open channels are + * ready to send and receive packets. + */ + STATE_OPEN = 3, + /** + * STATE_CLOSED - A channel has been closed and can no longer be used to send or receive + * packets. + */ + STATE_CLOSED = 4, + /** STATE_FLUSHING - A channel has just accepted the upgrade handshake attempt and is flushing in-flight packets. */ + STATE_FLUSHING = 5, + /** STATE_FLUSHCOMPLETE - A channel has just completed flushing any in-flight packets. */ + STATE_FLUSHCOMPLETE = 6, + UNRECOGNIZED = -1, +} +export const StateAmino = State; +export function stateFromJSON(object: any): State { + switch (object) { + case 0: + case "STATE_UNINITIALIZED_UNSPECIFIED": + return State.STATE_UNINITIALIZED_UNSPECIFIED; + case 1: + case "STATE_INIT": + return State.STATE_INIT; + case 2: + case "STATE_TRYOPEN": + return State.STATE_TRYOPEN; + case 3: + case "STATE_OPEN": + return State.STATE_OPEN; + case 4: + case "STATE_CLOSED": + return State.STATE_CLOSED; + case 5: + case "STATE_FLUSHING": + return State.STATE_FLUSHING; + case 6: + case "STATE_FLUSHCOMPLETE": + return State.STATE_FLUSHCOMPLETE; + case -1: + case "UNRECOGNIZED": + default: + return State.UNRECOGNIZED; + } +} +export function stateToJSON(object: State): string { + switch (object) { + case State.STATE_UNINITIALIZED_UNSPECIFIED: + return "STATE_UNINITIALIZED_UNSPECIFIED"; + case State.STATE_INIT: + return "STATE_INIT"; + case State.STATE_TRYOPEN: + return "STATE_TRYOPEN"; + case State.STATE_OPEN: + return "STATE_OPEN"; + case State.STATE_CLOSED: + return "STATE_CLOSED"; + case State.STATE_FLUSHING: + return "STATE_FLUSHING"; + case State.STATE_FLUSHCOMPLETE: + return "STATE_FLUSHCOMPLETE"; + case State.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** Order defines if a channel is ORDERED or UNORDERED */ +export enum Order { + /** ORDER_NONE_UNSPECIFIED - zero-value for channel ordering */ + ORDER_NONE_UNSPECIFIED = 0, + /** + * ORDER_UNORDERED - packets can be delivered in any order, which may differ from the order in + * which they were sent. + */ + ORDER_UNORDERED = 1, + /** ORDER_ORDERED - packets are delivered exactly in the order which they were sent */ + ORDER_ORDERED = 2, + UNRECOGNIZED = -1, +} +export const OrderAmino = Order; +export function orderFromJSON(object: any): Order { + switch (object) { + case 0: + case "ORDER_NONE_UNSPECIFIED": + return Order.ORDER_NONE_UNSPECIFIED; + case 1: + case "ORDER_UNORDERED": + return Order.ORDER_UNORDERED; + case 2: + case "ORDER_ORDERED": + return Order.ORDER_ORDERED; + case -1: + case "UNRECOGNIZED": + default: + return Order.UNRECOGNIZED; + } +} +export function orderToJSON(object: Order): string { + switch (object) { + case Order.ORDER_NONE_UNSPECIFIED: + return "ORDER_NONE_UNSPECIFIED"; + case Order.ORDER_UNORDERED: + return "ORDER_UNORDERED"; + case Order.ORDER_ORDERED: + return "ORDER_ORDERED"; + case Order.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** + * Channel defines pipeline for exactly-once packet delivery between specific + * modules on separate blockchains, which has at least one end capable of + * sending packets and one end capable of receiving packets. + */ +export interface Channel { + /** current state of the channel end */ + state: State; + /** whether the channel is ordered or unordered */ + ordering: Order; + /** counterparty channel end */ + counterparty: Counterparty; + /** + * list of connection identifiers, in order, along which packets sent on + * this channel will travel + */ + connectionHops: string[]; + /** opaque channel version, which is agreed upon during the handshake */ + version: string; + /** + * upgrade sequence indicates the latest upgrade attempt performed by this channel + * the value of 0 indicates the channel has never been upgraded + */ + upgradeSequence: bigint; +} +export interface ChannelProtoMsg { + typeUrl: "/ibc.core.channel.v1.Channel"; + value: Uint8Array; +} +/** + * Channel defines pipeline for exactly-once packet delivery between specific + * modules on separate blockchains, which has at least one end capable of + * sending packets and one end capable of receiving packets. + */ +export interface ChannelAmino { + /** current state of the channel end */ + state: State; + /** whether the channel is ordered or unordered */ + ordering: Order; + /** counterparty channel end */ + counterparty: CounterpartyAmino; + /** + * list of connection identifiers, in order, along which packets sent on + * this channel will travel + */ + connection_hops: string[]; + /** opaque channel version, which is agreed upon during the handshake */ + version: string; + /** + * upgrade sequence indicates the latest upgrade attempt performed by this channel + * the value of 0 indicates the channel has never been upgraded + */ + upgrade_sequence: string; +} +export interface ChannelAminoMsg { + type: "cosmos-sdk/Channel"; + value: ChannelAmino; +} +/** + * IdentifiedChannel defines a channel with additional port and channel + * identifier fields. + */ +export interface IdentifiedChannel { + /** current state of the channel end */ + state: State; + /** whether the channel is ordered or unordered */ + ordering: Order; + /** counterparty channel end */ + counterparty: Counterparty; + /** + * list of connection identifiers, in order, along which packets sent on + * this channel will travel + */ + connectionHops: string[]; + /** opaque channel version, which is agreed upon during the handshake */ + version: string; + /** port identifier */ + portId: string; + /** channel identifier */ + channelId: string; + /** + * upgrade sequence indicates the latest upgrade attempt performed by this channel + * the value of 0 indicates the channel has never been upgraded + */ + upgradeSequence: bigint; +} +export interface IdentifiedChannelProtoMsg { + typeUrl: "/ibc.core.channel.v1.IdentifiedChannel"; + value: Uint8Array; +} +/** + * IdentifiedChannel defines a channel with additional port and channel + * identifier fields. + */ +export interface IdentifiedChannelAmino { + /** current state of the channel end */ + state: State; + /** whether the channel is ordered or unordered */ + ordering: Order; + /** counterparty channel end */ + counterparty: CounterpartyAmino; + /** + * list of connection identifiers, in order, along which packets sent on + * this channel will travel + */ + connection_hops: string[]; + /** opaque channel version, which is agreed upon during the handshake */ + version: string; + /** port identifier */ + port_id: string; + /** channel identifier */ + channel_id: string; + /** + * upgrade sequence indicates the latest upgrade attempt performed by this channel + * the value of 0 indicates the channel has never been upgraded + */ + upgrade_sequence: string; +} +export interface IdentifiedChannelAminoMsg { + type: "cosmos-sdk/IdentifiedChannel"; + value: IdentifiedChannelAmino; +} +/** Counterparty defines a channel end counterparty */ +export interface Counterparty { + /** port on the counterparty chain which owns the other end of the channel. */ + portId: string; + /** channel end on the counterparty chain */ + channelId: string; +} +export interface CounterpartyProtoMsg { + typeUrl: "/ibc.core.channel.v1.Counterparty"; + value: Uint8Array; +} +/** Counterparty defines a channel end counterparty */ +export interface CounterpartyAmino { + /** port on the counterparty chain which owns the other end of the channel. */ + port_id: string; + /** channel end on the counterparty chain */ + channel_id: string; +} +export interface CounterpartyAminoMsg { + type: "cosmos-sdk/Counterparty"; + value: CounterpartyAmino; +} +/** Packet defines a type that carries data across different chains through IBC */ +export interface Packet { + /** + * number corresponds to the order of sends and receives, where a Packet + * with an earlier sequence number must be sent and received before a Packet + * with a later sequence number. + */ + sequence: bigint; + /** identifies the port on the sending chain. */ + sourcePort: string; + /** identifies the channel end on the sending chain. */ + sourceChannel: string; + /** identifies the port on the receiving chain. */ + destinationPort: string; + /** identifies the channel end on the receiving chain. */ + destinationChannel: string; + /** actual opaque bytes transferred directly to the application module */ + data: Uint8Array; + /** block height after which the packet times out */ + timeoutHeight: Height; + /** block timestamp (in nanoseconds) after which the packet times out */ + timeoutTimestamp: bigint; +} +export interface PacketProtoMsg { + typeUrl: "/ibc.core.channel.v1.Packet"; + value: Uint8Array; +} +/** Packet defines a type that carries data across different chains through IBC */ +export interface PacketAmino { + /** + * number corresponds to the order of sends and receives, where a Packet + * with an earlier sequence number must be sent and received before a Packet + * with a later sequence number. + */ + sequence: string; + /** identifies the port on the sending chain. */ + source_port: string; + /** identifies the channel end on the sending chain. */ + source_channel: string; + /** identifies the port on the receiving chain. */ + destination_port: string; + /** identifies the channel end on the receiving chain. */ + destination_channel: string; + /** actual opaque bytes transferred directly to the application module */ + data: string; + /** block height after which the packet times out */ + timeout_height: HeightAmino; + /** block timestamp (in nanoseconds) after which the packet times out */ + timeout_timestamp: string; +} +export interface PacketAminoMsg { + type: "cosmos-sdk/Packet"; + value: PacketAmino; +} +/** + * PacketState defines the generic type necessary to retrieve and store + * packet commitments, acknowledgements, and receipts. + * Caller is responsible for knowing the context necessary to interpret this + * state as a commitment, acknowledgement, or a receipt. + */ +export interface PacketState { + /** channel port identifier. */ + portId: string; + /** channel unique identifier. */ + channelId: string; + /** packet sequence. */ + sequence: bigint; + /** embedded data that represents packet state. */ + data: Uint8Array; +} +export interface PacketStateProtoMsg { + typeUrl: "/ibc.core.channel.v1.PacketState"; + value: Uint8Array; +} +/** + * PacketState defines the generic type necessary to retrieve and store + * packet commitments, acknowledgements, and receipts. + * Caller is responsible for knowing the context necessary to interpret this + * state as a commitment, acknowledgement, or a receipt. + */ +export interface PacketStateAmino { + /** channel port identifier. */ + port_id: string; + /** channel unique identifier. */ + channel_id: string; + /** packet sequence. */ + sequence: string; + /** embedded data that represents packet state. */ + data: string; +} +export interface PacketStateAminoMsg { + type: "cosmos-sdk/PacketState"; + value: PacketStateAmino; +} +/** + * PacketId is an identifier for a unique Packet + * Source chains refer to packets by source port/channel + * Destination chains refer to packets by destination port/channel + */ +export interface PacketId { + /** channel port identifier */ + portId: string; + /** channel unique identifier */ + channelId: string; + /** packet sequence */ + sequence: bigint; +} +export interface PacketIdProtoMsg { + typeUrl: "/ibc.core.channel.v1.PacketId"; + value: Uint8Array; +} +/** + * PacketId is an identifier for a unique Packet + * Source chains refer to packets by source port/channel + * Destination chains refer to packets by destination port/channel + */ +export interface PacketIdAmino { + /** channel port identifier */ + port_id: string; + /** channel unique identifier */ + channel_id: string; + /** packet sequence */ + sequence: string; +} +export interface PacketIdAminoMsg { + type: "cosmos-sdk/PacketId"; + value: PacketIdAmino; +} +/** + * Acknowledgement is the recommended acknowledgement format to be used by + * app-specific protocols. + * NOTE: The field numbers 21 and 22 were explicitly chosen to avoid accidental + * conflicts with other protobuf message formats used for acknowledgements. + * The first byte of any message with this format will be the non-ASCII values + * `0xaa` (result) or `0xb2` (error). Implemented as defined by ICS: + * https://github.com/cosmos/ibc/tree/master/spec/core/ics-004-channel-and-packet-semantics#acknowledgement-envelope + */ +export interface Acknowledgement { + result?: Uint8Array; + error?: string; +} +export interface AcknowledgementProtoMsg { + typeUrl: "/ibc.core.channel.v1.Acknowledgement"; + value: Uint8Array; +} +/** + * Acknowledgement is the recommended acknowledgement format to be used by + * app-specific protocols. + * NOTE: The field numbers 21 and 22 were explicitly chosen to avoid accidental + * conflicts with other protobuf message formats used for acknowledgements. + * The first byte of any message with this format will be the non-ASCII values + * `0xaa` (result) or `0xb2` (error). Implemented as defined by ICS: + * https://github.com/cosmos/ibc/tree/master/spec/core/ics-004-channel-and-packet-semantics#acknowledgement-envelope + */ +export interface AcknowledgementAmino { + result?: string; + error?: string; +} +export interface AcknowledgementAminoMsg { + type: "cosmos-sdk/Acknowledgement"; + value: AcknowledgementAmino; +} +/** + * Timeout defines an execution deadline structure for 04-channel handlers. + * This includes packet lifecycle handlers as well as the upgrade handshake handlers. + * A valid Timeout contains either one or both of a timestamp and block height (sequence). + */ +export interface Timeout { + /** block height after which the packet or upgrade times out */ + height: Height; + /** block timestamp (in nanoseconds) after which the packet or upgrade times out */ + timestamp: bigint; +} +export interface TimeoutProtoMsg { + typeUrl: "/ibc.core.channel.v1.Timeout"; + value: Uint8Array; +} +/** + * Timeout defines an execution deadline structure for 04-channel handlers. + * This includes packet lifecycle handlers as well as the upgrade handshake handlers. + * A valid Timeout contains either one or both of a timestamp and block height (sequence). + */ +export interface TimeoutAmino { + /** block height after which the packet or upgrade times out */ + height: HeightAmino; + /** block timestamp (in nanoseconds) after which the packet or upgrade times out */ + timestamp: string; +} +export interface TimeoutAminoMsg { + type: "cosmos-sdk/Timeout"; + value: TimeoutAmino; +} +/** Params defines the set of IBC channel parameters. */ +export interface Params { + /** the relative timeout after which channel upgrades will time out. */ + upgradeTimeout: Timeout; +} +export interface ParamsProtoMsg { + typeUrl: "/ibc.core.channel.v1.Params"; + value: Uint8Array; +} +/** Params defines the set of IBC channel parameters. */ +export interface ParamsAmino { + /** the relative timeout after which channel upgrades will time out. */ + upgrade_timeout: TimeoutAmino; +} +export interface ParamsAminoMsg { + type: "cosmos-sdk/Params"; + value: ParamsAmino; +} +function createBaseChannel(): Channel { + return { + state: 0, + ordering: 0, + counterparty: Counterparty.fromPartial({}), + connectionHops: [], + version: "", + upgradeSequence: BigInt(0) + }; +} +export const Channel = { + typeUrl: "/ibc.core.channel.v1.Channel", + aminoType: "cosmos-sdk/Channel", + is(o: any): o is Channel { + return o && (o.$typeUrl === Channel.typeUrl || isSet(o.state) && isSet(o.ordering) && Counterparty.is(o.counterparty) && Array.isArray(o.connectionHops) && (!o.connectionHops.length || typeof o.connectionHops[0] === "string") && typeof o.version === "string" && typeof o.upgradeSequence === "bigint"); + }, + isAmino(o: any): o is ChannelAmino { + return o && (o.$typeUrl === Channel.typeUrl || isSet(o.state) && isSet(o.ordering) && Counterparty.isAmino(o.counterparty) && Array.isArray(o.connection_hops) && (!o.connection_hops.length || typeof o.connection_hops[0] === "string") && typeof o.version === "string" && typeof o.upgrade_sequence === "bigint"); + }, + encode(message: Channel, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.state !== 0) { + writer.uint32(8).int32(message.state); + } + if (message.ordering !== 0) { + writer.uint32(16).int32(message.ordering); + } + if (message.counterparty !== undefined) { + Counterparty.encode(message.counterparty, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.connectionHops) { + writer.uint32(34).string(v!); + } + if (message.version !== "") { + writer.uint32(42).string(message.version); + } + if (message.upgradeSequence !== BigInt(0)) { + writer.uint32(48).uint64(message.upgradeSequence); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Channel { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseChannel(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.state = (reader.int32() as any); + break; + case 2: + message.ordering = (reader.int32() as any); + break; + case 3: + message.counterparty = Counterparty.decode(reader, reader.uint32()); + break; + case 4: + message.connectionHops.push(reader.string()); + break; + case 5: + message.version = reader.string(); + break; + case 6: + message.upgradeSequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Channel { + const message = createBaseChannel(); + message.state = object.state ?? 0; + message.ordering = object.ordering ?? 0; + message.counterparty = object.counterparty !== undefined && object.counterparty !== null ? Counterparty.fromPartial(object.counterparty) : undefined; + message.connectionHops = object.connectionHops?.map(e => e) || []; + message.version = object.version ?? ""; + message.upgradeSequence = object.upgradeSequence !== undefined && object.upgradeSequence !== null ? BigInt(object.upgradeSequence.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ChannelAmino): Channel { + const message = createBaseChannel(); + if (object.state !== undefined && object.state !== null) { + message.state = object.state; + } + if (object.ordering !== undefined && object.ordering !== null) { + message.ordering = object.ordering; + } + if (object.counterparty !== undefined && object.counterparty !== null) { + message.counterparty = Counterparty.fromAmino(object.counterparty); + } + message.connectionHops = object.connection_hops?.map(e => e) || []; + if (object.version !== undefined && object.version !== null) { + message.version = object.version; + } + if (object.upgrade_sequence !== undefined && object.upgrade_sequence !== null) { + message.upgradeSequence = BigInt(object.upgrade_sequence); + } + return message; + }, + toAmino(message: Channel): ChannelAmino { + const obj: any = {}; + obj.state = message.state === 0 ? undefined : message.state; + obj.ordering = message.ordering === 0 ? undefined : message.ordering; + obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; + if (message.connectionHops) { + obj.connection_hops = message.connectionHops.map(e => e); + } else { + obj.connection_hops = message.connectionHops; + } + obj.version = message.version === "" ? undefined : message.version; + obj.upgrade_sequence = message.upgradeSequence !== BigInt(0) ? message.upgradeSequence?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ChannelAminoMsg): Channel { + return Channel.fromAmino(object.value); + }, + toAminoMsg(message: Channel): ChannelAminoMsg { + return { + type: "cosmos-sdk/Channel", + value: Channel.toAmino(message) + }; + }, + fromProtoMsg(message: ChannelProtoMsg): Channel { + return Channel.decode(message.value); + }, + toProto(message: Channel): Uint8Array { + return Channel.encode(message).finish(); + }, + toProtoMsg(message: Channel): ChannelProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.Channel", + value: Channel.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Channel.typeUrl, Channel); +GlobalDecoderRegistry.registerAminoProtoMapping(Channel.aminoType, Channel.typeUrl); +function createBaseIdentifiedChannel(): IdentifiedChannel { + return { + state: 0, + ordering: 0, + counterparty: Counterparty.fromPartial({}), + connectionHops: [], + version: "", + portId: "", + channelId: "", + upgradeSequence: BigInt(0) + }; +} +export const IdentifiedChannel = { + typeUrl: "/ibc.core.channel.v1.IdentifiedChannel", + aminoType: "cosmos-sdk/IdentifiedChannel", + is(o: any): o is IdentifiedChannel { + return o && (o.$typeUrl === IdentifiedChannel.typeUrl || isSet(o.state) && isSet(o.ordering) && Counterparty.is(o.counterparty) && Array.isArray(o.connectionHops) && (!o.connectionHops.length || typeof o.connectionHops[0] === "string") && typeof o.version === "string" && typeof o.portId === "string" && typeof o.channelId === "string" && typeof o.upgradeSequence === "bigint"); + }, + isAmino(o: any): o is IdentifiedChannelAmino { + return o && (o.$typeUrl === IdentifiedChannel.typeUrl || isSet(o.state) && isSet(o.ordering) && Counterparty.isAmino(o.counterparty) && Array.isArray(o.connection_hops) && (!o.connection_hops.length || typeof o.connection_hops[0] === "string") && typeof o.version === "string" && typeof o.port_id === "string" && typeof o.channel_id === "string" && typeof o.upgrade_sequence === "bigint"); + }, + encode(message: IdentifiedChannel, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.state !== 0) { + writer.uint32(8).int32(message.state); + } + if (message.ordering !== 0) { + writer.uint32(16).int32(message.ordering); + } + if (message.counterparty !== undefined) { + Counterparty.encode(message.counterparty, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.connectionHops) { + writer.uint32(34).string(v!); + } + if (message.version !== "") { + writer.uint32(42).string(message.version); + } + if (message.portId !== "") { + writer.uint32(50).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(58).string(message.channelId); + } + if (message.upgradeSequence !== BigInt(0)) { + writer.uint32(64).uint64(message.upgradeSequence); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): IdentifiedChannel { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIdentifiedChannel(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.state = (reader.int32() as any); + break; + case 2: + message.ordering = (reader.int32() as any); + break; + case 3: + message.counterparty = Counterparty.decode(reader, reader.uint32()); + break; + case 4: + message.connectionHops.push(reader.string()); + break; + case 5: + message.version = reader.string(); + break; + case 6: + message.portId = reader.string(); + break; + case 7: + message.channelId = reader.string(); + break; + case 8: + message.upgradeSequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): IdentifiedChannel { + const message = createBaseIdentifiedChannel(); + message.state = object.state ?? 0; + message.ordering = object.ordering ?? 0; + message.counterparty = object.counterparty !== undefined && object.counterparty !== null ? Counterparty.fromPartial(object.counterparty) : undefined; + message.connectionHops = object.connectionHops?.map(e => e) || []; + message.version = object.version ?? ""; + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.upgradeSequence = object.upgradeSequence !== undefined && object.upgradeSequence !== null ? BigInt(object.upgradeSequence.toString()) : BigInt(0); + return message; + }, + fromAmino(object: IdentifiedChannelAmino): IdentifiedChannel { + const message = createBaseIdentifiedChannel(); + if (object.state !== undefined && object.state !== null) { + message.state = object.state; + } + if (object.ordering !== undefined && object.ordering !== null) { + message.ordering = object.ordering; + } + if (object.counterparty !== undefined && object.counterparty !== null) { + message.counterparty = Counterparty.fromAmino(object.counterparty); + } + message.connectionHops = object.connection_hops?.map(e => e) || []; + if (object.version !== undefined && object.version !== null) { + message.version = object.version; + } + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + if (object.upgrade_sequence !== undefined && object.upgrade_sequence !== null) { + message.upgradeSequence = BigInt(object.upgrade_sequence); + } + return message; + }, + toAmino(message: IdentifiedChannel): IdentifiedChannelAmino { + const obj: any = {}; + obj.state = message.state === 0 ? undefined : message.state; + obj.ordering = message.ordering === 0 ? undefined : message.ordering; + obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; + if (message.connectionHops) { + obj.connection_hops = message.connectionHops.map(e => e); + } else { + obj.connection_hops = message.connectionHops; + } + obj.version = message.version === "" ? undefined : message.version; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.upgrade_sequence = message.upgradeSequence !== BigInt(0) ? message.upgradeSequence?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: IdentifiedChannelAminoMsg): IdentifiedChannel { + return IdentifiedChannel.fromAmino(object.value); + }, + toAminoMsg(message: IdentifiedChannel): IdentifiedChannelAminoMsg { + return { + type: "cosmos-sdk/IdentifiedChannel", + value: IdentifiedChannel.toAmino(message) + }; + }, + fromProtoMsg(message: IdentifiedChannelProtoMsg): IdentifiedChannel { + return IdentifiedChannel.decode(message.value); + }, + toProto(message: IdentifiedChannel): Uint8Array { + return IdentifiedChannel.encode(message).finish(); + }, + toProtoMsg(message: IdentifiedChannel): IdentifiedChannelProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.IdentifiedChannel", + value: IdentifiedChannel.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(IdentifiedChannel.typeUrl, IdentifiedChannel); +GlobalDecoderRegistry.registerAminoProtoMapping(IdentifiedChannel.aminoType, IdentifiedChannel.typeUrl); +function createBaseCounterparty(): Counterparty { + return { + portId: "", + channelId: "" + }; +} +export const Counterparty = { + typeUrl: "/ibc.core.channel.v1.Counterparty", + aminoType: "cosmos-sdk/Counterparty", + is(o: any): o is Counterparty { + return o && (o.$typeUrl === Counterparty.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string"); + }, + isAmino(o: any): o is CounterpartyAmino { + return o && (o.$typeUrl === Counterparty.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string"); + }, + encode(message: Counterparty, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Counterparty { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCounterparty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Counterparty { + const message = createBaseCounterparty(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, + fromAmino(object: CounterpartyAmino): Counterparty { + const message = createBaseCounterparty(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + return message; + }, + toAmino(message: Counterparty): CounterpartyAmino { + const obj: any = {}; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + return obj; + }, + fromAminoMsg(object: CounterpartyAminoMsg): Counterparty { + return Counterparty.fromAmino(object.value); + }, + toAminoMsg(message: Counterparty): CounterpartyAminoMsg { + return { + type: "cosmos-sdk/Counterparty", + value: Counterparty.toAmino(message) + }; + }, + fromProtoMsg(message: CounterpartyProtoMsg): Counterparty { + return Counterparty.decode(message.value); + }, + toProto(message: Counterparty): Uint8Array { + return Counterparty.encode(message).finish(); + }, + toProtoMsg(message: Counterparty): CounterpartyProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.Counterparty", + value: Counterparty.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Counterparty.typeUrl, Counterparty); +GlobalDecoderRegistry.registerAminoProtoMapping(Counterparty.aminoType, Counterparty.typeUrl); +function createBasePacket(): Packet { + return { + sequence: BigInt(0), + sourcePort: "", + sourceChannel: "", + destinationPort: "", + destinationChannel: "", + data: new Uint8Array(), + timeoutHeight: Height.fromPartial({}), + timeoutTimestamp: BigInt(0) + }; +} +export const Packet = { + typeUrl: "/ibc.core.channel.v1.Packet", + aminoType: "cosmos-sdk/Packet", + is(o: any): o is Packet { + return o && (o.$typeUrl === Packet.typeUrl || typeof o.sequence === "bigint" && typeof o.sourcePort === "string" && typeof o.sourceChannel === "string" && typeof o.destinationPort === "string" && typeof o.destinationChannel === "string" && (o.data instanceof Uint8Array || typeof o.data === "string") && Height.is(o.timeoutHeight) && typeof o.timeoutTimestamp === "bigint"); + }, + isAmino(o: any): o is PacketAmino { + return o && (o.$typeUrl === Packet.typeUrl || typeof o.sequence === "bigint" && typeof o.source_port === "string" && typeof o.source_channel === "string" && typeof o.destination_port === "string" && typeof o.destination_channel === "string" && (o.data instanceof Uint8Array || typeof o.data === "string") && Height.isAmino(o.timeout_height) && typeof o.timeout_timestamp === "bigint"); + }, + encode(message: Packet, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sequence !== BigInt(0)) { + writer.uint32(8).uint64(message.sequence); + } + if (message.sourcePort !== "") { + writer.uint32(18).string(message.sourcePort); + } + if (message.sourceChannel !== "") { + writer.uint32(26).string(message.sourceChannel); + } + if (message.destinationPort !== "") { + writer.uint32(34).string(message.destinationPort); + } + if (message.destinationChannel !== "") { + writer.uint32(42).string(message.destinationChannel); + } + if (message.data.length !== 0) { + writer.uint32(50).bytes(message.data); + } + if (message.timeoutHeight !== undefined) { + Height.encode(message.timeoutHeight, writer.uint32(58).fork()).ldelim(); + } + if (message.timeoutTimestamp !== BigInt(0)) { + writer.uint32(64).uint64(message.timeoutTimestamp); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Packet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePacket(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sequence = reader.uint64(); + break; + case 2: + message.sourcePort = reader.string(); + break; + case 3: + message.sourceChannel = reader.string(); + break; + case 4: + message.destinationPort = reader.string(); + break; + case 5: + message.destinationChannel = reader.string(); + break; + case 6: + message.data = reader.bytes(); + break; + case 7: + message.timeoutHeight = Height.decode(reader, reader.uint32()); + break; + case 8: + message.timeoutTimestamp = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Packet { + const message = createBasePacket(); + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + message.sourcePort = object.sourcePort ?? ""; + message.sourceChannel = object.sourceChannel ?? ""; + message.destinationPort = object.destinationPort ?? ""; + message.destinationChannel = object.destinationChannel ?? ""; + message.data = object.data ?? new Uint8Array(); + message.timeoutHeight = object.timeoutHeight !== undefined && object.timeoutHeight !== null ? Height.fromPartial(object.timeoutHeight) : undefined; + message.timeoutTimestamp = object.timeoutTimestamp !== undefined && object.timeoutTimestamp !== null ? BigInt(object.timeoutTimestamp.toString()) : BigInt(0); + return message; + }, + fromAmino(object: PacketAmino): Packet { + const message = createBasePacket(); + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + if (object.source_port !== undefined && object.source_port !== null) { + message.sourcePort = object.source_port; + } + if (object.source_channel !== undefined && object.source_channel !== null) { + message.sourceChannel = object.source_channel; + } + if (object.destination_port !== undefined && object.destination_port !== null) { + message.destinationPort = object.destination_port; + } + if (object.destination_channel !== undefined && object.destination_channel !== null) { + message.destinationChannel = object.destination_channel; + } + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + if (object.timeout_height !== undefined && object.timeout_height !== null) { + message.timeoutHeight = Height.fromAmino(object.timeout_height); + } + if (object.timeout_timestamp !== undefined && object.timeout_timestamp !== null) { + message.timeoutTimestamp = BigInt(object.timeout_timestamp); + } + return message; + }, + toAmino(message: Packet): PacketAmino { + const obj: any = {}; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence?.toString() : undefined; + obj.source_port = message.sourcePort === "" ? undefined : message.sourcePort; + obj.source_channel = message.sourceChannel === "" ? undefined : message.sourceChannel; + obj.destination_port = message.destinationPort === "" ? undefined : message.destinationPort; + obj.destination_channel = message.destinationChannel === "" ? undefined : message.destinationChannel; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + obj.timeout_height = message.timeoutHeight ? Height.toAmino(message.timeoutHeight) : {}; + obj.timeout_timestamp = message.timeoutTimestamp !== BigInt(0) ? message.timeoutTimestamp?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: PacketAminoMsg): Packet { + return Packet.fromAmino(object.value); + }, + toAminoMsg(message: Packet): PacketAminoMsg { + return { + type: "cosmos-sdk/Packet", + value: Packet.toAmino(message) + }; + }, + fromProtoMsg(message: PacketProtoMsg): Packet { + return Packet.decode(message.value); + }, + toProto(message: Packet): Uint8Array { + return Packet.encode(message).finish(); + }, + toProtoMsg(message: Packet): PacketProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.Packet", + value: Packet.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Packet.typeUrl, Packet); +GlobalDecoderRegistry.registerAminoProtoMapping(Packet.aminoType, Packet.typeUrl); +function createBasePacketState(): PacketState { + return { + portId: "", + channelId: "", + sequence: BigInt(0), + data: new Uint8Array() + }; +} +export const PacketState = { + typeUrl: "/ibc.core.channel.v1.PacketState", + aminoType: "cosmos-sdk/PacketState", + is(o: any): o is PacketState { + return o && (o.$typeUrl === PacketState.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string" && typeof o.sequence === "bigint" && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + isAmino(o: any): o is PacketStateAmino { + return o && (o.$typeUrl === PacketState.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && typeof o.sequence === "bigint" && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + encode(message: PacketState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + if (message.sequence !== BigInt(0)) { + writer.uint32(24).uint64(message.sequence); + } + if (message.data.length !== 0) { + writer.uint32(34).bytes(message.data); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PacketState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePacketState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.sequence = reader.uint64(); + break; + case 4: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): PacketState { + const message = createBasePacketState(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + message.data = object.data ?? new Uint8Array(); + return message; + }, + fromAmino(object: PacketStateAmino): PacketState { + const message = createBasePacketState(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + return message; + }, + toAmino(message: PacketState): PacketStateAmino { + const obj: any = {}; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence?.toString() : undefined; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + return obj; + }, + fromAminoMsg(object: PacketStateAminoMsg): PacketState { + return PacketState.fromAmino(object.value); + }, + toAminoMsg(message: PacketState): PacketStateAminoMsg { + return { + type: "cosmos-sdk/PacketState", + value: PacketState.toAmino(message) + }; + }, + fromProtoMsg(message: PacketStateProtoMsg): PacketState { + return PacketState.decode(message.value); + }, + toProto(message: PacketState): Uint8Array { + return PacketState.encode(message).finish(); + }, + toProtoMsg(message: PacketState): PacketStateProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.PacketState", + value: PacketState.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(PacketState.typeUrl, PacketState); +GlobalDecoderRegistry.registerAminoProtoMapping(PacketState.aminoType, PacketState.typeUrl); +function createBasePacketId(): PacketId { + return { + portId: "", + channelId: "", + sequence: BigInt(0) + }; +} +export const PacketId = { + typeUrl: "/ibc.core.channel.v1.PacketId", + aminoType: "cosmos-sdk/PacketId", + is(o: any): o is PacketId { + return o && (o.$typeUrl === PacketId.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string" && typeof o.sequence === "bigint"); + }, + isAmino(o: any): o is PacketIdAmino { + return o && (o.$typeUrl === PacketId.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && typeof o.sequence === "bigint"); + }, + encode(message: PacketId, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + if (message.sequence !== BigInt(0)) { + writer.uint32(24).uint64(message.sequence); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PacketId { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePacketId(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.sequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): PacketId { + const message = createBasePacketId(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + return message; + }, + fromAmino(object: PacketIdAmino): PacketId { + const message = createBasePacketId(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + return message; + }, + toAmino(message: PacketId): PacketIdAmino { + const obj: any = {}; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: PacketIdAminoMsg): PacketId { + return PacketId.fromAmino(object.value); + }, + toAminoMsg(message: PacketId): PacketIdAminoMsg { + return { + type: "cosmos-sdk/PacketId", + value: PacketId.toAmino(message) + }; + }, + fromProtoMsg(message: PacketIdProtoMsg): PacketId { + return PacketId.decode(message.value); + }, + toProto(message: PacketId): Uint8Array { + return PacketId.encode(message).finish(); + }, + toProtoMsg(message: PacketId): PacketIdProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.PacketId", + value: PacketId.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(PacketId.typeUrl, PacketId); +GlobalDecoderRegistry.registerAminoProtoMapping(PacketId.aminoType, PacketId.typeUrl); +function createBaseAcknowledgement(): Acknowledgement { + return { + result: undefined, + error: undefined + }; +} +export const Acknowledgement = { + typeUrl: "/ibc.core.channel.v1.Acknowledgement", + aminoType: "cosmos-sdk/Acknowledgement", + is(o: any): o is Acknowledgement { + return o && o.$typeUrl === Acknowledgement.typeUrl; + }, + isAmino(o: any): o is AcknowledgementAmino { + return o && o.$typeUrl === Acknowledgement.typeUrl; + }, + encode(message: Acknowledgement, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.result !== undefined) { + writer.uint32(170).bytes(message.result); + } + if (message.error !== undefined) { + writer.uint32(178).string(message.error); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Acknowledgement { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAcknowledgement(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 21: + message.result = reader.bytes(); + break; + case 22: + message.error = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Acknowledgement { + const message = createBaseAcknowledgement(); + message.result = object.result ?? undefined; + message.error = object.error ?? undefined; + return message; + }, + fromAmino(object: AcknowledgementAmino): Acknowledgement { + const message = createBaseAcknowledgement(); + if (object.result !== undefined && object.result !== null) { + message.result = bytesFromBase64(object.result); + } + if (object.error !== undefined && object.error !== null) { + message.error = object.error; + } + return message; + }, + toAmino(message: Acknowledgement): AcknowledgementAmino { + const obj: any = {}; + obj.result = message.result ? base64FromBytes(message.result) : undefined; + obj.error = message.error === null ? undefined : message.error; + return obj; + }, + fromAminoMsg(object: AcknowledgementAminoMsg): Acknowledgement { + return Acknowledgement.fromAmino(object.value); + }, + toAminoMsg(message: Acknowledgement): AcknowledgementAminoMsg { + return { + type: "cosmos-sdk/Acknowledgement", + value: Acknowledgement.toAmino(message) + }; + }, + fromProtoMsg(message: AcknowledgementProtoMsg): Acknowledgement { + return Acknowledgement.decode(message.value); + }, + toProto(message: Acknowledgement): Uint8Array { + return Acknowledgement.encode(message).finish(); + }, + toProtoMsg(message: Acknowledgement): AcknowledgementProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.Acknowledgement", + value: Acknowledgement.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Acknowledgement.typeUrl, Acknowledgement); +GlobalDecoderRegistry.registerAminoProtoMapping(Acknowledgement.aminoType, Acknowledgement.typeUrl); +function createBaseTimeout(): Timeout { + return { + height: Height.fromPartial({}), + timestamp: BigInt(0) + }; +} +export const Timeout = { + typeUrl: "/ibc.core.channel.v1.Timeout", + aminoType: "cosmos-sdk/Timeout", + is(o: any): o is Timeout { + return o && (o.$typeUrl === Timeout.typeUrl || Height.is(o.height) && typeof o.timestamp === "bigint"); + }, + isAmino(o: any): o is TimeoutAmino { + return o && (o.$typeUrl === Timeout.typeUrl || Height.isAmino(o.height) && typeof o.timestamp === "bigint"); + }, + encode(message: Timeout, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== undefined) { + Height.encode(message.height, writer.uint32(10).fork()).ldelim(); + } + if (message.timestamp !== BigInt(0)) { + writer.uint32(16).uint64(message.timestamp); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Timeout { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTimeout(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = Height.decode(reader, reader.uint32()); + break; + case 2: + message.timestamp = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Timeout { + const message = createBaseTimeout(); + message.height = object.height !== undefined && object.height !== null ? Height.fromPartial(object.height) : undefined; + message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? BigInt(object.timestamp.toString()) : BigInt(0); + return message; + }, + fromAmino(object: TimeoutAmino): Timeout { + const message = createBaseTimeout(); + if (object.height !== undefined && object.height !== null) { + message.height = Height.fromAmino(object.height); + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = BigInt(object.timestamp); + } + return message; + }, + toAmino(message: Timeout): TimeoutAmino { + const obj: any = {}; + obj.height = message.height ? Height.toAmino(message.height) : {}; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: TimeoutAminoMsg): Timeout { + return Timeout.fromAmino(object.value); + }, + toAminoMsg(message: Timeout): TimeoutAminoMsg { + return { + type: "cosmos-sdk/Timeout", + value: Timeout.toAmino(message) + }; + }, + fromProtoMsg(message: TimeoutProtoMsg): Timeout { + return Timeout.decode(message.value); + }, + toProto(message: Timeout): Uint8Array { + return Timeout.encode(message).finish(); + }, + toProtoMsg(message: Timeout): TimeoutProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.Timeout", + value: Timeout.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Timeout.typeUrl, Timeout); +GlobalDecoderRegistry.registerAminoProtoMapping(Timeout.aminoType, Timeout.typeUrl); +function createBaseParams(): Params { + return { + upgradeTimeout: Timeout.fromPartial({}) + }; +} +export const Params = { + typeUrl: "/ibc.core.channel.v1.Params", + aminoType: "cosmos-sdk/Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || Timeout.is(o.upgradeTimeout)); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || Timeout.isAmino(o.upgrade_timeout)); + }, + encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.upgradeTimeout !== undefined) { + Timeout.encode(message.upgradeTimeout, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.upgradeTimeout = Timeout.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Params { + const message = createBaseParams(); + message.upgradeTimeout = object.upgradeTimeout !== undefined && object.upgradeTimeout !== null ? Timeout.fromPartial(object.upgradeTimeout) : undefined; + return message; + }, + fromAmino(object: ParamsAmino): Params { + const message = createBaseParams(); + if (object.upgrade_timeout !== undefined && object.upgrade_timeout !== null) { + message.upgradeTimeout = Timeout.fromAmino(object.upgrade_timeout); + } + return message; + }, + toAmino(message: Params): ParamsAmino { + const obj: any = {}; + obj.upgrade_timeout = message.upgradeTimeout ? Timeout.toAmino(message.upgradeTimeout) : undefined; + return obj; + }, + fromAminoMsg(object: ParamsAminoMsg): Params { + return Params.fromAmino(object.value); + }, + toAminoMsg(message: Params): ParamsAminoMsg { + return { + type: "cosmos-sdk/Params", + value: Params.toAmino(message) + }; + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.Params", + value: Params.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Params.typeUrl, Params); +GlobalDecoderRegistry.registerAminoProtoMapping(Params.aminoType, Params.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/ibc/core/channel/v1/tx.rpc.func.ts b/libs/interchain-query/src/ibc/core/channel/v1/tx.rpc.func.ts new file mode 100644 index 00000000..a7fc06c2 --- /dev/null +++ b/libs/interchain-query/src/ibc/core/channel/v1/tx.rpc.func.ts @@ -0,0 +1,175 @@ +import { buildTx, SigningClientResolver } from "../../../../helper-func-types"; +import { buildUseMutation } from "../../../../react-query"; +import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; +import { MsgChannelOpenInit, MsgChannelOpenTry, MsgChannelOpenAck, MsgChannelOpenConfirm, MsgChannelCloseInit, MsgChannelCloseConfirm, MsgRecvPacket, MsgTimeout, MsgTimeoutOnClose, MsgAcknowledgement, MsgChannelUpgradeInit, MsgChannelUpgradeTry, MsgChannelUpgradeAck, MsgChannelUpgradeConfirm, MsgChannelUpgradeOpen, MsgChannelUpgradeTimeout, MsgChannelUpgradeCancel, MsgUpdateParams, MsgPruneAcknowledgements } from "./tx"; +export const createChannelOpenInit = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgChannelOpenInit.typeUrl, + encoders: toEncoders(MsgChannelOpenInit), + converters: toConverters(MsgChannelOpenInit) +}); +export const useChannelOpenInit = buildUseMutation({ + builderMutationFn: createChannelOpenInit +}); +export const createChannelOpenTry = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgChannelOpenTry.typeUrl, + encoders: toEncoders(MsgChannelOpenTry), + converters: toConverters(MsgChannelOpenTry) +}); +export const useChannelOpenTry = buildUseMutation({ + builderMutationFn: createChannelOpenTry +}); +export const createChannelOpenAck = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgChannelOpenAck.typeUrl, + encoders: toEncoders(MsgChannelOpenAck), + converters: toConverters(MsgChannelOpenAck) +}); +export const useChannelOpenAck = buildUseMutation({ + builderMutationFn: createChannelOpenAck +}); +export const createChannelOpenConfirm = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgChannelOpenConfirm.typeUrl, + encoders: toEncoders(MsgChannelOpenConfirm), + converters: toConverters(MsgChannelOpenConfirm) +}); +export const useChannelOpenConfirm = buildUseMutation({ + builderMutationFn: createChannelOpenConfirm +}); +export const createChannelCloseInit = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgChannelCloseInit.typeUrl, + encoders: toEncoders(MsgChannelCloseInit), + converters: toConverters(MsgChannelCloseInit) +}); +export const useChannelCloseInit = buildUseMutation({ + builderMutationFn: createChannelCloseInit +}); +export const createChannelCloseConfirm = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgChannelCloseConfirm.typeUrl, + encoders: toEncoders(MsgChannelCloseConfirm), + converters: toConverters(MsgChannelCloseConfirm) +}); +export const useChannelCloseConfirm = buildUseMutation({ + builderMutationFn: createChannelCloseConfirm +}); +export const createRecvPacket = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgRecvPacket.typeUrl, + encoders: toEncoders(MsgRecvPacket), + converters: toConverters(MsgRecvPacket) +}); +export const useRecvPacket = buildUseMutation({ + builderMutationFn: createRecvPacket +}); +export const createTimeout = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgTimeout.typeUrl, + encoders: toEncoders(MsgTimeout), + converters: toConverters(MsgTimeout) +}); +export const useTimeout = buildUseMutation({ + builderMutationFn: createTimeout +}); +export const createTimeoutOnClose = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgTimeoutOnClose.typeUrl, + encoders: toEncoders(MsgTimeoutOnClose), + converters: toConverters(MsgTimeoutOnClose) +}); +export const useTimeoutOnClose = buildUseMutation({ + builderMutationFn: createTimeoutOnClose +}); +export const createAcknowledgement = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgAcknowledgement.typeUrl, + encoders: toEncoders(MsgAcknowledgement), + converters: toConverters(MsgAcknowledgement) +}); +export const useAcknowledgement = buildUseMutation({ + builderMutationFn: createAcknowledgement +}); +export const createChannelUpgradeInit = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgChannelUpgradeInit.typeUrl, + encoders: toEncoders(MsgChannelUpgradeInit), + converters: toConverters(MsgChannelUpgradeInit) +}); +export const useChannelUpgradeInit = buildUseMutation({ + builderMutationFn: createChannelUpgradeInit +}); +export const createChannelUpgradeTry = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgChannelUpgradeTry.typeUrl, + encoders: toEncoders(MsgChannelUpgradeTry), + converters: toConverters(MsgChannelUpgradeTry) +}); +export const useChannelUpgradeTry = buildUseMutation({ + builderMutationFn: createChannelUpgradeTry +}); +export const createChannelUpgradeAck = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgChannelUpgradeAck.typeUrl, + encoders: toEncoders(MsgChannelUpgradeAck), + converters: toConverters(MsgChannelUpgradeAck) +}); +export const useChannelUpgradeAck = buildUseMutation({ + builderMutationFn: createChannelUpgradeAck +}); +export const createChannelUpgradeConfirm = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgChannelUpgradeConfirm.typeUrl, + encoders: toEncoders(MsgChannelUpgradeConfirm), + converters: toConverters(MsgChannelUpgradeConfirm) +}); +export const useChannelUpgradeConfirm = buildUseMutation({ + builderMutationFn: createChannelUpgradeConfirm +}); +export const createChannelUpgradeOpen = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgChannelUpgradeOpen.typeUrl, + encoders: toEncoders(MsgChannelUpgradeOpen), + converters: toConverters(MsgChannelUpgradeOpen) +}); +export const useChannelUpgradeOpen = buildUseMutation({ + builderMutationFn: createChannelUpgradeOpen +}); +export const createChannelUpgradeTimeout = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgChannelUpgradeTimeout.typeUrl, + encoders: toEncoders(MsgChannelUpgradeTimeout), + converters: toConverters(MsgChannelUpgradeTimeout) +}); +export const useChannelUpgradeTimeout = buildUseMutation({ + builderMutationFn: createChannelUpgradeTimeout +}); +export const createChannelUpgradeCancel = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgChannelUpgradeCancel.typeUrl, + encoders: toEncoders(MsgChannelUpgradeCancel), + converters: toConverters(MsgChannelUpgradeCancel) +}); +export const useChannelUpgradeCancel = buildUseMutation({ + builderMutationFn: createChannelUpgradeCancel +}); +export const createUpdateChannelParams = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgUpdateParams.typeUrl, + encoders: toEncoders(MsgUpdateParams), + converters: toConverters(MsgUpdateParams) +}); +export const useUpdateChannelParams = buildUseMutation({ + builderMutationFn: createUpdateChannelParams +}); +export const createPruneAcknowledgements = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgPruneAcknowledgements.typeUrl, + encoders: toEncoders(MsgPruneAcknowledgements), + converters: toConverters(MsgPruneAcknowledgements) +}); +export const usePruneAcknowledgements = buildUseMutation({ + builderMutationFn: createPruneAcknowledgements +}); \ No newline at end of file diff --git a/libs/interchain-query/src/ibc/core/channel/v1/tx.ts b/libs/interchain-query/src/ibc/core/channel/v1/tx.ts new file mode 100644 index 00000000..2770cc5f --- /dev/null +++ b/libs/interchain-query/src/ibc/core/channel/v1/tx.ts @@ -0,0 +1,4866 @@ +import { Channel, ChannelAmino, Packet, PacketAmino, State } from "./channel"; +import { Height, HeightAmino, Params, ParamsAmino } from "../../client/v1/client"; +import { UpgradeFields, UpgradeFieldsAmino, Upgrade, UpgradeAmino, ErrorReceipt, ErrorReceiptAmino } from "./upgrade"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes, isSet } from "../../../../helpers"; +import { GlobalDecoderRegistry } from "../../../../registry"; +/** ResponseResultType defines the possible outcomes of the execution of a message */ +export enum ResponseResultType { + /** RESPONSE_RESULT_TYPE_UNSPECIFIED - Default zero value enumeration */ + RESPONSE_RESULT_TYPE_UNSPECIFIED = 0, + /** RESPONSE_RESULT_TYPE_NOOP - The message did not call the IBC application callbacks (because, for example, the packet had already been relayed) */ + RESPONSE_RESULT_TYPE_NOOP = 1, + /** RESPONSE_RESULT_TYPE_SUCCESS - The message was executed successfully */ + RESPONSE_RESULT_TYPE_SUCCESS = 2, + /** RESPONSE_RESULT_TYPE_FAILURE - The message was executed unsuccessfully */ + RESPONSE_RESULT_TYPE_FAILURE = 3, + UNRECOGNIZED = -1, +} +export const ResponseResultTypeAmino = ResponseResultType; +export function responseResultTypeFromJSON(object: any): ResponseResultType { + switch (object) { + case 0: + case "RESPONSE_RESULT_TYPE_UNSPECIFIED": + return ResponseResultType.RESPONSE_RESULT_TYPE_UNSPECIFIED; + case 1: + case "RESPONSE_RESULT_TYPE_NOOP": + return ResponseResultType.RESPONSE_RESULT_TYPE_NOOP; + case 2: + case "RESPONSE_RESULT_TYPE_SUCCESS": + return ResponseResultType.RESPONSE_RESULT_TYPE_SUCCESS; + case 3: + case "RESPONSE_RESULT_TYPE_FAILURE": + return ResponseResultType.RESPONSE_RESULT_TYPE_FAILURE; + case -1: + case "UNRECOGNIZED": + default: + return ResponseResultType.UNRECOGNIZED; + } +} +export function responseResultTypeToJSON(object: ResponseResultType): string { + switch (object) { + case ResponseResultType.RESPONSE_RESULT_TYPE_UNSPECIFIED: + return "RESPONSE_RESULT_TYPE_UNSPECIFIED"; + case ResponseResultType.RESPONSE_RESULT_TYPE_NOOP: + return "RESPONSE_RESULT_TYPE_NOOP"; + case ResponseResultType.RESPONSE_RESULT_TYPE_SUCCESS: + return "RESPONSE_RESULT_TYPE_SUCCESS"; + case ResponseResultType.RESPONSE_RESULT_TYPE_FAILURE: + return "RESPONSE_RESULT_TYPE_FAILURE"; + case ResponseResultType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** + * MsgChannelOpenInit defines an sdk.Msg to initialize a channel handshake. It + * is called by a relayer on Chain A. + */ +export interface MsgChannelOpenInit { + portId: string; + channel: Channel; + signer: string; +} +export interface MsgChannelOpenInitProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenInit"; + value: Uint8Array; +} +/** + * MsgChannelOpenInit defines an sdk.Msg to initialize a channel handshake. It + * is called by a relayer on Chain A. + */ +export interface MsgChannelOpenInitAmino { + port_id: string; + channel: ChannelAmino; + signer: string; +} +export interface MsgChannelOpenInitAminoMsg { + type: "cosmos-sdk/MsgChannelOpenInit"; + value: MsgChannelOpenInitAmino; +} +/** MsgChannelOpenInitResponse defines the Msg/ChannelOpenInit response type. */ +export interface MsgChannelOpenInitResponse { + channelId: string; + version: string; +} +export interface MsgChannelOpenInitResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenInitResponse"; + value: Uint8Array; +} +/** MsgChannelOpenInitResponse defines the Msg/ChannelOpenInit response type. */ +export interface MsgChannelOpenInitResponseAmino { + channel_id: string; + version: string; +} +export interface MsgChannelOpenInitResponseAminoMsg { + type: "cosmos-sdk/MsgChannelOpenInitResponse"; + value: MsgChannelOpenInitResponseAmino; +} +/** + * MsgChannelOpenInit defines a msg sent by a Relayer to try to open a channel + * on Chain B. The version field within the Channel field has been deprecated. Its + * value will be ignored by core IBC. + */ +export interface MsgChannelOpenTry { + portId: string; + /** Deprecated: this field is unused. Crossing hello's are no longer supported in core IBC. */ + /** @deprecated */ + previousChannelId: string; + /** NOTE: the version field within the channel has been deprecated. Its value will be ignored by core IBC. */ + channel: Channel; + counterpartyVersion: string; + proofInit: Uint8Array; + proofHeight: Height; + signer: string; +} +export interface MsgChannelOpenTryProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTry"; + value: Uint8Array; +} +/** + * MsgChannelOpenInit defines a msg sent by a Relayer to try to open a channel + * on Chain B. The version field within the Channel field has been deprecated. Its + * value will be ignored by core IBC. + */ +export interface MsgChannelOpenTryAmino { + port_id: string; + /** Deprecated: this field is unused. Crossing hello's are no longer supported in core IBC. */ + /** @deprecated */ + previous_channel_id: string; + /** NOTE: the version field within the channel has been deprecated. Its value will be ignored by core IBC. */ + channel: ChannelAmino; + counterparty_version: string; + proof_init: string; + proof_height: HeightAmino; + signer: string; +} +export interface MsgChannelOpenTryAminoMsg { + type: "cosmos-sdk/MsgChannelOpenTry"; + value: MsgChannelOpenTryAmino; +} +/** MsgChannelOpenTryResponse defines the Msg/ChannelOpenTry response type. */ +export interface MsgChannelOpenTryResponse { + version: string; + channelId: string; +} +export interface MsgChannelOpenTryResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTryResponse"; + value: Uint8Array; +} +/** MsgChannelOpenTryResponse defines the Msg/ChannelOpenTry response type. */ +export interface MsgChannelOpenTryResponseAmino { + version: string; + channel_id: string; +} +export interface MsgChannelOpenTryResponseAminoMsg { + type: "cosmos-sdk/MsgChannelOpenTryResponse"; + value: MsgChannelOpenTryResponseAmino; +} +/** + * MsgChannelOpenAck defines a msg sent by a Relayer to Chain A to acknowledge + * the change of channel state to TRYOPEN on Chain B. + * WARNING: a channel upgrade MUST NOT initialize an upgrade for this channel + * in the same block as executing this message otherwise the counterparty will + * be incapable of opening. + */ +export interface MsgChannelOpenAck { + portId: string; + channelId: string; + counterpartyChannelId: string; + counterpartyVersion: string; + proofTry: Uint8Array; + proofHeight: Height; + signer: string; +} +export interface MsgChannelOpenAckProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAck"; + value: Uint8Array; +} +/** + * MsgChannelOpenAck defines a msg sent by a Relayer to Chain A to acknowledge + * the change of channel state to TRYOPEN on Chain B. + * WARNING: a channel upgrade MUST NOT initialize an upgrade for this channel + * in the same block as executing this message otherwise the counterparty will + * be incapable of opening. + */ +export interface MsgChannelOpenAckAmino { + port_id: string; + channel_id: string; + counterparty_channel_id: string; + counterparty_version: string; + proof_try: string; + proof_height: HeightAmino; + signer: string; +} +export interface MsgChannelOpenAckAminoMsg { + type: "cosmos-sdk/MsgChannelOpenAck"; + value: MsgChannelOpenAckAmino; +} +/** MsgChannelOpenAckResponse defines the Msg/ChannelOpenAck response type. */ +export interface MsgChannelOpenAckResponse {} +export interface MsgChannelOpenAckResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAckResponse"; + value: Uint8Array; +} +/** MsgChannelOpenAckResponse defines the Msg/ChannelOpenAck response type. */ +export interface MsgChannelOpenAckResponseAmino {} +export interface MsgChannelOpenAckResponseAminoMsg { + type: "cosmos-sdk/MsgChannelOpenAckResponse"; + value: MsgChannelOpenAckResponseAmino; +} +/** + * MsgChannelOpenConfirm defines a msg sent by a Relayer to Chain B to + * acknowledge the change of channel state to OPEN on Chain A. + */ +export interface MsgChannelOpenConfirm { + portId: string; + channelId: string; + proofAck: Uint8Array; + proofHeight: Height; + signer: string; +} +export interface MsgChannelOpenConfirmProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenConfirm"; + value: Uint8Array; +} +/** + * MsgChannelOpenConfirm defines a msg sent by a Relayer to Chain B to + * acknowledge the change of channel state to OPEN on Chain A. + */ +export interface MsgChannelOpenConfirmAmino { + port_id: string; + channel_id: string; + proof_ack: string; + proof_height: HeightAmino; + signer: string; +} +export interface MsgChannelOpenConfirmAminoMsg { + type: "cosmos-sdk/MsgChannelOpenConfirm"; + value: MsgChannelOpenConfirmAmino; +} +/** + * MsgChannelOpenConfirmResponse defines the Msg/ChannelOpenConfirm response + * type. + */ +export interface MsgChannelOpenConfirmResponse {} +export interface MsgChannelOpenConfirmResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenConfirmResponse"; + value: Uint8Array; +} +/** + * MsgChannelOpenConfirmResponse defines the Msg/ChannelOpenConfirm response + * type. + */ +export interface MsgChannelOpenConfirmResponseAmino {} +export interface MsgChannelOpenConfirmResponseAminoMsg { + type: "cosmos-sdk/MsgChannelOpenConfirmResponse"; + value: MsgChannelOpenConfirmResponseAmino; +} +/** + * MsgChannelCloseInit defines a msg sent by a Relayer to Chain A + * to close a channel with Chain B. + */ +export interface MsgChannelCloseInit { + portId: string; + channelId: string; + signer: string; +} +export interface MsgChannelCloseInitProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInit"; + value: Uint8Array; +} +/** + * MsgChannelCloseInit defines a msg sent by a Relayer to Chain A + * to close a channel with Chain B. + */ +export interface MsgChannelCloseInitAmino { + port_id: string; + channel_id: string; + signer: string; +} +export interface MsgChannelCloseInitAminoMsg { + type: "cosmos-sdk/MsgChannelCloseInit"; + value: MsgChannelCloseInitAmino; +} +/** MsgChannelCloseInitResponse defines the Msg/ChannelCloseInit response type. */ +export interface MsgChannelCloseInitResponse {} +export interface MsgChannelCloseInitResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInitResponse"; + value: Uint8Array; +} +/** MsgChannelCloseInitResponse defines the Msg/ChannelCloseInit response type. */ +export interface MsgChannelCloseInitResponseAmino {} +export interface MsgChannelCloseInitResponseAminoMsg { + type: "cosmos-sdk/MsgChannelCloseInitResponse"; + value: MsgChannelCloseInitResponseAmino; +} +/** + * MsgChannelCloseConfirm defines a msg sent by a Relayer to Chain B + * to acknowledge the change of channel state to CLOSED on Chain A. + */ +export interface MsgChannelCloseConfirm { + portId: string; + channelId: string; + proofInit: Uint8Array; + proofHeight: Height; + signer: string; + counterpartyUpgradeSequence: bigint; +} +export interface MsgChannelCloseConfirmProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelCloseConfirm"; + value: Uint8Array; +} +/** + * MsgChannelCloseConfirm defines a msg sent by a Relayer to Chain B + * to acknowledge the change of channel state to CLOSED on Chain A. + */ +export interface MsgChannelCloseConfirmAmino { + port_id: string; + channel_id: string; + proof_init: string; + proof_height: HeightAmino; + signer: string; + counterparty_upgrade_sequence: string; +} +export interface MsgChannelCloseConfirmAminoMsg { + type: "cosmos-sdk/MsgChannelCloseConfirm"; + value: MsgChannelCloseConfirmAmino; +} +/** + * MsgChannelCloseConfirmResponse defines the Msg/ChannelCloseConfirm response + * type. + */ +export interface MsgChannelCloseConfirmResponse {} +export interface MsgChannelCloseConfirmResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelCloseConfirmResponse"; + value: Uint8Array; +} +/** + * MsgChannelCloseConfirmResponse defines the Msg/ChannelCloseConfirm response + * type. + */ +export interface MsgChannelCloseConfirmResponseAmino {} +export interface MsgChannelCloseConfirmResponseAminoMsg { + type: "cosmos-sdk/MsgChannelCloseConfirmResponse"; + value: MsgChannelCloseConfirmResponseAmino; +} +/** MsgRecvPacket receives incoming IBC packet */ +export interface MsgRecvPacket { + packet: Packet; + proofCommitment: Uint8Array; + proofHeight: Height; + signer: string; +} +export interface MsgRecvPacketProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgRecvPacket"; + value: Uint8Array; +} +/** MsgRecvPacket receives incoming IBC packet */ +export interface MsgRecvPacketAmino { + packet: PacketAmino; + proof_commitment: string; + proof_height: HeightAmino; + signer: string; +} +export interface MsgRecvPacketAminoMsg { + type: "cosmos-sdk/MsgRecvPacket"; + value: MsgRecvPacketAmino; +} +/** MsgRecvPacketResponse defines the Msg/RecvPacket response type. */ +export interface MsgRecvPacketResponse { + result: ResponseResultType; +} +export interface MsgRecvPacketResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgRecvPacketResponse"; + value: Uint8Array; +} +/** MsgRecvPacketResponse defines the Msg/RecvPacket response type. */ +export interface MsgRecvPacketResponseAmino { + result: ResponseResultType; +} +export interface MsgRecvPacketResponseAminoMsg { + type: "cosmos-sdk/MsgRecvPacketResponse"; + value: MsgRecvPacketResponseAmino; +} +/** MsgTimeout receives timed-out packet */ +export interface MsgTimeout { + packet: Packet; + proofUnreceived: Uint8Array; + proofHeight: Height; + nextSequenceRecv: bigint; + signer: string; +} +export interface MsgTimeoutProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgTimeout"; + value: Uint8Array; +} +/** MsgTimeout receives timed-out packet */ +export interface MsgTimeoutAmino { + packet: PacketAmino; + proof_unreceived: string; + proof_height: HeightAmino; + next_sequence_recv: string; + signer: string; +} +export interface MsgTimeoutAminoMsg { + type: "cosmos-sdk/MsgTimeout"; + value: MsgTimeoutAmino; +} +/** MsgTimeoutResponse defines the Msg/Timeout response type. */ +export interface MsgTimeoutResponse { + result: ResponseResultType; +} +export interface MsgTimeoutResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgTimeoutResponse"; + value: Uint8Array; +} +/** MsgTimeoutResponse defines the Msg/Timeout response type. */ +export interface MsgTimeoutResponseAmino { + result: ResponseResultType; +} +export interface MsgTimeoutResponseAminoMsg { + type: "cosmos-sdk/MsgTimeoutResponse"; + value: MsgTimeoutResponseAmino; +} +/** MsgTimeoutOnClose timed-out packet upon counterparty channel closure. */ +export interface MsgTimeoutOnClose { + packet: Packet; + proofUnreceived: Uint8Array; + proofClose: Uint8Array; + proofHeight: Height; + nextSequenceRecv: bigint; + signer: string; + counterpartyUpgradeSequence: bigint; +} +export interface MsgTimeoutOnCloseProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgTimeoutOnClose"; + value: Uint8Array; +} +/** MsgTimeoutOnClose timed-out packet upon counterparty channel closure. */ +export interface MsgTimeoutOnCloseAmino { + packet: PacketAmino; + proof_unreceived: string; + proof_close: string; + proof_height: HeightAmino; + next_sequence_recv: string; + signer: string; + counterparty_upgrade_sequence: string; +} +export interface MsgTimeoutOnCloseAminoMsg { + type: "cosmos-sdk/MsgTimeoutOnClose"; + value: MsgTimeoutOnCloseAmino; +} +/** MsgTimeoutOnCloseResponse defines the Msg/TimeoutOnClose response type. */ +export interface MsgTimeoutOnCloseResponse { + result: ResponseResultType; +} +export interface MsgTimeoutOnCloseResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgTimeoutOnCloseResponse"; + value: Uint8Array; +} +/** MsgTimeoutOnCloseResponse defines the Msg/TimeoutOnClose response type. */ +export interface MsgTimeoutOnCloseResponseAmino { + result: ResponseResultType; +} +export interface MsgTimeoutOnCloseResponseAminoMsg { + type: "cosmos-sdk/MsgTimeoutOnCloseResponse"; + value: MsgTimeoutOnCloseResponseAmino; +} +/** MsgAcknowledgement receives incoming IBC acknowledgement */ +export interface MsgAcknowledgement { + packet: Packet; + acknowledgement: Uint8Array; + proofAcked: Uint8Array; + proofHeight: Height; + signer: string; +} +export interface MsgAcknowledgementProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgAcknowledgement"; + value: Uint8Array; +} +/** MsgAcknowledgement receives incoming IBC acknowledgement */ +export interface MsgAcknowledgementAmino { + packet: PacketAmino; + acknowledgement: string; + proof_acked: string; + proof_height: HeightAmino; + signer: string; +} +export interface MsgAcknowledgementAminoMsg { + type: "cosmos-sdk/MsgAcknowledgement"; + value: MsgAcknowledgementAmino; +} +/** MsgAcknowledgementResponse defines the Msg/Acknowledgement response type. */ +export interface MsgAcknowledgementResponse { + result: ResponseResultType; +} +export interface MsgAcknowledgementResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgAcknowledgementResponse"; + value: Uint8Array; +} +/** MsgAcknowledgementResponse defines the Msg/Acknowledgement response type. */ +export interface MsgAcknowledgementResponseAmino { + result: ResponseResultType; +} +export interface MsgAcknowledgementResponseAminoMsg { + type: "cosmos-sdk/MsgAcknowledgementResponse"; + value: MsgAcknowledgementResponseAmino; +} +/** + * MsgChannelUpgradeInit defines the request type for the ChannelUpgradeInit rpc + * WARNING: Initializing a channel upgrade in the same block as opening the channel + * may result in the counterparty being incapable of opening. + */ +export interface MsgChannelUpgradeInit { + portId: string; + channelId: string; + fields: UpgradeFields; + signer: string; +} +export interface MsgChannelUpgradeInitProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeInit"; + value: Uint8Array; +} +/** + * MsgChannelUpgradeInit defines the request type for the ChannelUpgradeInit rpc + * WARNING: Initializing a channel upgrade in the same block as opening the channel + * may result in the counterparty being incapable of opening. + */ +export interface MsgChannelUpgradeInitAmino { + port_id: string; + channel_id: string; + fields: UpgradeFieldsAmino; + signer: string; +} +export interface MsgChannelUpgradeInitAminoMsg { + type: "cosmos-sdk/MsgChannelUpgradeInit"; + value: MsgChannelUpgradeInitAmino; +} +/** MsgChannelUpgradeInitResponse defines the MsgChannelUpgradeInit response type */ +export interface MsgChannelUpgradeInitResponse { + upgrade: Upgrade; + upgradeSequence: bigint; +} +export interface MsgChannelUpgradeInitResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeInitResponse"; + value: Uint8Array; +} +/** MsgChannelUpgradeInitResponse defines the MsgChannelUpgradeInit response type */ +export interface MsgChannelUpgradeInitResponseAmino { + upgrade: UpgradeAmino; + upgrade_sequence: string; +} +export interface MsgChannelUpgradeInitResponseAminoMsg { + type: "cosmos-sdk/MsgChannelUpgradeInitResponse"; + value: MsgChannelUpgradeInitResponseAmino; +} +/** MsgChannelUpgradeTry defines the request type for the ChannelUpgradeTry rpc */ +export interface MsgChannelUpgradeTry { + portId: string; + channelId: string; + proposedUpgradeConnectionHops: string[]; + counterpartyUpgradeFields: UpgradeFields; + counterpartyUpgradeSequence: bigint; + proofChannel: Uint8Array; + proofUpgrade: Uint8Array; + proofHeight: Height; + signer: string; +} +export interface MsgChannelUpgradeTryProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeTry"; + value: Uint8Array; +} +/** MsgChannelUpgradeTry defines the request type for the ChannelUpgradeTry rpc */ +export interface MsgChannelUpgradeTryAmino { + port_id: string; + channel_id: string; + proposed_upgrade_connection_hops: string[]; + counterparty_upgrade_fields: UpgradeFieldsAmino; + counterparty_upgrade_sequence: string; + proof_channel: string; + proof_upgrade: string; + proof_height: HeightAmino; + signer: string; +} +export interface MsgChannelUpgradeTryAminoMsg { + type: "cosmos-sdk/MsgChannelUpgradeTry"; + value: MsgChannelUpgradeTryAmino; +} +/** MsgChannelUpgradeTryResponse defines the MsgChannelUpgradeTry response type */ +export interface MsgChannelUpgradeTryResponse { + upgrade: Upgrade; + upgradeSequence: bigint; + result: ResponseResultType; +} +export interface MsgChannelUpgradeTryResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeTryResponse"; + value: Uint8Array; +} +/** MsgChannelUpgradeTryResponse defines the MsgChannelUpgradeTry response type */ +export interface MsgChannelUpgradeTryResponseAmino { + upgrade: UpgradeAmino; + upgrade_sequence: string; + result: ResponseResultType; +} +export interface MsgChannelUpgradeTryResponseAminoMsg { + type: "cosmos-sdk/MsgChannelUpgradeTryResponse"; + value: MsgChannelUpgradeTryResponseAmino; +} +/** MsgChannelUpgradeAck defines the request type for the ChannelUpgradeAck rpc */ +export interface MsgChannelUpgradeAck { + portId: string; + channelId: string; + counterpartyUpgrade: Upgrade; + proofChannel: Uint8Array; + proofUpgrade: Uint8Array; + proofHeight: Height; + signer: string; +} +export interface MsgChannelUpgradeAckProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeAck"; + value: Uint8Array; +} +/** MsgChannelUpgradeAck defines the request type for the ChannelUpgradeAck rpc */ +export interface MsgChannelUpgradeAckAmino { + port_id: string; + channel_id: string; + counterparty_upgrade: UpgradeAmino; + proof_channel: string; + proof_upgrade: string; + proof_height: HeightAmino; + signer: string; +} +export interface MsgChannelUpgradeAckAminoMsg { + type: "cosmos-sdk/MsgChannelUpgradeAck"; + value: MsgChannelUpgradeAckAmino; +} +/** MsgChannelUpgradeAckResponse defines MsgChannelUpgradeAck response type */ +export interface MsgChannelUpgradeAckResponse { + result: ResponseResultType; +} +export interface MsgChannelUpgradeAckResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeAckResponse"; + value: Uint8Array; +} +/** MsgChannelUpgradeAckResponse defines MsgChannelUpgradeAck response type */ +export interface MsgChannelUpgradeAckResponseAmino { + result: ResponseResultType; +} +export interface MsgChannelUpgradeAckResponseAminoMsg { + type: "cosmos-sdk/MsgChannelUpgradeAckResponse"; + value: MsgChannelUpgradeAckResponseAmino; +} +/** MsgChannelUpgradeConfirm defines the request type for the ChannelUpgradeConfirm rpc */ +export interface MsgChannelUpgradeConfirm { + portId: string; + channelId: string; + counterpartyChannelState: State; + counterpartyUpgrade: Upgrade; + proofChannel: Uint8Array; + proofUpgrade: Uint8Array; + proofHeight: Height; + signer: string; +} +export interface MsgChannelUpgradeConfirmProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeConfirm"; + value: Uint8Array; +} +/** MsgChannelUpgradeConfirm defines the request type for the ChannelUpgradeConfirm rpc */ +export interface MsgChannelUpgradeConfirmAmino { + port_id: string; + channel_id: string; + counterparty_channel_state: State; + counterparty_upgrade: UpgradeAmino; + proof_channel: string; + proof_upgrade: string; + proof_height: HeightAmino; + signer: string; +} +export interface MsgChannelUpgradeConfirmAminoMsg { + type: "cosmos-sdk/MsgChannelUpgradeConfirm"; + value: MsgChannelUpgradeConfirmAmino; +} +/** MsgChannelUpgradeConfirmResponse defines MsgChannelUpgradeConfirm response type */ +export interface MsgChannelUpgradeConfirmResponse { + result: ResponseResultType; +} +export interface MsgChannelUpgradeConfirmResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeConfirmResponse"; + value: Uint8Array; +} +/** MsgChannelUpgradeConfirmResponse defines MsgChannelUpgradeConfirm response type */ +export interface MsgChannelUpgradeConfirmResponseAmino { + result: ResponseResultType; +} +export interface MsgChannelUpgradeConfirmResponseAminoMsg { + type: "cosmos-sdk/MsgChannelUpgradeConfirmResponse"; + value: MsgChannelUpgradeConfirmResponseAmino; +} +/** MsgChannelUpgradeOpen defines the request type for the ChannelUpgradeOpen rpc */ +export interface MsgChannelUpgradeOpen { + portId: string; + channelId: string; + counterpartyChannelState: State; + counterpartyUpgradeSequence: bigint; + proofChannel: Uint8Array; + proofHeight: Height; + signer: string; +} +export interface MsgChannelUpgradeOpenProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeOpen"; + value: Uint8Array; +} +/** MsgChannelUpgradeOpen defines the request type for the ChannelUpgradeOpen rpc */ +export interface MsgChannelUpgradeOpenAmino { + port_id: string; + channel_id: string; + counterparty_channel_state: State; + counterparty_upgrade_sequence: string; + proof_channel: string; + proof_height: HeightAmino; + signer: string; +} +export interface MsgChannelUpgradeOpenAminoMsg { + type: "cosmos-sdk/MsgChannelUpgradeOpen"; + value: MsgChannelUpgradeOpenAmino; +} +/** MsgChannelUpgradeOpenResponse defines the MsgChannelUpgradeOpen response type */ +export interface MsgChannelUpgradeOpenResponse {} +export interface MsgChannelUpgradeOpenResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeOpenResponse"; + value: Uint8Array; +} +/** MsgChannelUpgradeOpenResponse defines the MsgChannelUpgradeOpen response type */ +export interface MsgChannelUpgradeOpenResponseAmino {} +export interface MsgChannelUpgradeOpenResponseAminoMsg { + type: "cosmos-sdk/MsgChannelUpgradeOpenResponse"; + value: MsgChannelUpgradeOpenResponseAmino; +} +/** MsgChannelUpgradeTimeout defines the request type for the ChannelUpgradeTimeout rpc */ +export interface MsgChannelUpgradeTimeout { + portId: string; + channelId: string; + counterpartyChannel: Channel; + proofChannel: Uint8Array; + proofHeight: Height; + signer: string; +} +export interface MsgChannelUpgradeTimeoutProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeTimeout"; + value: Uint8Array; +} +/** MsgChannelUpgradeTimeout defines the request type for the ChannelUpgradeTimeout rpc */ +export interface MsgChannelUpgradeTimeoutAmino { + port_id: string; + channel_id: string; + counterparty_channel: ChannelAmino; + proof_channel: string; + proof_height: HeightAmino; + signer: string; +} +export interface MsgChannelUpgradeTimeoutAminoMsg { + type: "cosmos-sdk/MsgChannelUpgradeTimeout"; + value: MsgChannelUpgradeTimeoutAmino; +} +/** MsgChannelUpgradeTimeoutRepsonse defines the MsgChannelUpgradeTimeout response type */ +export interface MsgChannelUpgradeTimeoutResponse {} +export interface MsgChannelUpgradeTimeoutResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeTimeoutResponse"; + value: Uint8Array; +} +/** MsgChannelUpgradeTimeoutRepsonse defines the MsgChannelUpgradeTimeout response type */ +export interface MsgChannelUpgradeTimeoutResponseAmino {} +export interface MsgChannelUpgradeTimeoutResponseAminoMsg { + type: "cosmos-sdk/MsgChannelUpgradeTimeoutResponse"; + value: MsgChannelUpgradeTimeoutResponseAmino; +} +/** MsgChannelUpgradeCancel defines the request type for the ChannelUpgradeCancel rpc */ +export interface MsgChannelUpgradeCancel { + portId: string; + channelId: string; + errorReceipt: ErrorReceipt; + proofErrorReceipt: Uint8Array; + proofHeight: Height; + signer: string; +} +export interface MsgChannelUpgradeCancelProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeCancel"; + value: Uint8Array; +} +/** MsgChannelUpgradeCancel defines the request type for the ChannelUpgradeCancel rpc */ +export interface MsgChannelUpgradeCancelAmino { + port_id: string; + channel_id: string; + error_receipt: ErrorReceiptAmino; + proof_error_receipt: string; + proof_height: HeightAmino; + signer: string; +} +export interface MsgChannelUpgradeCancelAminoMsg { + type: "cosmos-sdk/MsgChannelUpgradeCancel"; + value: MsgChannelUpgradeCancelAmino; +} +/** MsgChannelUpgradeCancelResponse defines the MsgChannelUpgradeCancel response type */ +export interface MsgChannelUpgradeCancelResponse {} +export interface MsgChannelUpgradeCancelResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeCancelResponse"; + value: Uint8Array; +} +/** MsgChannelUpgradeCancelResponse defines the MsgChannelUpgradeCancel response type */ +export interface MsgChannelUpgradeCancelResponseAmino {} +export interface MsgChannelUpgradeCancelResponseAminoMsg { + type: "cosmos-sdk/MsgChannelUpgradeCancelResponse"; + value: MsgChannelUpgradeCancelResponseAmino; +} +/** MsgUpdateParams is the MsgUpdateParams request type. */ +export interface MsgUpdateParams { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the channel parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params; +} +export interface MsgUpdateParamsProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgUpdateParams"; + value: Uint8Array; +} +/** MsgUpdateParams is the MsgUpdateParams request type. */ +export interface MsgUpdateParamsAmino { + /** authority is the address that controls the module (defaults to x/gov unless overwritten). */ + authority: string; + /** + * params defines the channel parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: ParamsAmino; +} +export interface MsgUpdateParamsAminoMsg { + type: "cosmos-sdk/MsgUpdateParams"; + value: MsgUpdateParamsAmino; +} +/** MsgUpdateParamsResponse defines the MsgUpdateParams response type. */ +export interface MsgUpdateParamsResponse {} +export interface MsgUpdateParamsResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgUpdateParamsResponse"; + value: Uint8Array; +} +/** MsgUpdateParamsResponse defines the MsgUpdateParams response type. */ +export interface MsgUpdateParamsResponseAmino {} +export interface MsgUpdateParamsResponseAminoMsg { + type: "cosmos-sdk/MsgUpdateParamsResponse"; + value: MsgUpdateParamsResponseAmino; +} +/** MsgPruneAcknowledgements defines the request type for the PruneAcknowledgements rpc. */ +export interface MsgPruneAcknowledgements { + portId: string; + channelId: string; + limit: bigint; + signer: string; +} +export interface MsgPruneAcknowledgementsProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgPruneAcknowledgements"; + value: Uint8Array; +} +/** MsgPruneAcknowledgements defines the request type for the PruneAcknowledgements rpc. */ +export interface MsgPruneAcknowledgementsAmino { + port_id: string; + channel_id: string; + limit: string; + signer: string; +} +export interface MsgPruneAcknowledgementsAminoMsg { + type: "cosmos-sdk/MsgPruneAcknowledgements"; + value: MsgPruneAcknowledgementsAmino; +} +/** MsgPruneAcknowledgementsResponse defines the response type for the PruneAcknowledgements rpc. */ +export interface MsgPruneAcknowledgementsResponse { + /** Number of sequences pruned (includes both packet acknowledgements and packet receipts where appropriate). */ + totalPrunedSequences: bigint; + /** Number of sequences left after pruning. */ + totalRemainingSequences: bigint; +} +export interface MsgPruneAcknowledgementsResponseProtoMsg { + typeUrl: "/ibc.core.channel.v1.MsgPruneAcknowledgementsResponse"; + value: Uint8Array; +} +/** MsgPruneAcknowledgementsResponse defines the response type for the PruneAcknowledgements rpc. */ +export interface MsgPruneAcknowledgementsResponseAmino { + /** Number of sequences pruned (includes both packet acknowledgements and packet receipts where appropriate). */ + total_pruned_sequences: string; + /** Number of sequences left after pruning. */ + total_remaining_sequences: string; +} +export interface MsgPruneAcknowledgementsResponseAminoMsg { + type: "cosmos-sdk/MsgPruneAcknowledgementsResponse"; + value: MsgPruneAcknowledgementsResponseAmino; +} +function createBaseMsgChannelOpenInit(): MsgChannelOpenInit { + return { + portId: "", + channel: Channel.fromPartial({}), + signer: "" + }; +} +export const MsgChannelOpenInit = { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenInit", + aminoType: "cosmos-sdk/MsgChannelOpenInit", + is(o: any): o is MsgChannelOpenInit { + return o && (o.$typeUrl === MsgChannelOpenInit.typeUrl || typeof o.portId === "string" && Channel.is(o.channel) && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgChannelOpenInitAmino { + return o && (o.$typeUrl === MsgChannelOpenInit.typeUrl || typeof o.port_id === "string" && Channel.isAmino(o.channel) && typeof o.signer === "string"); + }, + encode(message: MsgChannelOpenInit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channel !== undefined) { + Channel.encode(message.channel, writer.uint32(18).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(26).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelOpenInit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelOpenInit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channel = Channel.decode(reader, reader.uint32()); + break; + case 3: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgChannelOpenInit { + const message = createBaseMsgChannelOpenInit(); + message.portId = object.portId ?? ""; + message.channel = object.channel !== undefined && object.channel !== null ? Channel.fromPartial(object.channel) : undefined; + message.signer = object.signer ?? ""; + return message; + }, + fromAmino(object: MsgChannelOpenInitAmino): MsgChannelOpenInit { + const message = createBaseMsgChannelOpenInit(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel !== undefined && object.channel !== null) { + message.channel = Channel.fromAmino(object.channel); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgChannelOpenInit): MsgChannelOpenInitAmino { + const obj: any = {}; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel = message.channel ? Channel.toAmino(message.channel) : undefined; + obj.signer = message.signer === "" ? undefined : message.signer; + return obj; + }, + fromAminoMsg(object: MsgChannelOpenInitAminoMsg): MsgChannelOpenInit { + return MsgChannelOpenInit.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelOpenInit): MsgChannelOpenInitAminoMsg { + return { + type: "cosmos-sdk/MsgChannelOpenInit", + value: MsgChannelOpenInit.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelOpenInitProtoMsg): MsgChannelOpenInit { + return MsgChannelOpenInit.decode(message.value); + }, + toProto(message: MsgChannelOpenInit): Uint8Array { + return MsgChannelOpenInit.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelOpenInit): MsgChannelOpenInitProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenInit", + value: MsgChannelOpenInit.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgChannelOpenInit.typeUrl, MsgChannelOpenInit); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgChannelOpenInit.aminoType, MsgChannelOpenInit.typeUrl); +function createBaseMsgChannelOpenInitResponse(): MsgChannelOpenInitResponse { + return { + channelId: "", + version: "" + }; +} +export const MsgChannelOpenInitResponse = { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenInitResponse", + aminoType: "cosmos-sdk/MsgChannelOpenInitResponse", + is(o: any): o is MsgChannelOpenInitResponse { + return o && (o.$typeUrl === MsgChannelOpenInitResponse.typeUrl || typeof o.channelId === "string" && typeof o.version === "string"); + }, + isAmino(o: any): o is MsgChannelOpenInitResponseAmino { + return o && (o.$typeUrl === MsgChannelOpenInitResponse.typeUrl || typeof o.channel_id === "string" && typeof o.version === "string"); + }, + encode(message: MsgChannelOpenInitResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.channelId !== "") { + writer.uint32(10).string(message.channelId); + } + if (message.version !== "") { + writer.uint32(18).string(message.version); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelOpenInitResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelOpenInitResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.channelId = reader.string(); + break; + case 2: + message.version = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgChannelOpenInitResponse { + const message = createBaseMsgChannelOpenInitResponse(); + message.channelId = object.channelId ?? ""; + message.version = object.version ?? ""; + return message; + }, + fromAmino(object: MsgChannelOpenInitResponseAmino): MsgChannelOpenInitResponse { + const message = createBaseMsgChannelOpenInitResponse(); + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + if (object.version !== undefined && object.version !== null) { + message.version = object.version; + } + return message; + }, + toAmino(message: MsgChannelOpenInitResponse): MsgChannelOpenInitResponseAmino { + const obj: any = {}; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.version = message.version === "" ? undefined : message.version; + return obj; + }, + fromAminoMsg(object: MsgChannelOpenInitResponseAminoMsg): MsgChannelOpenInitResponse { + return MsgChannelOpenInitResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelOpenInitResponse): MsgChannelOpenInitResponseAminoMsg { + return { + type: "cosmos-sdk/MsgChannelOpenInitResponse", + value: MsgChannelOpenInitResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelOpenInitResponseProtoMsg): MsgChannelOpenInitResponse { + return MsgChannelOpenInitResponse.decode(message.value); + }, + toProto(message: MsgChannelOpenInitResponse): Uint8Array { + return MsgChannelOpenInitResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelOpenInitResponse): MsgChannelOpenInitResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenInitResponse", + value: MsgChannelOpenInitResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgChannelOpenInitResponse.typeUrl, MsgChannelOpenInitResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgChannelOpenInitResponse.aminoType, MsgChannelOpenInitResponse.typeUrl); +function createBaseMsgChannelOpenTry(): MsgChannelOpenTry { + return { + portId: "", + previousChannelId: "", + channel: Channel.fromPartial({}), + counterpartyVersion: "", + proofInit: new Uint8Array(), + proofHeight: Height.fromPartial({}), + signer: "" + }; +} +export const MsgChannelOpenTry = { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTry", + aminoType: "cosmos-sdk/MsgChannelOpenTry", + is(o: any): o is MsgChannelOpenTry { + return o && (o.$typeUrl === MsgChannelOpenTry.typeUrl || typeof o.portId === "string" && typeof o.previousChannelId === "string" && Channel.is(o.channel) && typeof o.counterpartyVersion === "string" && (o.proofInit instanceof Uint8Array || typeof o.proofInit === "string") && Height.is(o.proofHeight) && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgChannelOpenTryAmino { + return o && (o.$typeUrl === MsgChannelOpenTry.typeUrl || typeof o.port_id === "string" && typeof o.previous_channel_id === "string" && Channel.isAmino(o.channel) && typeof o.counterparty_version === "string" && (o.proof_init instanceof Uint8Array || typeof o.proof_init === "string") && Height.isAmino(o.proof_height) && typeof o.signer === "string"); + }, + encode(message: MsgChannelOpenTry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.previousChannelId !== "") { + writer.uint32(18).string(message.previousChannelId); + } + if (message.channel !== undefined) { + Channel.encode(message.channel, writer.uint32(26).fork()).ldelim(); + } + if (message.counterpartyVersion !== "") { + writer.uint32(34).string(message.counterpartyVersion); + } + if (message.proofInit.length !== 0) { + writer.uint32(42).bytes(message.proofInit); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(50).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(58).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelOpenTry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelOpenTry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.previousChannelId = reader.string(); + break; + case 3: + message.channel = Channel.decode(reader, reader.uint32()); + break; + case 4: + message.counterpartyVersion = reader.string(); + break; + case 5: + message.proofInit = reader.bytes(); + break; + case 6: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + case 7: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgChannelOpenTry { + const message = createBaseMsgChannelOpenTry(); + message.portId = object.portId ?? ""; + message.previousChannelId = object.previousChannelId ?? ""; + message.channel = object.channel !== undefined && object.channel !== null ? Channel.fromPartial(object.channel) : undefined; + message.counterpartyVersion = object.counterpartyVersion ?? ""; + message.proofInit = object.proofInit ?? new Uint8Array(); + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; + message.signer = object.signer ?? ""; + return message; + }, + fromAmino(object: MsgChannelOpenTryAmino): MsgChannelOpenTry { + const message = createBaseMsgChannelOpenTry(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.previous_channel_id !== undefined && object.previous_channel_id !== null) { + message.previousChannelId = object.previous_channel_id; + } + if (object.channel !== undefined && object.channel !== null) { + message.channel = Channel.fromAmino(object.channel); + } + if (object.counterparty_version !== undefined && object.counterparty_version !== null) { + message.counterpartyVersion = object.counterparty_version; + } + if (object.proof_init !== undefined && object.proof_init !== null) { + message.proofInit = bytesFromBase64(object.proof_init); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgChannelOpenTry): MsgChannelOpenTryAmino { + const obj: any = {}; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.previous_channel_id = message.previousChannelId === "" ? undefined : message.previousChannelId; + obj.channel = message.channel ? Channel.toAmino(message.channel) : undefined; + obj.counterparty_version = message.counterpartyVersion === "" ? undefined : message.counterpartyVersion; + obj.proof_init = message.proofInit ? base64FromBytes(message.proofInit) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + obj.signer = message.signer === "" ? undefined : message.signer; + return obj; + }, + fromAminoMsg(object: MsgChannelOpenTryAminoMsg): MsgChannelOpenTry { + return MsgChannelOpenTry.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelOpenTry): MsgChannelOpenTryAminoMsg { + return { + type: "cosmos-sdk/MsgChannelOpenTry", + value: MsgChannelOpenTry.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelOpenTryProtoMsg): MsgChannelOpenTry { + return MsgChannelOpenTry.decode(message.value); + }, + toProto(message: MsgChannelOpenTry): Uint8Array { + return MsgChannelOpenTry.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelOpenTry): MsgChannelOpenTryProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTry", + value: MsgChannelOpenTry.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgChannelOpenTry.typeUrl, MsgChannelOpenTry); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgChannelOpenTry.aminoType, MsgChannelOpenTry.typeUrl); +function createBaseMsgChannelOpenTryResponse(): MsgChannelOpenTryResponse { + return { + version: "", + channelId: "" + }; +} +export const MsgChannelOpenTryResponse = { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTryResponse", + aminoType: "cosmos-sdk/MsgChannelOpenTryResponse", + is(o: any): o is MsgChannelOpenTryResponse { + return o && (o.$typeUrl === MsgChannelOpenTryResponse.typeUrl || typeof o.version === "string" && typeof o.channelId === "string"); + }, + isAmino(o: any): o is MsgChannelOpenTryResponseAmino { + return o && (o.$typeUrl === MsgChannelOpenTryResponse.typeUrl || typeof o.version === "string" && typeof o.channel_id === "string"); + }, + encode(message: MsgChannelOpenTryResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.version !== "") { + writer.uint32(10).string(message.version); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelOpenTryResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelOpenTryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.version = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgChannelOpenTryResponse { + const message = createBaseMsgChannelOpenTryResponse(); + message.version = object.version ?? ""; + message.channelId = object.channelId ?? ""; + return message; + }, + fromAmino(object: MsgChannelOpenTryResponseAmino): MsgChannelOpenTryResponse { + const message = createBaseMsgChannelOpenTryResponse(); + if (object.version !== undefined && object.version !== null) { + message.version = object.version; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + return message; + }, + toAmino(message: MsgChannelOpenTryResponse): MsgChannelOpenTryResponseAmino { + const obj: any = {}; + obj.version = message.version === "" ? undefined : message.version; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + return obj; + }, + fromAminoMsg(object: MsgChannelOpenTryResponseAminoMsg): MsgChannelOpenTryResponse { + return MsgChannelOpenTryResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelOpenTryResponse): MsgChannelOpenTryResponseAminoMsg { + return { + type: "cosmos-sdk/MsgChannelOpenTryResponse", + value: MsgChannelOpenTryResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelOpenTryResponseProtoMsg): MsgChannelOpenTryResponse { + return MsgChannelOpenTryResponse.decode(message.value); + }, + toProto(message: MsgChannelOpenTryResponse): Uint8Array { + return MsgChannelOpenTryResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelOpenTryResponse): MsgChannelOpenTryResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenTryResponse", + value: MsgChannelOpenTryResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgChannelOpenTryResponse.typeUrl, MsgChannelOpenTryResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgChannelOpenTryResponse.aminoType, MsgChannelOpenTryResponse.typeUrl); +function createBaseMsgChannelOpenAck(): MsgChannelOpenAck { + return { + portId: "", + channelId: "", + counterpartyChannelId: "", + counterpartyVersion: "", + proofTry: new Uint8Array(), + proofHeight: Height.fromPartial({}), + signer: "" + }; +} +export const MsgChannelOpenAck = { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAck", + aminoType: "cosmos-sdk/MsgChannelOpenAck", + is(o: any): o is MsgChannelOpenAck { + return o && (o.$typeUrl === MsgChannelOpenAck.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string" && typeof o.counterpartyChannelId === "string" && typeof o.counterpartyVersion === "string" && (o.proofTry instanceof Uint8Array || typeof o.proofTry === "string") && Height.is(o.proofHeight) && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgChannelOpenAckAmino { + return o && (o.$typeUrl === MsgChannelOpenAck.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && typeof o.counterparty_channel_id === "string" && typeof o.counterparty_version === "string" && (o.proof_try instanceof Uint8Array || typeof o.proof_try === "string") && Height.isAmino(o.proof_height) && typeof o.signer === "string"); + }, + encode(message: MsgChannelOpenAck, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + if (message.counterpartyChannelId !== "") { + writer.uint32(26).string(message.counterpartyChannelId); + } + if (message.counterpartyVersion !== "") { + writer.uint32(34).string(message.counterpartyVersion); + } + if (message.proofTry.length !== 0) { + writer.uint32(42).bytes(message.proofTry); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(50).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(58).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelOpenAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelOpenAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.counterpartyChannelId = reader.string(); + break; + case 4: + message.counterpartyVersion = reader.string(); + break; + case 5: + message.proofTry = reader.bytes(); + break; + case 6: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + case 7: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgChannelOpenAck { + const message = createBaseMsgChannelOpenAck(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.counterpartyChannelId = object.counterpartyChannelId ?? ""; + message.counterpartyVersion = object.counterpartyVersion ?? ""; + message.proofTry = object.proofTry ?? new Uint8Array(); + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; + message.signer = object.signer ?? ""; + return message; + }, + fromAmino(object: MsgChannelOpenAckAmino): MsgChannelOpenAck { + const message = createBaseMsgChannelOpenAck(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + if (object.counterparty_channel_id !== undefined && object.counterparty_channel_id !== null) { + message.counterpartyChannelId = object.counterparty_channel_id; + } + if (object.counterparty_version !== undefined && object.counterparty_version !== null) { + message.counterpartyVersion = object.counterparty_version; + } + if (object.proof_try !== undefined && object.proof_try !== null) { + message.proofTry = bytesFromBase64(object.proof_try); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgChannelOpenAck): MsgChannelOpenAckAmino { + const obj: any = {}; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.counterparty_channel_id = message.counterpartyChannelId === "" ? undefined : message.counterpartyChannelId; + obj.counterparty_version = message.counterpartyVersion === "" ? undefined : message.counterpartyVersion; + obj.proof_try = message.proofTry ? base64FromBytes(message.proofTry) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + obj.signer = message.signer === "" ? undefined : message.signer; + return obj; + }, + fromAminoMsg(object: MsgChannelOpenAckAminoMsg): MsgChannelOpenAck { + return MsgChannelOpenAck.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelOpenAck): MsgChannelOpenAckAminoMsg { + return { + type: "cosmos-sdk/MsgChannelOpenAck", + value: MsgChannelOpenAck.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelOpenAckProtoMsg): MsgChannelOpenAck { + return MsgChannelOpenAck.decode(message.value); + }, + toProto(message: MsgChannelOpenAck): Uint8Array { + return MsgChannelOpenAck.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelOpenAck): MsgChannelOpenAckProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAck", + value: MsgChannelOpenAck.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgChannelOpenAck.typeUrl, MsgChannelOpenAck); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgChannelOpenAck.aminoType, MsgChannelOpenAck.typeUrl); +function createBaseMsgChannelOpenAckResponse(): MsgChannelOpenAckResponse { + return {}; +} +export const MsgChannelOpenAckResponse = { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAckResponse", + aminoType: "cosmos-sdk/MsgChannelOpenAckResponse", + is(o: any): o is MsgChannelOpenAckResponse { + return o && o.$typeUrl === MsgChannelOpenAckResponse.typeUrl; + }, + isAmino(o: any): o is MsgChannelOpenAckResponseAmino { + return o && o.$typeUrl === MsgChannelOpenAckResponse.typeUrl; + }, + encode(_: MsgChannelOpenAckResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelOpenAckResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelOpenAckResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgChannelOpenAckResponse { + const message = createBaseMsgChannelOpenAckResponse(); + return message; + }, + fromAmino(_: MsgChannelOpenAckResponseAmino): MsgChannelOpenAckResponse { + const message = createBaseMsgChannelOpenAckResponse(); + return message; + }, + toAmino(_: MsgChannelOpenAckResponse): MsgChannelOpenAckResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgChannelOpenAckResponseAminoMsg): MsgChannelOpenAckResponse { + return MsgChannelOpenAckResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelOpenAckResponse): MsgChannelOpenAckResponseAminoMsg { + return { + type: "cosmos-sdk/MsgChannelOpenAckResponse", + value: MsgChannelOpenAckResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelOpenAckResponseProtoMsg): MsgChannelOpenAckResponse { + return MsgChannelOpenAckResponse.decode(message.value); + }, + toProto(message: MsgChannelOpenAckResponse): Uint8Array { + return MsgChannelOpenAckResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelOpenAckResponse): MsgChannelOpenAckResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenAckResponse", + value: MsgChannelOpenAckResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgChannelOpenAckResponse.typeUrl, MsgChannelOpenAckResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgChannelOpenAckResponse.aminoType, MsgChannelOpenAckResponse.typeUrl); +function createBaseMsgChannelOpenConfirm(): MsgChannelOpenConfirm { + return { + portId: "", + channelId: "", + proofAck: new Uint8Array(), + proofHeight: Height.fromPartial({}), + signer: "" + }; +} +export const MsgChannelOpenConfirm = { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenConfirm", + aminoType: "cosmos-sdk/MsgChannelOpenConfirm", + is(o: any): o is MsgChannelOpenConfirm { + return o && (o.$typeUrl === MsgChannelOpenConfirm.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string" && (o.proofAck instanceof Uint8Array || typeof o.proofAck === "string") && Height.is(o.proofHeight) && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgChannelOpenConfirmAmino { + return o && (o.$typeUrl === MsgChannelOpenConfirm.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && (o.proof_ack instanceof Uint8Array || typeof o.proof_ack === "string") && Height.isAmino(o.proof_height) && typeof o.signer === "string"); + }, + encode(message: MsgChannelOpenConfirm, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + if (message.proofAck.length !== 0) { + writer.uint32(26).bytes(message.proofAck); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(34).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(42).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelOpenConfirm { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelOpenConfirm(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.proofAck = reader.bytes(); + break; + case 4: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + case 5: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgChannelOpenConfirm { + const message = createBaseMsgChannelOpenConfirm(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.proofAck = object.proofAck ?? new Uint8Array(); + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; + message.signer = object.signer ?? ""; + return message; + }, + fromAmino(object: MsgChannelOpenConfirmAmino): MsgChannelOpenConfirm { + const message = createBaseMsgChannelOpenConfirm(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + if (object.proof_ack !== undefined && object.proof_ack !== null) { + message.proofAck = bytesFromBase64(object.proof_ack); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgChannelOpenConfirm): MsgChannelOpenConfirmAmino { + const obj: any = {}; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.proof_ack = message.proofAck ? base64FromBytes(message.proofAck) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + obj.signer = message.signer === "" ? undefined : message.signer; + return obj; + }, + fromAminoMsg(object: MsgChannelOpenConfirmAminoMsg): MsgChannelOpenConfirm { + return MsgChannelOpenConfirm.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelOpenConfirm): MsgChannelOpenConfirmAminoMsg { + return { + type: "cosmos-sdk/MsgChannelOpenConfirm", + value: MsgChannelOpenConfirm.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelOpenConfirmProtoMsg): MsgChannelOpenConfirm { + return MsgChannelOpenConfirm.decode(message.value); + }, + toProto(message: MsgChannelOpenConfirm): Uint8Array { + return MsgChannelOpenConfirm.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelOpenConfirm): MsgChannelOpenConfirmProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenConfirm", + value: MsgChannelOpenConfirm.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgChannelOpenConfirm.typeUrl, MsgChannelOpenConfirm); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgChannelOpenConfirm.aminoType, MsgChannelOpenConfirm.typeUrl); +function createBaseMsgChannelOpenConfirmResponse(): MsgChannelOpenConfirmResponse { + return {}; +} +export const MsgChannelOpenConfirmResponse = { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenConfirmResponse", + aminoType: "cosmos-sdk/MsgChannelOpenConfirmResponse", + is(o: any): o is MsgChannelOpenConfirmResponse { + return o && o.$typeUrl === MsgChannelOpenConfirmResponse.typeUrl; + }, + isAmino(o: any): o is MsgChannelOpenConfirmResponseAmino { + return o && o.$typeUrl === MsgChannelOpenConfirmResponse.typeUrl; + }, + encode(_: MsgChannelOpenConfirmResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelOpenConfirmResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelOpenConfirmResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgChannelOpenConfirmResponse { + const message = createBaseMsgChannelOpenConfirmResponse(); + return message; + }, + fromAmino(_: MsgChannelOpenConfirmResponseAmino): MsgChannelOpenConfirmResponse { + const message = createBaseMsgChannelOpenConfirmResponse(); + return message; + }, + toAmino(_: MsgChannelOpenConfirmResponse): MsgChannelOpenConfirmResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgChannelOpenConfirmResponseAminoMsg): MsgChannelOpenConfirmResponse { + return MsgChannelOpenConfirmResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelOpenConfirmResponse): MsgChannelOpenConfirmResponseAminoMsg { + return { + type: "cosmos-sdk/MsgChannelOpenConfirmResponse", + value: MsgChannelOpenConfirmResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelOpenConfirmResponseProtoMsg): MsgChannelOpenConfirmResponse { + return MsgChannelOpenConfirmResponse.decode(message.value); + }, + toProto(message: MsgChannelOpenConfirmResponse): Uint8Array { + return MsgChannelOpenConfirmResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelOpenConfirmResponse): MsgChannelOpenConfirmResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelOpenConfirmResponse", + value: MsgChannelOpenConfirmResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgChannelOpenConfirmResponse.typeUrl, MsgChannelOpenConfirmResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgChannelOpenConfirmResponse.aminoType, MsgChannelOpenConfirmResponse.typeUrl); +function createBaseMsgChannelCloseInit(): MsgChannelCloseInit { + return { + portId: "", + channelId: "", + signer: "" + }; +} +export const MsgChannelCloseInit = { + typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInit", + aminoType: "cosmos-sdk/MsgChannelCloseInit", + is(o: any): o is MsgChannelCloseInit { + return o && (o.$typeUrl === MsgChannelCloseInit.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string" && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgChannelCloseInitAmino { + return o && (o.$typeUrl === MsgChannelCloseInit.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && typeof o.signer === "string"); + }, + encode(message: MsgChannelCloseInit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + if (message.signer !== "") { + writer.uint32(26).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelCloseInit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelCloseInit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgChannelCloseInit { + const message = createBaseMsgChannelCloseInit(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.signer = object.signer ?? ""; + return message; + }, + fromAmino(object: MsgChannelCloseInitAmino): MsgChannelCloseInit { + const message = createBaseMsgChannelCloseInit(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgChannelCloseInit): MsgChannelCloseInitAmino { + const obj: any = {}; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.signer = message.signer === "" ? undefined : message.signer; + return obj; + }, + fromAminoMsg(object: MsgChannelCloseInitAminoMsg): MsgChannelCloseInit { + return MsgChannelCloseInit.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelCloseInit): MsgChannelCloseInitAminoMsg { + return { + type: "cosmos-sdk/MsgChannelCloseInit", + value: MsgChannelCloseInit.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelCloseInitProtoMsg): MsgChannelCloseInit { + return MsgChannelCloseInit.decode(message.value); + }, + toProto(message: MsgChannelCloseInit): Uint8Array { + return MsgChannelCloseInit.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelCloseInit): MsgChannelCloseInitProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInit", + value: MsgChannelCloseInit.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgChannelCloseInit.typeUrl, MsgChannelCloseInit); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgChannelCloseInit.aminoType, MsgChannelCloseInit.typeUrl); +function createBaseMsgChannelCloseInitResponse(): MsgChannelCloseInitResponse { + return {}; +} +export const MsgChannelCloseInitResponse = { + typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInitResponse", + aminoType: "cosmos-sdk/MsgChannelCloseInitResponse", + is(o: any): o is MsgChannelCloseInitResponse { + return o && o.$typeUrl === MsgChannelCloseInitResponse.typeUrl; + }, + isAmino(o: any): o is MsgChannelCloseInitResponseAmino { + return o && o.$typeUrl === MsgChannelCloseInitResponse.typeUrl; + }, + encode(_: MsgChannelCloseInitResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelCloseInitResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelCloseInitResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgChannelCloseInitResponse { + const message = createBaseMsgChannelCloseInitResponse(); + return message; + }, + fromAmino(_: MsgChannelCloseInitResponseAmino): MsgChannelCloseInitResponse { + const message = createBaseMsgChannelCloseInitResponse(); + return message; + }, + toAmino(_: MsgChannelCloseInitResponse): MsgChannelCloseInitResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgChannelCloseInitResponseAminoMsg): MsgChannelCloseInitResponse { + return MsgChannelCloseInitResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelCloseInitResponse): MsgChannelCloseInitResponseAminoMsg { + return { + type: "cosmos-sdk/MsgChannelCloseInitResponse", + value: MsgChannelCloseInitResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelCloseInitResponseProtoMsg): MsgChannelCloseInitResponse { + return MsgChannelCloseInitResponse.decode(message.value); + }, + toProto(message: MsgChannelCloseInitResponse): Uint8Array { + return MsgChannelCloseInitResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelCloseInitResponse): MsgChannelCloseInitResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelCloseInitResponse", + value: MsgChannelCloseInitResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgChannelCloseInitResponse.typeUrl, MsgChannelCloseInitResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgChannelCloseInitResponse.aminoType, MsgChannelCloseInitResponse.typeUrl); +function createBaseMsgChannelCloseConfirm(): MsgChannelCloseConfirm { + return { + portId: "", + channelId: "", + proofInit: new Uint8Array(), + proofHeight: Height.fromPartial({}), + signer: "", + counterpartyUpgradeSequence: BigInt(0) + }; +} +export const MsgChannelCloseConfirm = { + typeUrl: "/ibc.core.channel.v1.MsgChannelCloseConfirm", + aminoType: "cosmos-sdk/MsgChannelCloseConfirm", + is(o: any): o is MsgChannelCloseConfirm { + return o && (o.$typeUrl === MsgChannelCloseConfirm.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string" && (o.proofInit instanceof Uint8Array || typeof o.proofInit === "string") && Height.is(o.proofHeight) && typeof o.signer === "string" && typeof o.counterpartyUpgradeSequence === "bigint"); + }, + isAmino(o: any): o is MsgChannelCloseConfirmAmino { + return o && (o.$typeUrl === MsgChannelCloseConfirm.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && (o.proof_init instanceof Uint8Array || typeof o.proof_init === "string") && Height.isAmino(o.proof_height) && typeof o.signer === "string" && typeof o.counterparty_upgrade_sequence === "bigint"); + }, + encode(message: MsgChannelCloseConfirm, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + if (message.proofInit.length !== 0) { + writer.uint32(26).bytes(message.proofInit); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(34).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(42).string(message.signer); + } + if (message.counterpartyUpgradeSequence !== BigInt(0)) { + writer.uint32(48).uint64(message.counterpartyUpgradeSequence); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelCloseConfirm { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelCloseConfirm(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.proofInit = reader.bytes(); + break; + case 4: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + case 5: + message.signer = reader.string(); + break; + case 6: + message.counterpartyUpgradeSequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgChannelCloseConfirm { + const message = createBaseMsgChannelCloseConfirm(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.proofInit = object.proofInit ?? new Uint8Array(); + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; + message.signer = object.signer ?? ""; + message.counterpartyUpgradeSequence = object.counterpartyUpgradeSequence !== undefined && object.counterpartyUpgradeSequence !== null ? BigInt(object.counterpartyUpgradeSequence.toString()) : BigInt(0); + return message; + }, + fromAmino(object: MsgChannelCloseConfirmAmino): MsgChannelCloseConfirm { + const message = createBaseMsgChannelCloseConfirm(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + if (object.proof_init !== undefined && object.proof_init !== null) { + message.proofInit = bytesFromBase64(object.proof_init); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + if (object.counterparty_upgrade_sequence !== undefined && object.counterparty_upgrade_sequence !== null) { + message.counterpartyUpgradeSequence = BigInt(object.counterparty_upgrade_sequence); + } + return message; + }, + toAmino(message: MsgChannelCloseConfirm): MsgChannelCloseConfirmAmino { + const obj: any = {}; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.proof_init = message.proofInit ? base64FromBytes(message.proofInit) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + obj.signer = message.signer === "" ? undefined : message.signer; + obj.counterparty_upgrade_sequence = message.counterpartyUpgradeSequence !== BigInt(0) ? message.counterpartyUpgradeSequence?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: MsgChannelCloseConfirmAminoMsg): MsgChannelCloseConfirm { + return MsgChannelCloseConfirm.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelCloseConfirm): MsgChannelCloseConfirmAminoMsg { + return { + type: "cosmos-sdk/MsgChannelCloseConfirm", + value: MsgChannelCloseConfirm.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelCloseConfirmProtoMsg): MsgChannelCloseConfirm { + return MsgChannelCloseConfirm.decode(message.value); + }, + toProto(message: MsgChannelCloseConfirm): Uint8Array { + return MsgChannelCloseConfirm.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelCloseConfirm): MsgChannelCloseConfirmProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelCloseConfirm", + value: MsgChannelCloseConfirm.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgChannelCloseConfirm.typeUrl, MsgChannelCloseConfirm); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgChannelCloseConfirm.aminoType, MsgChannelCloseConfirm.typeUrl); +function createBaseMsgChannelCloseConfirmResponse(): MsgChannelCloseConfirmResponse { + return {}; +} +export const MsgChannelCloseConfirmResponse = { + typeUrl: "/ibc.core.channel.v1.MsgChannelCloseConfirmResponse", + aminoType: "cosmos-sdk/MsgChannelCloseConfirmResponse", + is(o: any): o is MsgChannelCloseConfirmResponse { + return o && o.$typeUrl === MsgChannelCloseConfirmResponse.typeUrl; + }, + isAmino(o: any): o is MsgChannelCloseConfirmResponseAmino { + return o && o.$typeUrl === MsgChannelCloseConfirmResponse.typeUrl; + }, + encode(_: MsgChannelCloseConfirmResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelCloseConfirmResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelCloseConfirmResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgChannelCloseConfirmResponse { + const message = createBaseMsgChannelCloseConfirmResponse(); + return message; + }, + fromAmino(_: MsgChannelCloseConfirmResponseAmino): MsgChannelCloseConfirmResponse { + const message = createBaseMsgChannelCloseConfirmResponse(); + return message; + }, + toAmino(_: MsgChannelCloseConfirmResponse): MsgChannelCloseConfirmResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgChannelCloseConfirmResponseAminoMsg): MsgChannelCloseConfirmResponse { + return MsgChannelCloseConfirmResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelCloseConfirmResponse): MsgChannelCloseConfirmResponseAminoMsg { + return { + type: "cosmos-sdk/MsgChannelCloseConfirmResponse", + value: MsgChannelCloseConfirmResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelCloseConfirmResponseProtoMsg): MsgChannelCloseConfirmResponse { + return MsgChannelCloseConfirmResponse.decode(message.value); + }, + toProto(message: MsgChannelCloseConfirmResponse): Uint8Array { + return MsgChannelCloseConfirmResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelCloseConfirmResponse): MsgChannelCloseConfirmResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelCloseConfirmResponse", + value: MsgChannelCloseConfirmResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgChannelCloseConfirmResponse.typeUrl, MsgChannelCloseConfirmResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgChannelCloseConfirmResponse.aminoType, MsgChannelCloseConfirmResponse.typeUrl); +function createBaseMsgRecvPacket(): MsgRecvPacket { + return { + packet: Packet.fromPartial({}), + proofCommitment: new Uint8Array(), + proofHeight: Height.fromPartial({}), + signer: "" + }; +} +export const MsgRecvPacket = { + typeUrl: "/ibc.core.channel.v1.MsgRecvPacket", + aminoType: "cosmos-sdk/MsgRecvPacket", + is(o: any): o is MsgRecvPacket { + return o && (o.$typeUrl === MsgRecvPacket.typeUrl || Packet.is(o.packet) && (o.proofCommitment instanceof Uint8Array || typeof o.proofCommitment === "string") && Height.is(o.proofHeight) && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgRecvPacketAmino { + return o && (o.$typeUrl === MsgRecvPacket.typeUrl || Packet.isAmino(o.packet) && (o.proof_commitment instanceof Uint8Array || typeof o.proof_commitment === "string") && Height.isAmino(o.proof_height) && typeof o.signer === "string"); + }, + encode(message: MsgRecvPacket, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.packet !== undefined) { + Packet.encode(message.packet, writer.uint32(10).fork()).ldelim(); + } + if (message.proofCommitment.length !== 0) { + writer.uint32(18).bytes(message.proofCommitment); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(34).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgRecvPacket { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRecvPacket(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.packet = Packet.decode(reader, reader.uint32()); + break; + case 2: + message.proofCommitment = reader.bytes(); + break; + case 3: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + case 4: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgRecvPacket { + const message = createBaseMsgRecvPacket(); + message.packet = object.packet !== undefined && object.packet !== null ? Packet.fromPartial(object.packet) : undefined; + message.proofCommitment = object.proofCommitment ?? new Uint8Array(); + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; + message.signer = object.signer ?? ""; + return message; + }, + fromAmino(object: MsgRecvPacketAmino): MsgRecvPacket { + const message = createBaseMsgRecvPacket(); + if (object.packet !== undefined && object.packet !== null) { + message.packet = Packet.fromAmino(object.packet); + } + if (object.proof_commitment !== undefined && object.proof_commitment !== null) { + message.proofCommitment = bytesFromBase64(object.proof_commitment); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgRecvPacket): MsgRecvPacketAmino { + const obj: any = {}; + obj.packet = message.packet ? Packet.toAmino(message.packet) : undefined; + obj.proof_commitment = message.proofCommitment ? base64FromBytes(message.proofCommitment) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + obj.signer = message.signer === "" ? undefined : message.signer; + return obj; + }, + fromAminoMsg(object: MsgRecvPacketAminoMsg): MsgRecvPacket { + return MsgRecvPacket.fromAmino(object.value); + }, + toAminoMsg(message: MsgRecvPacket): MsgRecvPacketAminoMsg { + return { + type: "cosmos-sdk/MsgRecvPacket", + value: MsgRecvPacket.toAmino(message) + }; + }, + fromProtoMsg(message: MsgRecvPacketProtoMsg): MsgRecvPacket { + return MsgRecvPacket.decode(message.value); + }, + toProto(message: MsgRecvPacket): Uint8Array { + return MsgRecvPacket.encode(message).finish(); + }, + toProtoMsg(message: MsgRecvPacket): MsgRecvPacketProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgRecvPacket", + value: MsgRecvPacket.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgRecvPacket.typeUrl, MsgRecvPacket); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgRecvPacket.aminoType, MsgRecvPacket.typeUrl); +function createBaseMsgRecvPacketResponse(): MsgRecvPacketResponse { + return { + result: 0 + }; +} +export const MsgRecvPacketResponse = { + typeUrl: "/ibc.core.channel.v1.MsgRecvPacketResponse", + aminoType: "cosmos-sdk/MsgRecvPacketResponse", + is(o: any): o is MsgRecvPacketResponse { + return o && (o.$typeUrl === MsgRecvPacketResponse.typeUrl || isSet(o.result)); + }, + isAmino(o: any): o is MsgRecvPacketResponseAmino { + return o && (o.$typeUrl === MsgRecvPacketResponse.typeUrl || isSet(o.result)); + }, + encode(message: MsgRecvPacketResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.result !== 0) { + writer.uint32(8).int32(message.result); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgRecvPacketResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRecvPacketResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.result = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgRecvPacketResponse { + const message = createBaseMsgRecvPacketResponse(); + message.result = object.result ?? 0; + return message; + }, + fromAmino(object: MsgRecvPacketResponseAmino): MsgRecvPacketResponse { + const message = createBaseMsgRecvPacketResponse(); + if (object.result !== undefined && object.result !== null) { + message.result = object.result; + } + return message; + }, + toAmino(message: MsgRecvPacketResponse): MsgRecvPacketResponseAmino { + const obj: any = {}; + obj.result = message.result === 0 ? undefined : message.result; + return obj; + }, + fromAminoMsg(object: MsgRecvPacketResponseAminoMsg): MsgRecvPacketResponse { + return MsgRecvPacketResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgRecvPacketResponse): MsgRecvPacketResponseAminoMsg { + return { + type: "cosmos-sdk/MsgRecvPacketResponse", + value: MsgRecvPacketResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgRecvPacketResponseProtoMsg): MsgRecvPacketResponse { + return MsgRecvPacketResponse.decode(message.value); + }, + toProto(message: MsgRecvPacketResponse): Uint8Array { + return MsgRecvPacketResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgRecvPacketResponse): MsgRecvPacketResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgRecvPacketResponse", + value: MsgRecvPacketResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgRecvPacketResponse.typeUrl, MsgRecvPacketResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgRecvPacketResponse.aminoType, MsgRecvPacketResponse.typeUrl); +function createBaseMsgTimeout(): MsgTimeout { + return { + packet: Packet.fromPartial({}), + proofUnreceived: new Uint8Array(), + proofHeight: Height.fromPartial({}), + nextSequenceRecv: BigInt(0), + signer: "" + }; +} +export const MsgTimeout = { + typeUrl: "/ibc.core.channel.v1.MsgTimeout", + aminoType: "cosmos-sdk/MsgTimeout", + is(o: any): o is MsgTimeout { + return o && (o.$typeUrl === MsgTimeout.typeUrl || Packet.is(o.packet) && (o.proofUnreceived instanceof Uint8Array || typeof o.proofUnreceived === "string") && Height.is(o.proofHeight) && typeof o.nextSequenceRecv === "bigint" && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgTimeoutAmino { + return o && (o.$typeUrl === MsgTimeout.typeUrl || Packet.isAmino(o.packet) && (o.proof_unreceived instanceof Uint8Array || typeof o.proof_unreceived === "string") && Height.isAmino(o.proof_height) && typeof o.next_sequence_recv === "bigint" && typeof o.signer === "string"); + }, + encode(message: MsgTimeout, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.packet !== undefined) { + Packet.encode(message.packet, writer.uint32(10).fork()).ldelim(); + } + if (message.proofUnreceived.length !== 0) { + writer.uint32(18).bytes(message.proofUnreceived); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); + } + if (message.nextSequenceRecv !== BigInt(0)) { + writer.uint32(32).uint64(message.nextSequenceRecv); + } + if (message.signer !== "") { + writer.uint32(42).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgTimeout { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgTimeout(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.packet = Packet.decode(reader, reader.uint32()); + break; + case 2: + message.proofUnreceived = reader.bytes(); + break; + case 3: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + case 4: + message.nextSequenceRecv = reader.uint64(); + break; + case 5: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgTimeout { + const message = createBaseMsgTimeout(); + message.packet = object.packet !== undefined && object.packet !== null ? Packet.fromPartial(object.packet) : undefined; + message.proofUnreceived = object.proofUnreceived ?? new Uint8Array(); + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; + message.nextSequenceRecv = object.nextSequenceRecv !== undefined && object.nextSequenceRecv !== null ? BigInt(object.nextSequenceRecv.toString()) : BigInt(0); + message.signer = object.signer ?? ""; + return message; + }, + fromAmino(object: MsgTimeoutAmino): MsgTimeout { + const message = createBaseMsgTimeout(); + if (object.packet !== undefined && object.packet !== null) { + message.packet = Packet.fromAmino(object.packet); + } + if (object.proof_unreceived !== undefined && object.proof_unreceived !== null) { + message.proofUnreceived = bytesFromBase64(object.proof_unreceived); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + if (object.next_sequence_recv !== undefined && object.next_sequence_recv !== null) { + message.nextSequenceRecv = BigInt(object.next_sequence_recv); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgTimeout): MsgTimeoutAmino { + const obj: any = {}; + obj.packet = message.packet ? Packet.toAmino(message.packet) : undefined; + obj.proof_unreceived = message.proofUnreceived ? base64FromBytes(message.proofUnreceived) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + obj.next_sequence_recv = message.nextSequenceRecv !== BigInt(0) ? message.nextSequenceRecv?.toString() : undefined; + obj.signer = message.signer === "" ? undefined : message.signer; + return obj; + }, + fromAminoMsg(object: MsgTimeoutAminoMsg): MsgTimeout { + return MsgTimeout.fromAmino(object.value); + }, + toAminoMsg(message: MsgTimeout): MsgTimeoutAminoMsg { + return { + type: "cosmos-sdk/MsgTimeout", + value: MsgTimeout.toAmino(message) + }; + }, + fromProtoMsg(message: MsgTimeoutProtoMsg): MsgTimeout { + return MsgTimeout.decode(message.value); + }, + toProto(message: MsgTimeout): Uint8Array { + return MsgTimeout.encode(message).finish(); + }, + toProtoMsg(message: MsgTimeout): MsgTimeoutProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgTimeout", + value: MsgTimeout.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgTimeout.typeUrl, MsgTimeout); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgTimeout.aminoType, MsgTimeout.typeUrl); +function createBaseMsgTimeoutResponse(): MsgTimeoutResponse { + return { + result: 0 + }; +} +export const MsgTimeoutResponse = { + typeUrl: "/ibc.core.channel.v1.MsgTimeoutResponse", + aminoType: "cosmos-sdk/MsgTimeoutResponse", + is(o: any): o is MsgTimeoutResponse { + return o && (o.$typeUrl === MsgTimeoutResponse.typeUrl || isSet(o.result)); + }, + isAmino(o: any): o is MsgTimeoutResponseAmino { + return o && (o.$typeUrl === MsgTimeoutResponse.typeUrl || isSet(o.result)); + }, + encode(message: MsgTimeoutResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.result !== 0) { + writer.uint32(8).int32(message.result); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgTimeoutResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgTimeoutResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.result = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgTimeoutResponse { + const message = createBaseMsgTimeoutResponse(); + message.result = object.result ?? 0; + return message; + }, + fromAmino(object: MsgTimeoutResponseAmino): MsgTimeoutResponse { + const message = createBaseMsgTimeoutResponse(); + if (object.result !== undefined && object.result !== null) { + message.result = object.result; + } + return message; + }, + toAmino(message: MsgTimeoutResponse): MsgTimeoutResponseAmino { + const obj: any = {}; + obj.result = message.result === 0 ? undefined : message.result; + return obj; + }, + fromAminoMsg(object: MsgTimeoutResponseAminoMsg): MsgTimeoutResponse { + return MsgTimeoutResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgTimeoutResponse): MsgTimeoutResponseAminoMsg { + return { + type: "cosmos-sdk/MsgTimeoutResponse", + value: MsgTimeoutResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgTimeoutResponseProtoMsg): MsgTimeoutResponse { + return MsgTimeoutResponse.decode(message.value); + }, + toProto(message: MsgTimeoutResponse): Uint8Array { + return MsgTimeoutResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgTimeoutResponse): MsgTimeoutResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgTimeoutResponse", + value: MsgTimeoutResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgTimeoutResponse.typeUrl, MsgTimeoutResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgTimeoutResponse.aminoType, MsgTimeoutResponse.typeUrl); +function createBaseMsgTimeoutOnClose(): MsgTimeoutOnClose { + return { + packet: Packet.fromPartial({}), + proofUnreceived: new Uint8Array(), + proofClose: new Uint8Array(), + proofHeight: Height.fromPartial({}), + nextSequenceRecv: BigInt(0), + signer: "", + counterpartyUpgradeSequence: BigInt(0) + }; +} +export const MsgTimeoutOnClose = { + typeUrl: "/ibc.core.channel.v1.MsgTimeoutOnClose", + aminoType: "cosmos-sdk/MsgTimeoutOnClose", + is(o: any): o is MsgTimeoutOnClose { + return o && (o.$typeUrl === MsgTimeoutOnClose.typeUrl || Packet.is(o.packet) && (o.proofUnreceived instanceof Uint8Array || typeof o.proofUnreceived === "string") && (o.proofClose instanceof Uint8Array || typeof o.proofClose === "string") && Height.is(o.proofHeight) && typeof o.nextSequenceRecv === "bigint" && typeof o.signer === "string" && typeof o.counterpartyUpgradeSequence === "bigint"); + }, + isAmino(o: any): o is MsgTimeoutOnCloseAmino { + return o && (o.$typeUrl === MsgTimeoutOnClose.typeUrl || Packet.isAmino(o.packet) && (o.proof_unreceived instanceof Uint8Array || typeof o.proof_unreceived === "string") && (o.proof_close instanceof Uint8Array || typeof o.proof_close === "string") && Height.isAmino(o.proof_height) && typeof o.next_sequence_recv === "bigint" && typeof o.signer === "string" && typeof o.counterparty_upgrade_sequence === "bigint"); + }, + encode(message: MsgTimeoutOnClose, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.packet !== undefined) { + Packet.encode(message.packet, writer.uint32(10).fork()).ldelim(); + } + if (message.proofUnreceived.length !== 0) { + writer.uint32(18).bytes(message.proofUnreceived); + } + if (message.proofClose.length !== 0) { + writer.uint32(26).bytes(message.proofClose); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(34).fork()).ldelim(); + } + if (message.nextSequenceRecv !== BigInt(0)) { + writer.uint32(40).uint64(message.nextSequenceRecv); + } + if (message.signer !== "") { + writer.uint32(50).string(message.signer); + } + if (message.counterpartyUpgradeSequence !== BigInt(0)) { + writer.uint32(56).uint64(message.counterpartyUpgradeSequence); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgTimeoutOnClose { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgTimeoutOnClose(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.packet = Packet.decode(reader, reader.uint32()); + break; + case 2: + message.proofUnreceived = reader.bytes(); + break; + case 3: + message.proofClose = reader.bytes(); + break; + case 4: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + case 5: + message.nextSequenceRecv = reader.uint64(); + break; + case 6: + message.signer = reader.string(); + break; + case 7: + message.counterpartyUpgradeSequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgTimeoutOnClose { + const message = createBaseMsgTimeoutOnClose(); + message.packet = object.packet !== undefined && object.packet !== null ? Packet.fromPartial(object.packet) : undefined; + message.proofUnreceived = object.proofUnreceived ?? new Uint8Array(); + message.proofClose = object.proofClose ?? new Uint8Array(); + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; + message.nextSequenceRecv = object.nextSequenceRecv !== undefined && object.nextSequenceRecv !== null ? BigInt(object.nextSequenceRecv.toString()) : BigInt(0); + message.signer = object.signer ?? ""; + message.counterpartyUpgradeSequence = object.counterpartyUpgradeSequence !== undefined && object.counterpartyUpgradeSequence !== null ? BigInt(object.counterpartyUpgradeSequence.toString()) : BigInt(0); + return message; + }, + fromAmino(object: MsgTimeoutOnCloseAmino): MsgTimeoutOnClose { + const message = createBaseMsgTimeoutOnClose(); + if (object.packet !== undefined && object.packet !== null) { + message.packet = Packet.fromAmino(object.packet); + } + if (object.proof_unreceived !== undefined && object.proof_unreceived !== null) { + message.proofUnreceived = bytesFromBase64(object.proof_unreceived); + } + if (object.proof_close !== undefined && object.proof_close !== null) { + message.proofClose = bytesFromBase64(object.proof_close); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + if (object.next_sequence_recv !== undefined && object.next_sequence_recv !== null) { + message.nextSequenceRecv = BigInt(object.next_sequence_recv); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + if (object.counterparty_upgrade_sequence !== undefined && object.counterparty_upgrade_sequence !== null) { + message.counterpartyUpgradeSequence = BigInt(object.counterparty_upgrade_sequence); + } + return message; + }, + toAmino(message: MsgTimeoutOnClose): MsgTimeoutOnCloseAmino { + const obj: any = {}; + obj.packet = message.packet ? Packet.toAmino(message.packet) : undefined; + obj.proof_unreceived = message.proofUnreceived ? base64FromBytes(message.proofUnreceived) : undefined; + obj.proof_close = message.proofClose ? base64FromBytes(message.proofClose) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + obj.next_sequence_recv = message.nextSequenceRecv !== BigInt(0) ? message.nextSequenceRecv?.toString() : undefined; + obj.signer = message.signer === "" ? undefined : message.signer; + obj.counterparty_upgrade_sequence = message.counterpartyUpgradeSequence !== BigInt(0) ? message.counterpartyUpgradeSequence?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: MsgTimeoutOnCloseAminoMsg): MsgTimeoutOnClose { + return MsgTimeoutOnClose.fromAmino(object.value); + }, + toAminoMsg(message: MsgTimeoutOnClose): MsgTimeoutOnCloseAminoMsg { + return { + type: "cosmos-sdk/MsgTimeoutOnClose", + value: MsgTimeoutOnClose.toAmino(message) + }; + }, + fromProtoMsg(message: MsgTimeoutOnCloseProtoMsg): MsgTimeoutOnClose { + return MsgTimeoutOnClose.decode(message.value); + }, + toProto(message: MsgTimeoutOnClose): Uint8Array { + return MsgTimeoutOnClose.encode(message).finish(); + }, + toProtoMsg(message: MsgTimeoutOnClose): MsgTimeoutOnCloseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgTimeoutOnClose", + value: MsgTimeoutOnClose.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgTimeoutOnClose.typeUrl, MsgTimeoutOnClose); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgTimeoutOnClose.aminoType, MsgTimeoutOnClose.typeUrl); +function createBaseMsgTimeoutOnCloseResponse(): MsgTimeoutOnCloseResponse { + return { + result: 0 + }; +} +export const MsgTimeoutOnCloseResponse = { + typeUrl: "/ibc.core.channel.v1.MsgTimeoutOnCloseResponse", + aminoType: "cosmos-sdk/MsgTimeoutOnCloseResponse", + is(o: any): o is MsgTimeoutOnCloseResponse { + return o && (o.$typeUrl === MsgTimeoutOnCloseResponse.typeUrl || isSet(o.result)); + }, + isAmino(o: any): o is MsgTimeoutOnCloseResponseAmino { + return o && (o.$typeUrl === MsgTimeoutOnCloseResponse.typeUrl || isSet(o.result)); + }, + encode(message: MsgTimeoutOnCloseResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.result !== 0) { + writer.uint32(8).int32(message.result); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgTimeoutOnCloseResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgTimeoutOnCloseResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.result = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgTimeoutOnCloseResponse { + const message = createBaseMsgTimeoutOnCloseResponse(); + message.result = object.result ?? 0; + return message; + }, + fromAmino(object: MsgTimeoutOnCloseResponseAmino): MsgTimeoutOnCloseResponse { + const message = createBaseMsgTimeoutOnCloseResponse(); + if (object.result !== undefined && object.result !== null) { + message.result = object.result; + } + return message; + }, + toAmino(message: MsgTimeoutOnCloseResponse): MsgTimeoutOnCloseResponseAmino { + const obj: any = {}; + obj.result = message.result === 0 ? undefined : message.result; + return obj; + }, + fromAminoMsg(object: MsgTimeoutOnCloseResponseAminoMsg): MsgTimeoutOnCloseResponse { + return MsgTimeoutOnCloseResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgTimeoutOnCloseResponse): MsgTimeoutOnCloseResponseAminoMsg { + return { + type: "cosmos-sdk/MsgTimeoutOnCloseResponse", + value: MsgTimeoutOnCloseResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgTimeoutOnCloseResponseProtoMsg): MsgTimeoutOnCloseResponse { + return MsgTimeoutOnCloseResponse.decode(message.value); + }, + toProto(message: MsgTimeoutOnCloseResponse): Uint8Array { + return MsgTimeoutOnCloseResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgTimeoutOnCloseResponse): MsgTimeoutOnCloseResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgTimeoutOnCloseResponse", + value: MsgTimeoutOnCloseResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgTimeoutOnCloseResponse.typeUrl, MsgTimeoutOnCloseResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgTimeoutOnCloseResponse.aminoType, MsgTimeoutOnCloseResponse.typeUrl); +function createBaseMsgAcknowledgement(): MsgAcknowledgement { + return { + packet: Packet.fromPartial({}), + acknowledgement: new Uint8Array(), + proofAcked: new Uint8Array(), + proofHeight: Height.fromPartial({}), + signer: "" + }; +} +export const MsgAcknowledgement = { + typeUrl: "/ibc.core.channel.v1.MsgAcknowledgement", + aminoType: "cosmos-sdk/MsgAcknowledgement", + is(o: any): o is MsgAcknowledgement { + return o && (o.$typeUrl === MsgAcknowledgement.typeUrl || Packet.is(o.packet) && (o.acknowledgement instanceof Uint8Array || typeof o.acknowledgement === "string") && (o.proofAcked instanceof Uint8Array || typeof o.proofAcked === "string") && Height.is(o.proofHeight) && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgAcknowledgementAmino { + return o && (o.$typeUrl === MsgAcknowledgement.typeUrl || Packet.isAmino(o.packet) && (o.acknowledgement instanceof Uint8Array || typeof o.acknowledgement === "string") && (o.proof_acked instanceof Uint8Array || typeof o.proof_acked === "string") && Height.isAmino(o.proof_height) && typeof o.signer === "string"); + }, + encode(message: MsgAcknowledgement, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.packet !== undefined) { + Packet.encode(message.packet, writer.uint32(10).fork()).ldelim(); + } + if (message.acknowledgement.length !== 0) { + writer.uint32(18).bytes(message.acknowledgement); + } + if (message.proofAcked.length !== 0) { + writer.uint32(26).bytes(message.proofAcked); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(34).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(42).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgAcknowledgement { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAcknowledgement(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.packet = Packet.decode(reader, reader.uint32()); + break; + case 2: + message.acknowledgement = reader.bytes(); + break; + case 3: + message.proofAcked = reader.bytes(); + break; + case 4: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + case 5: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgAcknowledgement { + const message = createBaseMsgAcknowledgement(); + message.packet = object.packet !== undefined && object.packet !== null ? Packet.fromPartial(object.packet) : undefined; + message.acknowledgement = object.acknowledgement ?? new Uint8Array(); + message.proofAcked = object.proofAcked ?? new Uint8Array(); + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; + message.signer = object.signer ?? ""; + return message; + }, + fromAmino(object: MsgAcknowledgementAmino): MsgAcknowledgement { + const message = createBaseMsgAcknowledgement(); + if (object.packet !== undefined && object.packet !== null) { + message.packet = Packet.fromAmino(object.packet); + } + if (object.acknowledgement !== undefined && object.acknowledgement !== null) { + message.acknowledgement = bytesFromBase64(object.acknowledgement); + } + if (object.proof_acked !== undefined && object.proof_acked !== null) { + message.proofAcked = bytesFromBase64(object.proof_acked); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgAcknowledgement): MsgAcknowledgementAmino { + const obj: any = {}; + obj.packet = message.packet ? Packet.toAmino(message.packet) : undefined; + obj.acknowledgement = message.acknowledgement ? base64FromBytes(message.acknowledgement) : undefined; + obj.proof_acked = message.proofAcked ? base64FromBytes(message.proofAcked) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + obj.signer = message.signer === "" ? undefined : message.signer; + return obj; + }, + fromAminoMsg(object: MsgAcknowledgementAminoMsg): MsgAcknowledgement { + return MsgAcknowledgement.fromAmino(object.value); + }, + toAminoMsg(message: MsgAcknowledgement): MsgAcknowledgementAminoMsg { + return { + type: "cosmos-sdk/MsgAcknowledgement", + value: MsgAcknowledgement.toAmino(message) + }; + }, + fromProtoMsg(message: MsgAcknowledgementProtoMsg): MsgAcknowledgement { + return MsgAcknowledgement.decode(message.value); + }, + toProto(message: MsgAcknowledgement): Uint8Array { + return MsgAcknowledgement.encode(message).finish(); + }, + toProtoMsg(message: MsgAcknowledgement): MsgAcknowledgementProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgAcknowledgement", + value: MsgAcknowledgement.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgAcknowledgement.typeUrl, MsgAcknowledgement); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgAcknowledgement.aminoType, MsgAcknowledgement.typeUrl); +function createBaseMsgAcknowledgementResponse(): MsgAcknowledgementResponse { + return { + result: 0 + }; +} +export const MsgAcknowledgementResponse = { + typeUrl: "/ibc.core.channel.v1.MsgAcknowledgementResponse", + aminoType: "cosmos-sdk/MsgAcknowledgementResponse", + is(o: any): o is MsgAcknowledgementResponse { + return o && (o.$typeUrl === MsgAcknowledgementResponse.typeUrl || isSet(o.result)); + }, + isAmino(o: any): o is MsgAcknowledgementResponseAmino { + return o && (o.$typeUrl === MsgAcknowledgementResponse.typeUrl || isSet(o.result)); + }, + encode(message: MsgAcknowledgementResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.result !== 0) { + writer.uint32(8).int32(message.result); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgAcknowledgementResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgAcknowledgementResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.result = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgAcknowledgementResponse { + const message = createBaseMsgAcknowledgementResponse(); + message.result = object.result ?? 0; + return message; + }, + fromAmino(object: MsgAcknowledgementResponseAmino): MsgAcknowledgementResponse { + const message = createBaseMsgAcknowledgementResponse(); + if (object.result !== undefined && object.result !== null) { + message.result = object.result; + } + return message; + }, + toAmino(message: MsgAcknowledgementResponse): MsgAcknowledgementResponseAmino { + const obj: any = {}; + obj.result = message.result === 0 ? undefined : message.result; + return obj; + }, + fromAminoMsg(object: MsgAcknowledgementResponseAminoMsg): MsgAcknowledgementResponse { + return MsgAcknowledgementResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgAcknowledgementResponse): MsgAcknowledgementResponseAminoMsg { + return { + type: "cosmos-sdk/MsgAcknowledgementResponse", + value: MsgAcknowledgementResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgAcknowledgementResponseProtoMsg): MsgAcknowledgementResponse { + return MsgAcknowledgementResponse.decode(message.value); + }, + toProto(message: MsgAcknowledgementResponse): Uint8Array { + return MsgAcknowledgementResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgAcknowledgementResponse): MsgAcknowledgementResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgAcknowledgementResponse", + value: MsgAcknowledgementResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgAcknowledgementResponse.typeUrl, MsgAcknowledgementResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgAcknowledgementResponse.aminoType, MsgAcknowledgementResponse.typeUrl); +function createBaseMsgChannelUpgradeInit(): MsgChannelUpgradeInit { + return { + portId: "", + channelId: "", + fields: UpgradeFields.fromPartial({}), + signer: "" + }; +} +export const MsgChannelUpgradeInit = { + typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeInit", + aminoType: "cosmos-sdk/MsgChannelUpgradeInit", + is(o: any): o is MsgChannelUpgradeInit { + return o && (o.$typeUrl === MsgChannelUpgradeInit.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string" && UpgradeFields.is(o.fields) && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgChannelUpgradeInitAmino { + return o && (o.$typeUrl === MsgChannelUpgradeInit.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && UpgradeFields.isAmino(o.fields) && typeof o.signer === "string"); + }, + encode(message: MsgChannelUpgradeInit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + if (message.fields !== undefined) { + UpgradeFields.encode(message.fields, writer.uint32(26).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(34).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelUpgradeInit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelUpgradeInit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.fields = UpgradeFields.decode(reader, reader.uint32()); + break; + case 4: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgChannelUpgradeInit { + const message = createBaseMsgChannelUpgradeInit(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.fields = object.fields !== undefined && object.fields !== null ? UpgradeFields.fromPartial(object.fields) : undefined; + message.signer = object.signer ?? ""; + return message; + }, + fromAmino(object: MsgChannelUpgradeInitAmino): MsgChannelUpgradeInit { + const message = createBaseMsgChannelUpgradeInit(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + if (object.fields !== undefined && object.fields !== null) { + message.fields = UpgradeFields.fromAmino(object.fields); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgChannelUpgradeInit): MsgChannelUpgradeInitAmino { + const obj: any = {}; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.fields = message.fields ? UpgradeFields.toAmino(message.fields) : undefined; + obj.signer = message.signer === "" ? undefined : message.signer; + return obj; + }, + fromAminoMsg(object: MsgChannelUpgradeInitAminoMsg): MsgChannelUpgradeInit { + return MsgChannelUpgradeInit.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelUpgradeInit): MsgChannelUpgradeInitAminoMsg { + return { + type: "cosmos-sdk/MsgChannelUpgradeInit", + value: MsgChannelUpgradeInit.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelUpgradeInitProtoMsg): MsgChannelUpgradeInit { + return MsgChannelUpgradeInit.decode(message.value); + }, + toProto(message: MsgChannelUpgradeInit): Uint8Array { + return MsgChannelUpgradeInit.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelUpgradeInit): MsgChannelUpgradeInitProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeInit", + value: MsgChannelUpgradeInit.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgChannelUpgradeInit.typeUrl, MsgChannelUpgradeInit); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgChannelUpgradeInit.aminoType, MsgChannelUpgradeInit.typeUrl); +function createBaseMsgChannelUpgradeInitResponse(): MsgChannelUpgradeInitResponse { + return { + upgrade: Upgrade.fromPartial({}), + upgradeSequence: BigInt(0) + }; +} +export const MsgChannelUpgradeInitResponse = { + typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeInitResponse", + aminoType: "cosmos-sdk/MsgChannelUpgradeInitResponse", + is(o: any): o is MsgChannelUpgradeInitResponse { + return o && (o.$typeUrl === MsgChannelUpgradeInitResponse.typeUrl || Upgrade.is(o.upgrade) && typeof o.upgradeSequence === "bigint"); + }, + isAmino(o: any): o is MsgChannelUpgradeInitResponseAmino { + return o && (o.$typeUrl === MsgChannelUpgradeInitResponse.typeUrl || Upgrade.isAmino(o.upgrade) && typeof o.upgrade_sequence === "bigint"); + }, + encode(message: MsgChannelUpgradeInitResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.upgrade !== undefined) { + Upgrade.encode(message.upgrade, writer.uint32(10).fork()).ldelim(); + } + if (message.upgradeSequence !== BigInt(0)) { + writer.uint32(16).uint64(message.upgradeSequence); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelUpgradeInitResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelUpgradeInitResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.upgrade = Upgrade.decode(reader, reader.uint32()); + break; + case 2: + message.upgradeSequence = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgChannelUpgradeInitResponse { + const message = createBaseMsgChannelUpgradeInitResponse(); + message.upgrade = object.upgrade !== undefined && object.upgrade !== null ? Upgrade.fromPartial(object.upgrade) : undefined; + message.upgradeSequence = object.upgradeSequence !== undefined && object.upgradeSequence !== null ? BigInt(object.upgradeSequence.toString()) : BigInt(0); + return message; + }, + fromAmino(object: MsgChannelUpgradeInitResponseAmino): MsgChannelUpgradeInitResponse { + const message = createBaseMsgChannelUpgradeInitResponse(); + if (object.upgrade !== undefined && object.upgrade !== null) { + message.upgrade = Upgrade.fromAmino(object.upgrade); + } + if (object.upgrade_sequence !== undefined && object.upgrade_sequence !== null) { + message.upgradeSequence = BigInt(object.upgrade_sequence); + } + return message; + }, + toAmino(message: MsgChannelUpgradeInitResponse): MsgChannelUpgradeInitResponseAmino { + const obj: any = {}; + obj.upgrade = message.upgrade ? Upgrade.toAmino(message.upgrade) : undefined; + obj.upgrade_sequence = message.upgradeSequence !== BigInt(0) ? message.upgradeSequence?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: MsgChannelUpgradeInitResponseAminoMsg): MsgChannelUpgradeInitResponse { + return MsgChannelUpgradeInitResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelUpgradeInitResponse): MsgChannelUpgradeInitResponseAminoMsg { + return { + type: "cosmos-sdk/MsgChannelUpgradeInitResponse", + value: MsgChannelUpgradeInitResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelUpgradeInitResponseProtoMsg): MsgChannelUpgradeInitResponse { + return MsgChannelUpgradeInitResponse.decode(message.value); + }, + toProto(message: MsgChannelUpgradeInitResponse): Uint8Array { + return MsgChannelUpgradeInitResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelUpgradeInitResponse): MsgChannelUpgradeInitResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeInitResponse", + value: MsgChannelUpgradeInitResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgChannelUpgradeInitResponse.typeUrl, MsgChannelUpgradeInitResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgChannelUpgradeInitResponse.aminoType, MsgChannelUpgradeInitResponse.typeUrl); +function createBaseMsgChannelUpgradeTry(): MsgChannelUpgradeTry { + return { + portId: "", + channelId: "", + proposedUpgradeConnectionHops: [], + counterpartyUpgradeFields: UpgradeFields.fromPartial({}), + counterpartyUpgradeSequence: BigInt(0), + proofChannel: new Uint8Array(), + proofUpgrade: new Uint8Array(), + proofHeight: Height.fromPartial({}), + signer: "" + }; +} +export const MsgChannelUpgradeTry = { + typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeTry", + aminoType: "cosmos-sdk/MsgChannelUpgradeTry", + is(o: any): o is MsgChannelUpgradeTry { + return o && (o.$typeUrl === MsgChannelUpgradeTry.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string" && Array.isArray(o.proposedUpgradeConnectionHops) && (!o.proposedUpgradeConnectionHops.length || typeof o.proposedUpgradeConnectionHops[0] === "string") && UpgradeFields.is(o.counterpartyUpgradeFields) && typeof o.counterpartyUpgradeSequence === "bigint" && (o.proofChannel instanceof Uint8Array || typeof o.proofChannel === "string") && (o.proofUpgrade instanceof Uint8Array || typeof o.proofUpgrade === "string") && Height.is(o.proofHeight) && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgChannelUpgradeTryAmino { + return o && (o.$typeUrl === MsgChannelUpgradeTry.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && Array.isArray(o.proposed_upgrade_connection_hops) && (!o.proposed_upgrade_connection_hops.length || typeof o.proposed_upgrade_connection_hops[0] === "string") && UpgradeFields.isAmino(o.counterparty_upgrade_fields) && typeof o.counterparty_upgrade_sequence === "bigint" && (o.proof_channel instanceof Uint8Array || typeof o.proof_channel === "string") && (o.proof_upgrade instanceof Uint8Array || typeof o.proof_upgrade === "string") && Height.isAmino(o.proof_height) && typeof o.signer === "string"); + }, + encode(message: MsgChannelUpgradeTry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + for (const v of message.proposedUpgradeConnectionHops) { + writer.uint32(26).string(v!); + } + if (message.counterpartyUpgradeFields !== undefined) { + UpgradeFields.encode(message.counterpartyUpgradeFields, writer.uint32(34).fork()).ldelim(); + } + if (message.counterpartyUpgradeSequence !== BigInt(0)) { + writer.uint32(40).uint64(message.counterpartyUpgradeSequence); + } + if (message.proofChannel.length !== 0) { + writer.uint32(50).bytes(message.proofChannel); + } + if (message.proofUpgrade.length !== 0) { + writer.uint32(58).bytes(message.proofUpgrade); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(66).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(74).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelUpgradeTry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelUpgradeTry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.proposedUpgradeConnectionHops.push(reader.string()); + break; + case 4: + message.counterpartyUpgradeFields = UpgradeFields.decode(reader, reader.uint32()); + break; + case 5: + message.counterpartyUpgradeSequence = reader.uint64(); + break; + case 6: + message.proofChannel = reader.bytes(); + break; + case 7: + message.proofUpgrade = reader.bytes(); + break; + case 8: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + case 9: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgChannelUpgradeTry { + const message = createBaseMsgChannelUpgradeTry(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.proposedUpgradeConnectionHops = object.proposedUpgradeConnectionHops?.map(e => e) || []; + message.counterpartyUpgradeFields = object.counterpartyUpgradeFields !== undefined && object.counterpartyUpgradeFields !== null ? UpgradeFields.fromPartial(object.counterpartyUpgradeFields) : undefined; + message.counterpartyUpgradeSequence = object.counterpartyUpgradeSequence !== undefined && object.counterpartyUpgradeSequence !== null ? BigInt(object.counterpartyUpgradeSequence.toString()) : BigInt(0); + message.proofChannel = object.proofChannel ?? new Uint8Array(); + message.proofUpgrade = object.proofUpgrade ?? new Uint8Array(); + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; + message.signer = object.signer ?? ""; + return message; + }, + fromAmino(object: MsgChannelUpgradeTryAmino): MsgChannelUpgradeTry { + const message = createBaseMsgChannelUpgradeTry(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + message.proposedUpgradeConnectionHops = object.proposed_upgrade_connection_hops?.map(e => e) || []; + if (object.counterparty_upgrade_fields !== undefined && object.counterparty_upgrade_fields !== null) { + message.counterpartyUpgradeFields = UpgradeFields.fromAmino(object.counterparty_upgrade_fields); + } + if (object.counterparty_upgrade_sequence !== undefined && object.counterparty_upgrade_sequence !== null) { + message.counterpartyUpgradeSequence = BigInt(object.counterparty_upgrade_sequence); + } + if (object.proof_channel !== undefined && object.proof_channel !== null) { + message.proofChannel = bytesFromBase64(object.proof_channel); + } + if (object.proof_upgrade !== undefined && object.proof_upgrade !== null) { + message.proofUpgrade = bytesFromBase64(object.proof_upgrade); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgChannelUpgradeTry): MsgChannelUpgradeTryAmino { + const obj: any = {}; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + if (message.proposedUpgradeConnectionHops) { + obj.proposed_upgrade_connection_hops = message.proposedUpgradeConnectionHops.map(e => e); + } else { + obj.proposed_upgrade_connection_hops = message.proposedUpgradeConnectionHops; + } + obj.counterparty_upgrade_fields = message.counterpartyUpgradeFields ? UpgradeFields.toAmino(message.counterpartyUpgradeFields) : undefined; + obj.counterparty_upgrade_sequence = message.counterpartyUpgradeSequence !== BigInt(0) ? message.counterpartyUpgradeSequence?.toString() : undefined; + obj.proof_channel = message.proofChannel ? base64FromBytes(message.proofChannel) : undefined; + obj.proof_upgrade = message.proofUpgrade ? base64FromBytes(message.proofUpgrade) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + obj.signer = message.signer === "" ? undefined : message.signer; + return obj; + }, + fromAminoMsg(object: MsgChannelUpgradeTryAminoMsg): MsgChannelUpgradeTry { + return MsgChannelUpgradeTry.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelUpgradeTry): MsgChannelUpgradeTryAminoMsg { + return { + type: "cosmos-sdk/MsgChannelUpgradeTry", + value: MsgChannelUpgradeTry.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelUpgradeTryProtoMsg): MsgChannelUpgradeTry { + return MsgChannelUpgradeTry.decode(message.value); + }, + toProto(message: MsgChannelUpgradeTry): Uint8Array { + return MsgChannelUpgradeTry.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelUpgradeTry): MsgChannelUpgradeTryProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeTry", + value: MsgChannelUpgradeTry.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgChannelUpgradeTry.typeUrl, MsgChannelUpgradeTry); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgChannelUpgradeTry.aminoType, MsgChannelUpgradeTry.typeUrl); +function createBaseMsgChannelUpgradeTryResponse(): MsgChannelUpgradeTryResponse { + return { + upgrade: Upgrade.fromPartial({}), + upgradeSequence: BigInt(0), + result: 0 + }; +} +export const MsgChannelUpgradeTryResponse = { + typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeTryResponse", + aminoType: "cosmos-sdk/MsgChannelUpgradeTryResponse", + is(o: any): o is MsgChannelUpgradeTryResponse { + return o && (o.$typeUrl === MsgChannelUpgradeTryResponse.typeUrl || Upgrade.is(o.upgrade) && typeof o.upgradeSequence === "bigint" && isSet(o.result)); + }, + isAmino(o: any): o is MsgChannelUpgradeTryResponseAmino { + return o && (o.$typeUrl === MsgChannelUpgradeTryResponse.typeUrl || Upgrade.isAmino(o.upgrade) && typeof o.upgrade_sequence === "bigint" && isSet(o.result)); + }, + encode(message: MsgChannelUpgradeTryResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.upgrade !== undefined) { + Upgrade.encode(message.upgrade, writer.uint32(10).fork()).ldelim(); + } + if (message.upgradeSequence !== BigInt(0)) { + writer.uint32(16).uint64(message.upgradeSequence); + } + if (message.result !== 0) { + writer.uint32(24).int32(message.result); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelUpgradeTryResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelUpgradeTryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.upgrade = Upgrade.decode(reader, reader.uint32()); + break; + case 2: + message.upgradeSequence = reader.uint64(); + break; + case 3: + message.result = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgChannelUpgradeTryResponse { + const message = createBaseMsgChannelUpgradeTryResponse(); + message.upgrade = object.upgrade !== undefined && object.upgrade !== null ? Upgrade.fromPartial(object.upgrade) : undefined; + message.upgradeSequence = object.upgradeSequence !== undefined && object.upgradeSequence !== null ? BigInt(object.upgradeSequence.toString()) : BigInt(0); + message.result = object.result ?? 0; + return message; + }, + fromAmino(object: MsgChannelUpgradeTryResponseAmino): MsgChannelUpgradeTryResponse { + const message = createBaseMsgChannelUpgradeTryResponse(); + if (object.upgrade !== undefined && object.upgrade !== null) { + message.upgrade = Upgrade.fromAmino(object.upgrade); + } + if (object.upgrade_sequence !== undefined && object.upgrade_sequence !== null) { + message.upgradeSequence = BigInt(object.upgrade_sequence); + } + if (object.result !== undefined && object.result !== null) { + message.result = object.result; + } + return message; + }, + toAmino(message: MsgChannelUpgradeTryResponse): MsgChannelUpgradeTryResponseAmino { + const obj: any = {}; + obj.upgrade = message.upgrade ? Upgrade.toAmino(message.upgrade) : undefined; + obj.upgrade_sequence = message.upgradeSequence !== BigInt(0) ? message.upgradeSequence?.toString() : undefined; + obj.result = message.result === 0 ? undefined : message.result; + return obj; + }, + fromAminoMsg(object: MsgChannelUpgradeTryResponseAminoMsg): MsgChannelUpgradeTryResponse { + return MsgChannelUpgradeTryResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelUpgradeTryResponse): MsgChannelUpgradeTryResponseAminoMsg { + return { + type: "cosmos-sdk/MsgChannelUpgradeTryResponse", + value: MsgChannelUpgradeTryResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelUpgradeTryResponseProtoMsg): MsgChannelUpgradeTryResponse { + return MsgChannelUpgradeTryResponse.decode(message.value); + }, + toProto(message: MsgChannelUpgradeTryResponse): Uint8Array { + return MsgChannelUpgradeTryResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelUpgradeTryResponse): MsgChannelUpgradeTryResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeTryResponse", + value: MsgChannelUpgradeTryResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgChannelUpgradeTryResponse.typeUrl, MsgChannelUpgradeTryResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgChannelUpgradeTryResponse.aminoType, MsgChannelUpgradeTryResponse.typeUrl); +function createBaseMsgChannelUpgradeAck(): MsgChannelUpgradeAck { + return { + portId: "", + channelId: "", + counterpartyUpgrade: Upgrade.fromPartial({}), + proofChannel: new Uint8Array(), + proofUpgrade: new Uint8Array(), + proofHeight: Height.fromPartial({}), + signer: "" + }; +} +export const MsgChannelUpgradeAck = { + typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeAck", + aminoType: "cosmos-sdk/MsgChannelUpgradeAck", + is(o: any): o is MsgChannelUpgradeAck { + return o && (o.$typeUrl === MsgChannelUpgradeAck.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string" && Upgrade.is(o.counterpartyUpgrade) && (o.proofChannel instanceof Uint8Array || typeof o.proofChannel === "string") && (o.proofUpgrade instanceof Uint8Array || typeof o.proofUpgrade === "string") && Height.is(o.proofHeight) && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgChannelUpgradeAckAmino { + return o && (o.$typeUrl === MsgChannelUpgradeAck.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && Upgrade.isAmino(o.counterparty_upgrade) && (o.proof_channel instanceof Uint8Array || typeof o.proof_channel === "string") && (o.proof_upgrade instanceof Uint8Array || typeof o.proof_upgrade === "string") && Height.isAmino(o.proof_height) && typeof o.signer === "string"); + }, + encode(message: MsgChannelUpgradeAck, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + if (message.counterpartyUpgrade !== undefined) { + Upgrade.encode(message.counterpartyUpgrade, writer.uint32(26).fork()).ldelim(); + } + if (message.proofChannel.length !== 0) { + writer.uint32(34).bytes(message.proofChannel); + } + if (message.proofUpgrade.length !== 0) { + writer.uint32(42).bytes(message.proofUpgrade); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(50).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(58).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelUpgradeAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelUpgradeAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.counterpartyUpgrade = Upgrade.decode(reader, reader.uint32()); + break; + case 4: + message.proofChannel = reader.bytes(); + break; + case 5: + message.proofUpgrade = reader.bytes(); + break; + case 6: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + case 7: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgChannelUpgradeAck { + const message = createBaseMsgChannelUpgradeAck(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.counterpartyUpgrade = object.counterpartyUpgrade !== undefined && object.counterpartyUpgrade !== null ? Upgrade.fromPartial(object.counterpartyUpgrade) : undefined; + message.proofChannel = object.proofChannel ?? new Uint8Array(); + message.proofUpgrade = object.proofUpgrade ?? new Uint8Array(); + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; + message.signer = object.signer ?? ""; + return message; + }, + fromAmino(object: MsgChannelUpgradeAckAmino): MsgChannelUpgradeAck { + const message = createBaseMsgChannelUpgradeAck(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + if (object.counterparty_upgrade !== undefined && object.counterparty_upgrade !== null) { + message.counterpartyUpgrade = Upgrade.fromAmino(object.counterparty_upgrade); + } + if (object.proof_channel !== undefined && object.proof_channel !== null) { + message.proofChannel = bytesFromBase64(object.proof_channel); + } + if (object.proof_upgrade !== undefined && object.proof_upgrade !== null) { + message.proofUpgrade = bytesFromBase64(object.proof_upgrade); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgChannelUpgradeAck): MsgChannelUpgradeAckAmino { + const obj: any = {}; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.counterparty_upgrade = message.counterpartyUpgrade ? Upgrade.toAmino(message.counterpartyUpgrade) : undefined; + obj.proof_channel = message.proofChannel ? base64FromBytes(message.proofChannel) : undefined; + obj.proof_upgrade = message.proofUpgrade ? base64FromBytes(message.proofUpgrade) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + obj.signer = message.signer === "" ? undefined : message.signer; + return obj; + }, + fromAminoMsg(object: MsgChannelUpgradeAckAminoMsg): MsgChannelUpgradeAck { + return MsgChannelUpgradeAck.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelUpgradeAck): MsgChannelUpgradeAckAminoMsg { + return { + type: "cosmos-sdk/MsgChannelUpgradeAck", + value: MsgChannelUpgradeAck.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelUpgradeAckProtoMsg): MsgChannelUpgradeAck { + return MsgChannelUpgradeAck.decode(message.value); + }, + toProto(message: MsgChannelUpgradeAck): Uint8Array { + return MsgChannelUpgradeAck.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelUpgradeAck): MsgChannelUpgradeAckProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeAck", + value: MsgChannelUpgradeAck.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgChannelUpgradeAck.typeUrl, MsgChannelUpgradeAck); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgChannelUpgradeAck.aminoType, MsgChannelUpgradeAck.typeUrl); +function createBaseMsgChannelUpgradeAckResponse(): MsgChannelUpgradeAckResponse { + return { + result: 0 + }; +} +export const MsgChannelUpgradeAckResponse = { + typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeAckResponse", + aminoType: "cosmos-sdk/MsgChannelUpgradeAckResponse", + is(o: any): o is MsgChannelUpgradeAckResponse { + return o && (o.$typeUrl === MsgChannelUpgradeAckResponse.typeUrl || isSet(o.result)); + }, + isAmino(o: any): o is MsgChannelUpgradeAckResponseAmino { + return o && (o.$typeUrl === MsgChannelUpgradeAckResponse.typeUrl || isSet(o.result)); + }, + encode(message: MsgChannelUpgradeAckResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.result !== 0) { + writer.uint32(8).int32(message.result); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelUpgradeAckResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelUpgradeAckResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.result = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgChannelUpgradeAckResponse { + const message = createBaseMsgChannelUpgradeAckResponse(); + message.result = object.result ?? 0; + return message; + }, + fromAmino(object: MsgChannelUpgradeAckResponseAmino): MsgChannelUpgradeAckResponse { + const message = createBaseMsgChannelUpgradeAckResponse(); + if (object.result !== undefined && object.result !== null) { + message.result = object.result; + } + return message; + }, + toAmino(message: MsgChannelUpgradeAckResponse): MsgChannelUpgradeAckResponseAmino { + const obj: any = {}; + obj.result = message.result === 0 ? undefined : message.result; + return obj; + }, + fromAminoMsg(object: MsgChannelUpgradeAckResponseAminoMsg): MsgChannelUpgradeAckResponse { + return MsgChannelUpgradeAckResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelUpgradeAckResponse): MsgChannelUpgradeAckResponseAminoMsg { + return { + type: "cosmos-sdk/MsgChannelUpgradeAckResponse", + value: MsgChannelUpgradeAckResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelUpgradeAckResponseProtoMsg): MsgChannelUpgradeAckResponse { + return MsgChannelUpgradeAckResponse.decode(message.value); + }, + toProto(message: MsgChannelUpgradeAckResponse): Uint8Array { + return MsgChannelUpgradeAckResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelUpgradeAckResponse): MsgChannelUpgradeAckResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeAckResponse", + value: MsgChannelUpgradeAckResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgChannelUpgradeAckResponse.typeUrl, MsgChannelUpgradeAckResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgChannelUpgradeAckResponse.aminoType, MsgChannelUpgradeAckResponse.typeUrl); +function createBaseMsgChannelUpgradeConfirm(): MsgChannelUpgradeConfirm { + return { + portId: "", + channelId: "", + counterpartyChannelState: 0, + counterpartyUpgrade: Upgrade.fromPartial({}), + proofChannel: new Uint8Array(), + proofUpgrade: new Uint8Array(), + proofHeight: Height.fromPartial({}), + signer: "" + }; +} +export const MsgChannelUpgradeConfirm = { + typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeConfirm", + aminoType: "cosmos-sdk/MsgChannelUpgradeConfirm", + is(o: any): o is MsgChannelUpgradeConfirm { + return o && (o.$typeUrl === MsgChannelUpgradeConfirm.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string" && isSet(o.counterpartyChannelState) && Upgrade.is(o.counterpartyUpgrade) && (o.proofChannel instanceof Uint8Array || typeof o.proofChannel === "string") && (o.proofUpgrade instanceof Uint8Array || typeof o.proofUpgrade === "string") && Height.is(o.proofHeight) && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgChannelUpgradeConfirmAmino { + return o && (o.$typeUrl === MsgChannelUpgradeConfirm.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && isSet(o.counterparty_channel_state) && Upgrade.isAmino(o.counterparty_upgrade) && (o.proof_channel instanceof Uint8Array || typeof o.proof_channel === "string") && (o.proof_upgrade instanceof Uint8Array || typeof o.proof_upgrade === "string") && Height.isAmino(o.proof_height) && typeof o.signer === "string"); + }, + encode(message: MsgChannelUpgradeConfirm, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + if (message.counterpartyChannelState !== 0) { + writer.uint32(24).int32(message.counterpartyChannelState); + } + if (message.counterpartyUpgrade !== undefined) { + Upgrade.encode(message.counterpartyUpgrade, writer.uint32(34).fork()).ldelim(); + } + if (message.proofChannel.length !== 0) { + writer.uint32(42).bytes(message.proofChannel); + } + if (message.proofUpgrade.length !== 0) { + writer.uint32(50).bytes(message.proofUpgrade); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(58).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(66).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelUpgradeConfirm { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelUpgradeConfirm(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.counterpartyChannelState = (reader.int32() as any); + break; + case 4: + message.counterpartyUpgrade = Upgrade.decode(reader, reader.uint32()); + break; + case 5: + message.proofChannel = reader.bytes(); + break; + case 6: + message.proofUpgrade = reader.bytes(); + break; + case 7: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + case 8: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgChannelUpgradeConfirm { + const message = createBaseMsgChannelUpgradeConfirm(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.counterpartyChannelState = object.counterpartyChannelState ?? 0; + message.counterpartyUpgrade = object.counterpartyUpgrade !== undefined && object.counterpartyUpgrade !== null ? Upgrade.fromPartial(object.counterpartyUpgrade) : undefined; + message.proofChannel = object.proofChannel ?? new Uint8Array(); + message.proofUpgrade = object.proofUpgrade ?? new Uint8Array(); + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; + message.signer = object.signer ?? ""; + return message; + }, + fromAmino(object: MsgChannelUpgradeConfirmAmino): MsgChannelUpgradeConfirm { + const message = createBaseMsgChannelUpgradeConfirm(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + if (object.counterparty_channel_state !== undefined && object.counterparty_channel_state !== null) { + message.counterpartyChannelState = object.counterparty_channel_state; + } + if (object.counterparty_upgrade !== undefined && object.counterparty_upgrade !== null) { + message.counterpartyUpgrade = Upgrade.fromAmino(object.counterparty_upgrade); + } + if (object.proof_channel !== undefined && object.proof_channel !== null) { + message.proofChannel = bytesFromBase64(object.proof_channel); + } + if (object.proof_upgrade !== undefined && object.proof_upgrade !== null) { + message.proofUpgrade = bytesFromBase64(object.proof_upgrade); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgChannelUpgradeConfirm): MsgChannelUpgradeConfirmAmino { + const obj: any = {}; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.counterparty_channel_state = message.counterpartyChannelState === 0 ? undefined : message.counterpartyChannelState; + obj.counterparty_upgrade = message.counterpartyUpgrade ? Upgrade.toAmino(message.counterpartyUpgrade) : undefined; + obj.proof_channel = message.proofChannel ? base64FromBytes(message.proofChannel) : undefined; + obj.proof_upgrade = message.proofUpgrade ? base64FromBytes(message.proofUpgrade) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + obj.signer = message.signer === "" ? undefined : message.signer; + return obj; + }, + fromAminoMsg(object: MsgChannelUpgradeConfirmAminoMsg): MsgChannelUpgradeConfirm { + return MsgChannelUpgradeConfirm.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelUpgradeConfirm): MsgChannelUpgradeConfirmAminoMsg { + return { + type: "cosmos-sdk/MsgChannelUpgradeConfirm", + value: MsgChannelUpgradeConfirm.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelUpgradeConfirmProtoMsg): MsgChannelUpgradeConfirm { + return MsgChannelUpgradeConfirm.decode(message.value); + }, + toProto(message: MsgChannelUpgradeConfirm): Uint8Array { + return MsgChannelUpgradeConfirm.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelUpgradeConfirm): MsgChannelUpgradeConfirmProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeConfirm", + value: MsgChannelUpgradeConfirm.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgChannelUpgradeConfirm.typeUrl, MsgChannelUpgradeConfirm); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgChannelUpgradeConfirm.aminoType, MsgChannelUpgradeConfirm.typeUrl); +function createBaseMsgChannelUpgradeConfirmResponse(): MsgChannelUpgradeConfirmResponse { + return { + result: 0 + }; +} +export const MsgChannelUpgradeConfirmResponse = { + typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeConfirmResponse", + aminoType: "cosmos-sdk/MsgChannelUpgradeConfirmResponse", + is(o: any): o is MsgChannelUpgradeConfirmResponse { + return o && (o.$typeUrl === MsgChannelUpgradeConfirmResponse.typeUrl || isSet(o.result)); + }, + isAmino(o: any): o is MsgChannelUpgradeConfirmResponseAmino { + return o && (o.$typeUrl === MsgChannelUpgradeConfirmResponse.typeUrl || isSet(o.result)); + }, + encode(message: MsgChannelUpgradeConfirmResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.result !== 0) { + writer.uint32(8).int32(message.result); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelUpgradeConfirmResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelUpgradeConfirmResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.result = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgChannelUpgradeConfirmResponse { + const message = createBaseMsgChannelUpgradeConfirmResponse(); + message.result = object.result ?? 0; + return message; + }, + fromAmino(object: MsgChannelUpgradeConfirmResponseAmino): MsgChannelUpgradeConfirmResponse { + const message = createBaseMsgChannelUpgradeConfirmResponse(); + if (object.result !== undefined && object.result !== null) { + message.result = object.result; + } + return message; + }, + toAmino(message: MsgChannelUpgradeConfirmResponse): MsgChannelUpgradeConfirmResponseAmino { + const obj: any = {}; + obj.result = message.result === 0 ? undefined : message.result; + return obj; + }, + fromAminoMsg(object: MsgChannelUpgradeConfirmResponseAminoMsg): MsgChannelUpgradeConfirmResponse { + return MsgChannelUpgradeConfirmResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelUpgradeConfirmResponse): MsgChannelUpgradeConfirmResponseAminoMsg { + return { + type: "cosmos-sdk/MsgChannelUpgradeConfirmResponse", + value: MsgChannelUpgradeConfirmResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelUpgradeConfirmResponseProtoMsg): MsgChannelUpgradeConfirmResponse { + return MsgChannelUpgradeConfirmResponse.decode(message.value); + }, + toProto(message: MsgChannelUpgradeConfirmResponse): Uint8Array { + return MsgChannelUpgradeConfirmResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelUpgradeConfirmResponse): MsgChannelUpgradeConfirmResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeConfirmResponse", + value: MsgChannelUpgradeConfirmResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgChannelUpgradeConfirmResponse.typeUrl, MsgChannelUpgradeConfirmResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgChannelUpgradeConfirmResponse.aminoType, MsgChannelUpgradeConfirmResponse.typeUrl); +function createBaseMsgChannelUpgradeOpen(): MsgChannelUpgradeOpen { + return { + portId: "", + channelId: "", + counterpartyChannelState: 0, + counterpartyUpgradeSequence: BigInt(0), + proofChannel: new Uint8Array(), + proofHeight: Height.fromPartial({}), + signer: "" + }; +} +export const MsgChannelUpgradeOpen = { + typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeOpen", + aminoType: "cosmos-sdk/MsgChannelUpgradeOpen", + is(o: any): o is MsgChannelUpgradeOpen { + return o && (o.$typeUrl === MsgChannelUpgradeOpen.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string" && isSet(o.counterpartyChannelState) && typeof o.counterpartyUpgradeSequence === "bigint" && (o.proofChannel instanceof Uint8Array || typeof o.proofChannel === "string") && Height.is(o.proofHeight) && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgChannelUpgradeOpenAmino { + return o && (o.$typeUrl === MsgChannelUpgradeOpen.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && isSet(o.counterparty_channel_state) && typeof o.counterparty_upgrade_sequence === "bigint" && (o.proof_channel instanceof Uint8Array || typeof o.proof_channel === "string") && Height.isAmino(o.proof_height) && typeof o.signer === "string"); + }, + encode(message: MsgChannelUpgradeOpen, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + if (message.counterpartyChannelState !== 0) { + writer.uint32(24).int32(message.counterpartyChannelState); + } + if (message.counterpartyUpgradeSequence !== BigInt(0)) { + writer.uint32(32).uint64(message.counterpartyUpgradeSequence); + } + if (message.proofChannel.length !== 0) { + writer.uint32(42).bytes(message.proofChannel); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(50).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(58).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelUpgradeOpen { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelUpgradeOpen(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.counterpartyChannelState = (reader.int32() as any); + break; + case 4: + message.counterpartyUpgradeSequence = reader.uint64(); + break; + case 5: + message.proofChannel = reader.bytes(); + break; + case 6: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + case 7: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgChannelUpgradeOpen { + const message = createBaseMsgChannelUpgradeOpen(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.counterpartyChannelState = object.counterpartyChannelState ?? 0; + message.counterpartyUpgradeSequence = object.counterpartyUpgradeSequence !== undefined && object.counterpartyUpgradeSequence !== null ? BigInt(object.counterpartyUpgradeSequence.toString()) : BigInt(0); + message.proofChannel = object.proofChannel ?? new Uint8Array(); + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; + message.signer = object.signer ?? ""; + return message; + }, + fromAmino(object: MsgChannelUpgradeOpenAmino): MsgChannelUpgradeOpen { + const message = createBaseMsgChannelUpgradeOpen(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + if (object.counterparty_channel_state !== undefined && object.counterparty_channel_state !== null) { + message.counterpartyChannelState = object.counterparty_channel_state; + } + if (object.counterparty_upgrade_sequence !== undefined && object.counterparty_upgrade_sequence !== null) { + message.counterpartyUpgradeSequence = BigInt(object.counterparty_upgrade_sequence); + } + if (object.proof_channel !== undefined && object.proof_channel !== null) { + message.proofChannel = bytesFromBase64(object.proof_channel); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgChannelUpgradeOpen): MsgChannelUpgradeOpenAmino { + const obj: any = {}; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.counterparty_channel_state = message.counterpartyChannelState === 0 ? undefined : message.counterpartyChannelState; + obj.counterparty_upgrade_sequence = message.counterpartyUpgradeSequence !== BigInt(0) ? message.counterpartyUpgradeSequence?.toString() : undefined; + obj.proof_channel = message.proofChannel ? base64FromBytes(message.proofChannel) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + obj.signer = message.signer === "" ? undefined : message.signer; + return obj; + }, + fromAminoMsg(object: MsgChannelUpgradeOpenAminoMsg): MsgChannelUpgradeOpen { + return MsgChannelUpgradeOpen.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelUpgradeOpen): MsgChannelUpgradeOpenAminoMsg { + return { + type: "cosmos-sdk/MsgChannelUpgradeOpen", + value: MsgChannelUpgradeOpen.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelUpgradeOpenProtoMsg): MsgChannelUpgradeOpen { + return MsgChannelUpgradeOpen.decode(message.value); + }, + toProto(message: MsgChannelUpgradeOpen): Uint8Array { + return MsgChannelUpgradeOpen.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelUpgradeOpen): MsgChannelUpgradeOpenProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeOpen", + value: MsgChannelUpgradeOpen.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgChannelUpgradeOpen.typeUrl, MsgChannelUpgradeOpen); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgChannelUpgradeOpen.aminoType, MsgChannelUpgradeOpen.typeUrl); +function createBaseMsgChannelUpgradeOpenResponse(): MsgChannelUpgradeOpenResponse { + return {}; +} +export const MsgChannelUpgradeOpenResponse = { + typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeOpenResponse", + aminoType: "cosmos-sdk/MsgChannelUpgradeOpenResponse", + is(o: any): o is MsgChannelUpgradeOpenResponse { + return o && o.$typeUrl === MsgChannelUpgradeOpenResponse.typeUrl; + }, + isAmino(o: any): o is MsgChannelUpgradeOpenResponseAmino { + return o && o.$typeUrl === MsgChannelUpgradeOpenResponse.typeUrl; + }, + encode(_: MsgChannelUpgradeOpenResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelUpgradeOpenResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelUpgradeOpenResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgChannelUpgradeOpenResponse { + const message = createBaseMsgChannelUpgradeOpenResponse(); + return message; + }, + fromAmino(_: MsgChannelUpgradeOpenResponseAmino): MsgChannelUpgradeOpenResponse { + const message = createBaseMsgChannelUpgradeOpenResponse(); + return message; + }, + toAmino(_: MsgChannelUpgradeOpenResponse): MsgChannelUpgradeOpenResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgChannelUpgradeOpenResponseAminoMsg): MsgChannelUpgradeOpenResponse { + return MsgChannelUpgradeOpenResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelUpgradeOpenResponse): MsgChannelUpgradeOpenResponseAminoMsg { + return { + type: "cosmos-sdk/MsgChannelUpgradeOpenResponse", + value: MsgChannelUpgradeOpenResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelUpgradeOpenResponseProtoMsg): MsgChannelUpgradeOpenResponse { + return MsgChannelUpgradeOpenResponse.decode(message.value); + }, + toProto(message: MsgChannelUpgradeOpenResponse): Uint8Array { + return MsgChannelUpgradeOpenResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelUpgradeOpenResponse): MsgChannelUpgradeOpenResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeOpenResponse", + value: MsgChannelUpgradeOpenResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgChannelUpgradeOpenResponse.typeUrl, MsgChannelUpgradeOpenResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgChannelUpgradeOpenResponse.aminoType, MsgChannelUpgradeOpenResponse.typeUrl); +function createBaseMsgChannelUpgradeTimeout(): MsgChannelUpgradeTimeout { + return { + portId: "", + channelId: "", + counterpartyChannel: Channel.fromPartial({}), + proofChannel: new Uint8Array(), + proofHeight: Height.fromPartial({}), + signer: "" + }; +} +export const MsgChannelUpgradeTimeout = { + typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeTimeout", + aminoType: "cosmos-sdk/MsgChannelUpgradeTimeout", + is(o: any): o is MsgChannelUpgradeTimeout { + return o && (o.$typeUrl === MsgChannelUpgradeTimeout.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string" && Channel.is(o.counterpartyChannel) && (o.proofChannel instanceof Uint8Array || typeof o.proofChannel === "string") && Height.is(o.proofHeight) && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgChannelUpgradeTimeoutAmino { + return o && (o.$typeUrl === MsgChannelUpgradeTimeout.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && Channel.isAmino(o.counterparty_channel) && (o.proof_channel instanceof Uint8Array || typeof o.proof_channel === "string") && Height.isAmino(o.proof_height) && typeof o.signer === "string"); + }, + encode(message: MsgChannelUpgradeTimeout, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + if (message.counterpartyChannel !== undefined) { + Channel.encode(message.counterpartyChannel, writer.uint32(26).fork()).ldelim(); + } + if (message.proofChannel.length !== 0) { + writer.uint32(34).bytes(message.proofChannel); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(42).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(50).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelUpgradeTimeout { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelUpgradeTimeout(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.counterpartyChannel = Channel.decode(reader, reader.uint32()); + break; + case 4: + message.proofChannel = reader.bytes(); + break; + case 5: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + case 6: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgChannelUpgradeTimeout { + const message = createBaseMsgChannelUpgradeTimeout(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.counterpartyChannel = object.counterpartyChannel !== undefined && object.counterpartyChannel !== null ? Channel.fromPartial(object.counterpartyChannel) : undefined; + message.proofChannel = object.proofChannel ?? new Uint8Array(); + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; + message.signer = object.signer ?? ""; + return message; + }, + fromAmino(object: MsgChannelUpgradeTimeoutAmino): MsgChannelUpgradeTimeout { + const message = createBaseMsgChannelUpgradeTimeout(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + if (object.counterparty_channel !== undefined && object.counterparty_channel !== null) { + message.counterpartyChannel = Channel.fromAmino(object.counterparty_channel); + } + if (object.proof_channel !== undefined && object.proof_channel !== null) { + message.proofChannel = bytesFromBase64(object.proof_channel); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgChannelUpgradeTimeout): MsgChannelUpgradeTimeoutAmino { + const obj: any = {}; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.counterparty_channel = message.counterpartyChannel ? Channel.toAmino(message.counterpartyChannel) : undefined; + obj.proof_channel = message.proofChannel ? base64FromBytes(message.proofChannel) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + obj.signer = message.signer === "" ? undefined : message.signer; + return obj; + }, + fromAminoMsg(object: MsgChannelUpgradeTimeoutAminoMsg): MsgChannelUpgradeTimeout { + return MsgChannelUpgradeTimeout.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelUpgradeTimeout): MsgChannelUpgradeTimeoutAminoMsg { + return { + type: "cosmos-sdk/MsgChannelUpgradeTimeout", + value: MsgChannelUpgradeTimeout.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelUpgradeTimeoutProtoMsg): MsgChannelUpgradeTimeout { + return MsgChannelUpgradeTimeout.decode(message.value); + }, + toProto(message: MsgChannelUpgradeTimeout): Uint8Array { + return MsgChannelUpgradeTimeout.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelUpgradeTimeout): MsgChannelUpgradeTimeoutProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeTimeout", + value: MsgChannelUpgradeTimeout.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgChannelUpgradeTimeout.typeUrl, MsgChannelUpgradeTimeout); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgChannelUpgradeTimeout.aminoType, MsgChannelUpgradeTimeout.typeUrl); +function createBaseMsgChannelUpgradeTimeoutResponse(): MsgChannelUpgradeTimeoutResponse { + return {}; +} +export const MsgChannelUpgradeTimeoutResponse = { + typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeTimeoutResponse", + aminoType: "cosmos-sdk/MsgChannelUpgradeTimeoutResponse", + is(o: any): o is MsgChannelUpgradeTimeoutResponse { + return o && o.$typeUrl === MsgChannelUpgradeTimeoutResponse.typeUrl; + }, + isAmino(o: any): o is MsgChannelUpgradeTimeoutResponseAmino { + return o && o.$typeUrl === MsgChannelUpgradeTimeoutResponse.typeUrl; + }, + encode(_: MsgChannelUpgradeTimeoutResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelUpgradeTimeoutResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelUpgradeTimeoutResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgChannelUpgradeTimeoutResponse { + const message = createBaseMsgChannelUpgradeTimeoutResponse(); + return message; + }, + fromAmino(_: MsgChannelUpgradeTimeoutResponseAmino): MsgChannelUpgradeTimeoutResponse { + const message = createBaseMsgChannelUpgradeTimeoutResponse(); + return message; + }, + toAmino(_: MsgChannelUpgradeTimeoutResponse): MsgChannelUpgradeTimeoutResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgChannelUpgradeTimeoutResponseAminoMsg): MsgChannelUpgradeTimeoutResponse { + return MsgChannelUpgradeTimeoutResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelUpgradeTimeoutResponse): MsgChannelUpgradeTimeoutResponseAminoMsg { + return { + type: "cosmos-sdk/MsgChannelUpgradeTimeoutResponse", + value: MsgChannelUpgradeTimeoutResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelUpgradeTimeoutResponseProtoMsg): MsgChannelUpgradeTimeoutResponse { + return MsgChannelUpgradeTimeoutResponse.decode(message.value); + }, + toProto(message: MsgChannelUpgradeTimeoutResponse): Uint8Array { + return MsgChannelUpgradeTimeoutResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelUpgradeTimeoutResponse): MsgChannelUpgradeTimeoutResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeTimeoutResponse", + value: MsgChannelUpgradeTimeoutResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgChannelUpgradeTimeoutResponse.typeUrl, MsgChannelUpgradeTimeoutResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgChannelUpgradeTimeoutResponse.aminoType, MsgChannelUpgradeTimeoutResponse.typeUrl); +function createBaseMsgChannelUpgradeCancel(): MsgChannelUpgradeCancel { + return { + portId: "", + channelId: "", + errorReceipt: ErrorReceipt.fromPartial({}), + proofErrorReceipt: new Uint8Array(), + proofHeight: Height.fromPartial({}), + signer: "" + }; +} +export const MsgChannelUpgradeCancel = { + typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeCancel", + aminoType: "cosmos-sdk/MsgChannelUpgradeCancel", + is(o: any): o is MsgChannelUpgradeCancel { + return o && (o.$typeUrl === MsgChannelUpgradeCancel.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string" && ErrorReceipt.is(o.errorReceipt) && (o.proofErrorReceipt instanceof Uint8Array || typeof o.proofErrorReceipt === "string") && Height.is(o.proofHeight) && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgChannelUpgradeCancelAmino { + return o && (o.$typeUrl === MsgChannelUpgradeCancel.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && ErrorReceipt.isAmino(o.error_receipt) && (o.proof_error_receipt instanceof Uint8Array || typeof o.proof_error_receipt === "string") && Height.isAmino(o.proof_height) && typeof o.signer === "string"); + }, + encode(message: MsgChannelUpgradeCancel, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + if (message.errorReceipt !== undefined) { + ErrorReceipt.encode(message.errorReceipt, writer.uint32(26).fork()).ldelim(); + } + if (message.proofErrorReceipt.length !== 0) { + writer.uint32(34).bytes(message.proofErrorReceipt); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(42).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(50).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelUpgradeCancel { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelUpgradeCancel(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.errorReceipt = ErrorReceipt.decode(reader, reader.uint32()); + break; + case 4: + message.proofErrorReceipt = reader.bytes(); + break; + case 5: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + case 6: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgChannelUpgradeCancel { + const message = createBaseMsgChannelUpgradeCancel(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.errorReceipt = object.errorReceipt !== undefined && object.errorReceipt !== null ? ErrorReceipt.fromPartial(object.errorReceipt) : undefined; + message.proofErrorReceipt = object.proofErrorReceipt ?? new Uint8Array(); + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; + message.signer = object.signer ?? ""; + return message; + }, + fromAmino(object: MsgChannelUpgradeCancelAmino): MsgChannelUpgradeCancel { + const message = createBaseMsgChannelUpgradeCancel(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + if (object.error_receipt !== undefined && object.error_receipt !== null) { + message.errorReceipt = ErrorReceipt.fromAmino(object.error_receipt); + } + if (object.proof_error_receipt !== undefined && object.proof_error_receipt !== null) { + message.proofErrorReceipt = bytesFromBase64(object.proof_error_receipt); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgChannelUpgradeCancel): MsgChannelUpgradeCancelAmino { + const obj: any = {}; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.error_receipt = message.errorReceipt ? ErrorReceipt.toAmino(message.errorReceipt) : undefined; + obj.proof_error_receipt = message.proofErrorReceipt ? base64FromBytes(message.proofErrorReceipt) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + obj.signer = message.signer === "" ? undefined : message.signer; + return obj; + }, + fromAminoMsg(object: MsgChannelUpgradeCancelAminoMsg): MsgChannelUpgradeCancel { + return MsgChannelUpgradeCancel.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelUpgradeCancel): MsgChannelUpgradeCancelAminoMsg { + return { + type: "cosmos-sdk/MsgChannelUpgradeCancel", + value: MsgChannelUpgradeCancel.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelUpgradeCancelProtoMsg): MsgChannelUpgradeCancel { + return MsgChannelUpgradeCancel.decode(message.value); + }, + toProto(message: MsgChannelUpgradeCancel): Uint8Array { + return MsgChannelUpgradeCancel.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelUpgradeCancel): MsgChannelUpgradeCancelProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeCancel", + value: MsgChannelUpgradeCancel.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgChannelUpgradeCancel.typeUrl, MsgChannelUpgradeCancel); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgChannelUpgradeCancel.aminoType, MsgChannelUpgradeCancel.typeUrl); +function createBaseMsgChannelUpgradeCancelResponse(): MsgChannelUpgradeCancelResponse { + return {}; +} +export const MsgChannelUpgradeCancelResponse = { + typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeCancelResponse", + aminoType: "cosmos-sdk/MsgChannelUpgradeCancelResponse", + is(o: any): o is MsgChannelUpgradeCancelResponse { + return o && o.$typeUrl === MsgChannelUpgradeCancelResponse.typeUrl; + }, + isAmino(o: any): o is MsgChannelUpgradeCancelResponseAmino { + return o && o.$typeUrl === MsgChannelUpgradeCancelResponse.typeUrl; + }, + encode(_: MsgChannelUpgradeCancelResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgChannelUpgradeCancelResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgChannelUpgradeCancelResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgChannelUpgradeCancelResponse { + const message = createBaseMsgChannelUpgradeCancelResponse(); + return message; + }, + fromAmino(_: MsgChannelUpgradeCancelResponseAmino): MsgChannelUpgradeCancelResponse { + const message = createBaseMsgChannelUpgradeCancelResponse(); + return message; + }, + toAmino(_: MsgChannelUpgradeCancelResponse): MsgChannelUpgradeCancelResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgChannelUpgradeCancelResponseAminoMsg): MsgChannelUpgradeCancelResponse { + return MsgChannelUpgradeCancelResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgChannelUpgradeCancelResponse): MsgChannelUpgradeCancelResponseAminoMsg { + return { + type: "cosmos-sdk/MsgChannelUpgradeCancelResponse", + value: MsgChannelUpgradeCancelResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgChannelUpgradeCancelResponseProtoMsg): MsgChannelUpgradeCancelResponse { + return MsgChannelUpgradeCancelResponse.decode(message.value); + }, + toProto(message: MsgChannelUpgradeCancelResponse): Uint8Array { + return MsgChannelUpgradeCancelResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgChannelUpgradeCancelResponse): MsgChannelUpgradeCancelResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgChannelUpgradeCancelResponse", + value: MsgChannelUpgradeCancelResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgChannelUpgradeCancelResponse.typeUrl, MsgChannelUpgradeCancelResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgChannelUpgradeCancelResponse.aminoType, MsgChannelUpgradeCancelResponse.typeUrl); +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { + authority: "", + params: Params.fromPartial({}) + }; +} +export const MsgUpdateParams = { + typeUrl: "/ibc.core.channel.v1.MsgUpdateParams", + aminoType: "cosmos-sdk/MsgUpdateParams", + is(o: any): o is MsgUpdateParams { + return o && (o.$typeUrl === MsgUpdateParams.typeUrl || typeof o.authority === "string" && Params.is(o.params)); + }, + isAmino(o: any): o is MsgUpdateParamsAmino { + return o && (o.$typeUrl === MsgUpdateParams.typeUrl || typeof o.authority === "string" && Params.isAmino(o.params)); + }, + encode(message: MsgUpdateParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.authority !== "") { + writer.uint32(10).string(message.authority); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.authority = reader.string(); + break; + case 2: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + message.authority = object.authority ?? ""; + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: MsgUpdateParamsAmino): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + if (object.authority !== undefined && object.authority !== null) { + message.authority = object.authority; + } + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: MsgUpdateParams): MsgUpdateParamsAmino { + const obj: any = {}; + obj.authority = message.authority === "" ? undefined : message.authority; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsAminoMsg): MsgUpdateParams { + return MsgUpdateParams.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParams): MsgUpdateParamsAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateParams", + value: MsgUpdateParams.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsProtoMsg): MsgUpdateParams { + return MsgUpdateParams.decode(message.value); + }, + toProto(message: MsgUpdateParams): Uint8Array { + return MsgUpdateParams.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParams): MsgUpdateParamsProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgUpdateParams", + value: MsgUpdateParams.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgUpdateParams.typeUrl, MsgUpdateParams); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgUpdateParams.aminoType, MsgUpdateParams.typeUrl); +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} +export const MsgUpdateParamsResponse = { + typeUrl: "/ibc.core.channel.v1.MsgUpdateParamsResponse", + aminoType: "cosmos-sdk/MsgUpdateParamsResponse", + is(o: any): o is MsgUpdateParamsResponse { + return o && o.$typeUrl === MsgUpdateParamsResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateParamsResponseAmino { + return o && o.$typeUrl === MsgUpdateParamsResponse.typeUrl; + }, + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + fromAmino(_: MsgUpdateParamsResponseAmino): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + toAmino(_: MsgUpdateParamsResponse): MsgUpdateParamsResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsResponseAminoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsResponseProtoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.decode(message.value); + }, + toProto(message: MsgUpdateParamsResponse): Uint8Array { + return MsgUpdateParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgUpdateParamsResponse.typeUrl, MsgUpdateParamsResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgUpdateParamsResponse.aminoType, MsgUpdateParamsResponse.typeUrl); +function createBaseMsgPruneAcknowledgements(): MsgPruneAcknowledgements { + return { + portId: "", + channelId: "", + limit: BigInt(0), + signer: "" + }; +} +export const MsgPruneAcknowledgements = { + typeUrl: "/ibc.core.channel.v1.MsgPruneAcknowledgements", + aminoType: "cosmos-sdk/MsgPruneAcknowledgements", + is(o: any): o is MsgPruneAcknowledgements { + return o && (o.$typeUrl === MsgPruneAcknowledgements.typeUrl || typeof o.portId === "string" && typeof o.channelId === "string" && typeof o.limit === "bigint" && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgPruneAcknowledgementsAmino { + return o && (o.$typeUrl === MsgPruneAcknowledgements.typeUrl || typeof o.port_id === "string" && typeof o.channel_id === "string" && typeof o.limit === "bigint" && typeof o.signer === "string"); + }, + encode(message: MsgPruneAcknowledgements, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.portId !== "") { + writer.uint32(10).string(message.portId); + } + if (message.channelId !== "") { + writer.uint32(18).string(message.channelId); + } + if (message.limit !== BigInt(0)) { + writer.uint32(24).uint64(message.limit); + } + if (message.signer !== "") { + writer.uint32(34).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgPruneAcknowledgements { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgPruneAcknowledgements(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.portId = reader.string(); + break; + case 2: + message.channelId = reader.string(); + break; + case 3: + message.limit = reader.uint64(); + break; + case 4: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgPruneAcknowledgements { + const message = createBaseMsgPruneAcknowledgements(); + message.portId = object.portId ?? ""; + message.channelId = object.channelId ?? ""; + message.limit = object.limit !== undefined && object.limit !== null ? BigInt(object.limit.toString()) : BigInt(0); + message.signer = object.signer ?? ""; + return message; + }, + fromAmino(object: MsgPruneAcknowledgementsAmino): MsgPruneAcknowledgements { + const message = createBaseMsgPruneAcknowledgements(); + if (object.port_id !== undefined && object.port_id !== null) { + message.portId = object.port_id; + } + if (object.channel_id !== undefined && object.channel_id !== null) { + message.channelId = object.channel_id; + } + if (object.limit !== undefined && object.limit !== null) { + message.limit = BigInt(object.limit); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgPruneAcknowledgements): MsgPruneAcknowledgementsAmino { + const obj: any = {}; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.limit = message.limit !== BigInt(0) ? message.limit?.toString() : undefined; + obj.signer = message.signer === "" ? undefined : message.signer; + return obj; + }, + fromAminoMsg(object: MsgPruneAcknowledgementsAminoMsg): MsgPruneAcknowledgements { + return MsgPruneAcknowledgements.fromAmino(object.value); + }, + toAminoMsg(message: MsgPruneAcknowledgements): MsgPruneAcknowledgementsAminoMsg { + return { + type: "cosmos-sdk/MsgPruneAcknowledgements", + value: MsgPruneAcknowledgements.toAmino(message) + }; + }, + fromProtoMsg(message: MsgPruneAcknowledgementsProtoMsg): MsgPruneAcknowledgements { + return MsgPruneAcknowledgements.decode(message.value); + }, + toProto(message: MsgPruneAcknowledgements): Uint8Array { + return MsgPruneAcknowledgements.encode(message).finish(); + }, + toProtoMsg(message: MsgPruneAcknowledgements): MsgPruneAcknowledgementsProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgPruneAcknowledgements", + value: MsgPruneAcknowledgements.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgPruneAcknowledgements.typeUrl, MsgPruneAcknowledgements); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgPruneAcknowledgements.aminoType, MsgPruneAcknowledgements.typeUrl); +function createBaseMsgPruneAcknowledgementsResponse(): MsgPruneAcknowledgementsResponse { + return { + totalPrunedSequences: BigInt(0), + totalRemainingSequences: BigInt(0) + }; +} +export const MsgPruneAcknowledgementsResponse = { + typeUrl: "/ibc.core.channel.v1.MsgPruneAcknowledgementsResponse", + aminoType: "cosmos-sdk/MsgPruneAcknowledgementsResponse", + is(o: any): o is MsgPruneAcknowledgementsResponse { + return o && (o.$typeUrl === MsgPruneAcknowledgementsResponse.typeUrl || typeof o.totalPrunedSequences === "bigint" && typeof o.totalRemainingSequences === "bigint"); + }, + isAmino(o: any): o is MsgPruneAcknowledgementsResponseAmino { + return o && (o.$typeUrl === MsgPruneAcknowledgementsResponse.typeUrl || typeof o.total_pruned_sequences === "bigint" && typeof o.total_remaining_sequences === "bigint"); + }, + encode(message: MsgPruneAcknowledgementsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.totalPrunedSequences !== BigInt(0)) { + writer.uint32(8).uint64(message.totalPrunedSequences); + } + if (message.totalRemainingSequences !== BigInt(0)) { + writer.uint32(16).uint64(message.totalRemainingSequences); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgPruneAcknowledgementsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgPruneAcknowledgementsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.totalPrunedSequences = reader.uint64(); + break; + case 2: + message.totalRemainingSequences = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgPruneAcknowledgementsResponse { + const message = createBaseMsgPruneAcknowledgementsResponse(); + message.totalPrunedSequences = object.totalPrunedSequences !== undefined && object.totalPrunedSequences !== null ? BigInt(object.totalPrunedSequences.toString()) : BigInt(0); + message.totalRemainingSequences = object.totalRemainingSequences !== undefined && object.totalRemainingSequences !== null ? BigInt(object.totalRemainingSequences.toString()) : BigInt(0); + return message; + }, + fromAmino(object: MsgPruneAcknowledgementsResponseAmino): MsgPruneAcknowledgementsResponse { + const message = createBaseMsgPruneAcknowledgementsResponse(); + if (object.total_pruned_sequences !== undefined && object.total_pruned_sequences !== null) { + message.totalPrunedSequences = BigInt(object.total_pruned_sequences); + } + if (object.total_remaining_sequences !== undefined && object.total_remaining_sequences !== null) { + message.totalRemainingSequences = BigInt(object.total_remaining_sequences); + } + return message; + }, + toAmino(message: MsgPruneAcknowledgementsResponse): MsgPruneAcknowledgementsResponseAmino { + const obj: any = {}; + obj.total_pruned_sequences = message.totalPrunedSequences !== BigInt(0) ? message.totalPrunedSequences?.toString() : undefined; + obj.total_remaining_sequences = message.totalRemainingSequences !== BigInt(0) ? message.totalRemainingSequences?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: MsgPruneAcknowledgementsResponseAminoMsg): MsgPruneAcknowledgementsResponse { + return MsgPruneAcknowledgementsResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgPruneAcknowledgementsResponse): MsgPruneAcknowledgementsResponseAminoMsg { + return { + type: "cosmos-sdk/MsgPruneAcknowledgementsResponse", + value: MsgPruneAcknowledgementsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgPruneAcknowledgementsResponseProtoMsg): MsgPruneAcknowledgementsResponse { + return MsgPruneAcknowledgementsResponse.decode(message.value); + }, + toProto(message: MsgPruneAcknowledgementsResponse): Uint8Array { + return MsgPruneAcknowledgementsResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgPruneAcknowledgementsResponse): MsgPruneAcknowledgementsResponseProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.MsgPruneAcknowledgementsResponse", + value: MsgPruneAcknowledgementsResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgPruneAcknowledgementsResponse.typeUrl, MsgPruneAcknowledgementsResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgPruneAcknowledgementsResponse.aminoType, MsgPruneAcknowledgementsResponse.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/ibc/core/channel/v1/upgrade.ts b/libs/interchain-query/src/ibc/core/channel/v1/upgrade.ts new file mode 100644 index 00000000..8ce98e36 --- /dev/null +++ b/libs/interchain-query/src/ibc/core/channel/v1/upgrade.ts @@ -0,0 +1,388 @@ +import { Timeout, TimeoutAmino, Order } from "./channel"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial, isSet } from "../../../../helpers"; +import { GlobalDecoderRegistry } from "../../../../registry"; +/** + * Upgrade is a verifiable type which contains the relevant information + * for an attempted upgrade. It provides the proposed changes to the channel + * end, the timeout for this upgrade attempt and the next packet sequence + * which allows the counterparty to efficiently know the highest sequence it has received. + * The next sequence send is used for pruning and upgrading from unordered to ordered channels. + */ +export interface Upgrade { + fields: UpgradeFields; + timeout: Timeout; + nextSequenceSend: bigint; +} +export interface UpgradeProtoMsg { + typeUrl: "/ibc.core.channel.v1.Upgrade"; + value: Uint8Array; +} +/** + * Upgrade is a verifiable type which contains the relevant information + * for an attempted upgrade. It provides the proposed changes to the channel + * end, the timeout for this upgrade attempt and the next packet sequence + * which allows the counterparty to efficiently know the highest sequence it has received. + * The next sequence send is used for pruning and upgrading from unordered to ordered channels. + */ +export interface UpgradeAmino { + fields: UpgradeFieldsAmino; + timeout: TimeoutAmino; + next_sequence_send: string; +} +export interface UpgradeAminoMsg { + type: "cosmos-sdk/Upgrade"; + value: UpgradeAmino; +} +/** + * UpgradeFields are the fields in a channel end which may be changed + * during a channel upgrade. + */ +export interface UpgradeFields { + ordering: Order; + connectionHops: string[]; + version: string; +} +export interface UpgradeFieldsProtoMsg { + typeUrl: "/ibc.core.channel.v1.UpgradeFields"; + value: Uint8Array; +} +/** + * UpgradeFields are the fields in a channel end which may be changed + * during a channel upgrade. + */ +export interface UpgradeFieldsAmino { + ordering: Order; + connection_hops: string[]; + version: string; +} +export interface UpgradeFieldsAminoMsg { + type: "cosmos-sdk/UpgradeFields"; + value: UpgradeFieldsAmino; +} +/** + * ErrorReceipt defines a type which encapsulates the upgrade sequence and error associated with the + * upgrade handshake failure. When a channel upgrade handshake is aborted both chains are expected to increment to the + * next sequence. + */ +export interface ErrorReceipt { + /** the channel upgrade sequence */ + sequence: bigint; + /** the error message detailing the cause of failure */ + message: string; +} +export interface ErrorReceiptProtoMsg { + typeUrl: "/ibc.core.channel.v1.ErrorReceipt"; + value: Uint8Array; +} +/** + * ErrorReceipt defines a type which encapsulates the upgrade sequence and error associated with the + * upgrade handshake failure. When a channel upgrade handshake is aborted both chains are expected to increment to the + * next sequence. + */ +export interface ErrorReceiptAmino { + /** the channel upgrade sequence */ + sequence: string; + /** the error message detailing the cause of failure */ + message: string; +} +export interface ErrorReceiptAminoMsg { + type: "cosmos-sdk/ErrorReceipt"; + value: ErrorReceiptAmino; +} +function createBaseUpgrade(): Upgrade { + return { + fields: UpgradeFields.fromPartial({}), + timeout: Timeout.fromPartial({}), + nextSequenceSend: BigInt(0) + }; +} +export const Upgrade = { + typeUrl: "/ibc.core.channel.v1.Upgrade", + aminoType: "cosmos-sdk/Upgrade", + is(o: any): o is Upgrade { + return o && (o.$typeUrl === Upgrade.typeUrl || UpgradeFields.is(o.fields) && Timeout.is(o.timeout) && typeof o.nextSequenceSend === "bigint"); + }, + isAmino(o: any): o is UpgradeAmino { + return o && (o.$typeUrl === Upgrade.typeUrl || UpgradeFields.isAmino(o.fields) && Timeout.isAmino(o.timeout) && typeof o.next_sequence_send === "bigint"); + }, + encode(message: Upgrade, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.fields !== undefined) { + UpgradeFields.encode(message.fields, writer.uint32(10).fork()).ldelim(); + } + if (message.timeout !== undefined) { + Timeout.encode(message.timeout, writer.uint32(18).fork()).ldelim(); + } + if (message.nextSequenceSend !== BigInt(0)) { + writer.uint32(24).uint64(message.nextSequenceSend); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Upgrade { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpgrade(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.fields = UpgradeFields.decode(reader, reader.uint32()); + break; + case 2: + message.timeout = Timeout.decode(reader, reader.uint32()); + break; + case 3: + message.nextSequenceSend = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Upgrade { + const message = createBaseUpgrade(); + message.fields = object.fields !== undefined && object.fields !== null ? UpgradeFields.fromPartial(object.fields) : undefined; + message.timeout = object.timeout !== undefined && object.timeout !== null ? Timeout.fromPartial(object.timeout) : undefined; + message.nextSequenceSend = object.nextSequenceSend !== undefined && object.nextSequenceSend !== null ? BigInt(object.nextSequenceSend.toString()) : BigInt(0); + return message; + }, + fromAmino(object: UpgradeAmino): Upgrade { + const message = createBaseUpgrade(); + if (object.fields !== undefined && object.fields !== null) { + message.fields = UpgradeFields.fromAmino(object.fields); + } + if (object.timeout !== undefined && object.timeout !== null) { + message.timeout = Timeout.fromAmino(object.timeout); + } + if (object.next_sequence_send !== undefined && object.next_sequence_send !== null) { + message.nextSequenceSend = BigInt(object.next_sequence_send); + } + return message; + }, + toAmino(message: Upgrade): UpgradeAmino { + const obj: any = {}; + obj.fields = message.fields ? UpgradeFields.toAmino(message.fields) : undefined; + obj.timeout = message.timeout ? Timeout.toAmino(message.timeout) : undefined; + obj.next_sequence_send = message.nextSequenceSend !== BigInt(0) ? message.nextSequenceSend?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: UpgradeAminoMsg): Upgrade { + return Upgrade.fromAmino(object.value); + }, + toAminoMsg(message: Upgrade): UpgradeAminoMsg { + return { + type: "cosmos-sdk/Upgrade", + value: Upgrade.toAmino(message) + }; + }, + fromProtoMsg(message: UpgradeProtoMsg): Upgrade { + return Upgrade.decode(message.value); + }, + toProto(message: Upgrade): Uint8Array { + return Upgrade.encode(message).finish(); + }, + toProtoMsg(message: Upgrade): UpgradeProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.Upgrade", + value: Upgrade.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Upgrade.typeUrl, Upgrade); +GlobalDecoderRegistry.registerAminoProtoMapping(Upgrade.aminoType, Upgrade.typeUrl); +function createBaseUpgradeFields(): UpgradeFields { + return { + ordering: 0, + connectionHops: [], + version: "" + }; +} +export const UpgradeFields = { + typeUrl: "/ibc.core.channel.v1.UpgradeFields", + aminoType: "cosmos-sdk/UpgradeFields", + is(o: any): o is UpgradeFields { + return o && (o.$typeUrl === UpgradeFields.typeUrl || isSet(o.ordering) && Array.isArray(o.connectionHops) && (!o.connectionHops.length || typeof o.connectionHops[0] === "string") && typeof o.version === "string"); + }, + isAmino(o: any): o is UpgradeFieldsAmino { + return o && (o.$typeUrl === UpgradeFields.typeUrl || isSet(o.ordering) && Array.isArray(o.connection_hops) && (!o.connection_hops.length || typeof o.connection_hops[0] === "string") && typeof o.version === "string"); + }, + encode(message: UpgradeFields, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.ordering !== 0) { + writer.uint32(8).int32(message.ordering); + } + for (const v of message.connectionHops) { + writer.uint32(18).string(v!); + } + if (message.version !== "") { + writer.uint32(26).string(message.version); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): UpgradeFields { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpgradeFields(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.ordering = (reader.int32() as any); + break; + case 2: + message.connectionHops.push(reader.string()); + break; + case 3: + message.version = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): UpgradeFields { + const message = createBaseUpgradeFields(); + message.ordering = object.ordering ?? 0; + message.connectionHops = object.connectionHops?.map(e => e) || []; + message.version = object.version ?? ""; + return message; + }, + fromAmino(object: UpgradeFieldsAmino): UpgradeFields { + const message = createBaseUpgradeFields(); + if (object.ordering !== undefined && object.ordering !== null) { + message.ordering = object.ordering; + } + message.connectionHops = object.connection_hops?.map(e => e) || []; + if (object.version !== undefined && object.version !== null) { + message.version = object.version; + } + return message; + }, + toAmino(message: UpgradeFields): UpgradeFieldsAmino { + const obj: any = {}; + obj.ordering = message.ordering === 0 ? undefined : message.ordering; + if (message.connectionHops) { + obj.connection_hops = message.connectionHops.map(e => e); + } else { + obj.connection_hops = message.connectionHops; + } + obj.version = message.version === "" ? undefined : message.version; + return obj; + }, + fromAminoMsg(object: UpgradeFieldsAminoMsg): UpgradeFields { + return UpgradeFields.fromAmino(object.value); + }, + toAminoMsg(message: UpgradeFields): UpgradeFieldsAminoMsg { + return { + type: "cosmos-sdk/UpgradeFields", + value: UpgradeFields.toAmino(message) + }; + }, + fromProtoMsg(message: UpgradeFieldsProtoMsg): UpgradeFields { + return UpgradeFields.decode(message.value); + }, + toProto(message: UpgradeFields): Uint8Array { + return UpgradeFields.encode(message).finish(); + }, + toProtoMsg(message: UpgradeFields): UpgradeFieldsProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.UpgradeFields", + value: UpgradeFields.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(UpgradeFields.typeUrl, UpgradeFields); +GlobalDecoderRegistry.registerAminoProtoMapping(UpgradeFields.aminoType, UpgradeFields.typeUrl); +function createBaseErrorReceipt(): ErrorReceipt { + return { + sequence: BigInt(0), + message: "" + }; +} +export const ErrorReceipt = { + typeUrl: "/ibc.core.channel.v1.ErrorReceipt", + aminoType: "cosmos-sdk/ErrorReceipt", + is(o: any): o is ErrorReceipt { + return o && (o.$typeUrl === ErrorReceipt.typeUrl || typeof o.sequence === "bigint" && typeof o.message === "string"); + }, + isAmino(o: any): o is ErrorReceiptAmino { + return o && (o.$typeUrl === ErrorReceipt.typeUrl || typeof o.sequence === "bigint" && typeof o.message === "string"); + }, + encode(message: ErrorReceipt, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sequence !== BigInt(0)) { + writer.uint32(8).uint64(message.sequence); + } + if (message.message !== "") { + writer.uint32(18).string(message.message); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ErrorReceipt { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseErrorReceipt(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sequence = reader.uint64(); + break; + case 2: + message.message = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ErrorReceipt { + const message = createBaseErrorReceipt(); + message.sequence = object.sequence !== undefined && object.sequence !== null ? BigInt(object.sequence.toString()) : BigInt(0); + message.message = object.message ?? ""; + return message; + }, + fromAmino(object: ErrorReceiptAmino): ErrorReceipt { + const message = createBaseErrorReceipt(); + if (object.sequence !== undefined && object.sequence !== null) { + message.sequence = BigInt(object.sequence); + } + if (object.message !== undefined && object.message !== null) { + message.message = object.message; + } + return message; + }, + toAmino(message: ErrorReceipt): ErrorReceiptAmino { + const obj: any = {}; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence?.toString() : undefined; + obj.message = message.message === "" ? undefined : message.message; + return obj; + }, + fromAminoMsg(object: ErrorReceiptAminoMsg): ErrorReceipt { + return ErrorReceipt.fromAmino(object.value); + }, + toAminoMsg(message: ErrorReceipt): ErrorReceiptAminoMsg { + return { + type: "cosmos-sdk/ErrorReceipt", + value: ErrorReceipt.toAmino(message) + }; + }, + fromProtoMsg(message: ErrorReceiptProtoMsg): ErrorReceipt { + return ErrorReceipt.decode(message.value); + }, + toProto(message: ErrorReceipt): Uint8Array { + return ErrorReceipt.encode(message).finish(); + }, + toProtoMsg(message: ErrorReceipt): ErrorReceiptProtoMsg { + return { + typeUrl: "/ibc.core.channel.v1.ErrorReceipt", + value: ErrorReceipt.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ErrorReceipt.typeUrl, ErrorReceipt); +GlobalDecoderRegistry.registerAminoProtoMapping(ErrorReceipt.aminoType, ErrorReceipt.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/ibc/core/client/v1/client.ts b/libs/interchain-query/src/ibc/core/client/v1/client.ts new file mode 100644 index 00000000..eac32ca4 --- /dev/null +++ b/libs/interchain-query/src/ibc/core/client/v1/client.ts @@ -0,0 +1,927 @@ +import { Any, AnyAmino } from "../../../../google/protobuf/any"; +import { Plan, PlanAmino } from "../../../../cosmos/upgrade/v1beta1/upgrade"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial } from "../../../../helpers"; +import { GlobalDecoderRegistry } from "../../../../registry"; +/** + * IdentifiedClientState defines a client state with an additional client + * identifier field. + */ +export interface IdentifiedClientState { + /** client identifier */ + clientId: string; + /** client state */ + clientState?: Any; +} +export interface IdentifiedClientStateProtoMsg { + typeUrl: "/ibc.core.client.v1.IdentifiedClientState"; + value: Uint8Array; +} +/** + * IdentifiedClientState defines a client state with an additional client + * identifier field. + */ +export interface IdentifiedClientStateAmino { + /** client identifier */ + client_id: string; + /** client state */ + client_state?: AnyAmino; +} +export interface IdentifiedClientStateAminoMsg { + type: "cosmos-sdk/IdentifiedClientState"; + value: IdentifiedClientStateAmino; +} +/** + * ConsensusStateWithHeight defines a consensus state with an additional height + * field. + */ +export interface ConsensusStateWithHeight { + /** consensus state height */ + height: Height; + /** consensus state */ + consensusState?: Any; +} +export interface ConsensusStateWithHeightProtoMsg { + typeUrl: "/ibc.core.client.v1.ConsensusStateWithHeight"; + value: Uint8Array; +} +/** + * ConsensusStateWithHeight defines a consensus state with an additional height + * field. + */ +export interface ConsensusStateWithHeightAmino { + /** consensus state height */ + height: HeightAmino; + /** consensus state */ + consensus_state?: AnyAmino; +} +export interface ConsensusStateWithHeightAminoMsg { + type: "cosmos-sdk/ConsensusStateWithHeight"; + value: ConsensusStateWithHeightAmino; +} +/** + * ClientConsensusStates defines all the stored consensus states for a given + * client. + */ +export interface ClientConsensusStates { + /** client identifier */ + clientId: string; + /** consensus states and their heights associated with the client */ + consensusStates: ConsensusStateWithHeight[]; +} +export interface ClientConsensusStatesProtoMsg { + typeUrl: "/ibc.core.client.v1.ClientConsensusStates"; + value: Uint8Array; +} +/** + * ClientConsensusStates defines all the stored consensus states for a given + * client. + */ +export interface ClientConsensusStatesAmino { + /** client identifier */ + client_id: string; + /** consensus states and their heights associated with the client */ + consensus_states: ConsensusStateWithHeightAmino[]; +} +export interface ClientConsensusStatesAminoMsg { + type: "cosmos-sdk/ClientConsensusStates"; + value: ClientConsensusStatesAmino; +} +/** + * Height is a monotonically increasing data type + * that can be compared against another Height for the purposes of updating and + * freezing clients + * + * Normally the RevisionHeight is incremented at each height while keeping + * RevisionNumber the same. However some consensus algorithms may choose to + * reset the height in certain conditions e.g. hard forks, state-machine + * breaking changes In these cases, the RevisionNumber is incremented so that + * height continues to be monitonically increasing even as the RevisionHeight + * gets reset + */ +export interface Height { + /** the revision that the client is currently on */ + revisionNumber: bigint; + /** the height within the given revision */ + revisionHeight: bigint; +} +export interface HeightProtoMsg { + typeUrl: "/ibc.core.client.v1.Height"; + value: Uint8Array; +} +/** + * Height is a monotonically increasing data type + * that can be compared against another Height for the purposes of updating and + * freezing clients + * + * Normally the RevisionHeight is incremented at each height while keeping + * RevisionNumber the same. However some consensus algorithms may choose to + * reset the height in certain conditions e.g. hard forks, state-machine + * breaking changes In these cases, the RevisionNumber is incremented so that + * height continues to be monitonically increasing even as the RevisionHeight + * gets reset + */ +export interface HeightAmino { + /** the revision that the client is currently on */ + revision_number: string; + /** the height within the given revision */ + revision_height: string; +} +export interface HeightAminoMsg { + type: "cosmos-sdk/Height"; + value: HeightAmino; +} +/** Params defines the set of IBC light client parameters. */ +export interface Params { + /** + * allowed_clients defines the list of allowed client state types which can be created + * and interacted with. If a client type is removed from the allowed clients list, usage + * of this client will be disabled until it is added again to the list. + */ + allowedClients: string[]; +} +export interface ParamsProtoMsg { + typeUrl: "/ibc.core.client.v1.Params"; + value: Uint8Array; +} +/** Params defines the set of IBC light client parameters. */ +export interface ParamsAmino { + /** + * allowed_clients defines the list of allowed client state types which can be created + * and interacted with. If a client type is removed from the allowed clients list, usage + * of this client will be disabled until it is added again to the list. + */ + allowed_clients: string[]; +} +export interface ParamsAminoMsg { + type: "cosmos-sdk/Params"; + value: ParamsAmino; +} +/** + * ClientUpdateProposal is a legacy governance proposal. If it passes, the substitute + * client's latest consensus state is copied over to the subject client. The proposal + * handler may fail if the subject and the substitute do not match in client and + * chain parameters (with exception to latest height, frozen height, and chain-id). + * + * Deprecated: Please use MsgRecoverClient in favour of this message type. + */ +/** @deprecated */ +export interface ClientUpdateProposal { + /** the title of the update proposal */ + title: string; + /** the description of the proposal */ + description: string; + /** the client identifier for the client to be updated if the proposal passes */ + subjectClientId: string; + /** + * the substitute client identifier for the client standing in for the subject + * client + */ + substituteClientId: string; +} +export interface ClientUpdateProposalProtoMsg { + typeUrl: "/ibc.core.client.v1.ClientUpdateProposal"; + value: Uint8Array; +} +/** + * ClientUpdateProposal is a legacy governance proposal. If it passes, the substitute + * client's latest consensus state is copied over to the subject client. The proposal + * handler may fail if the subject and the substitute do not match in client and + * chain parameters (with exception to latest height, frozen height, and chain-id). + * + * Deprecated: Please use MsgRecoverClient in favour of this message type. + */ +/** @deprecated */ +export interface ClientUpdateProposalAmino { + /** the title of the update proposal */ + title: string; + /** the description of the proposal */ + description: string; + /** the client identifier for the client to be updated if the proposal passes */ + subject_client_id: string; + /** + * the substitute client identifier for the client standing in for the subject + * client + */ + substitute_client_id: string; +} +export interface ClientUpdateProposalAminoMsg { + type: "cosmos-sdk/ClientUpdateProposal"; + value: ClientUpdateProposalAmino; +} +/** + * UpgradeProposal is a gov Content type for initiating an IBC breaking + * upgrade. + * + * Deprecated: Please use MsgIBCSoftwareUpgrade in favour of this message type. + */ +/** @deprecated */ +export interface UpgradeProposal { + title: string; + description: string; + plan: Plan; + /** + * An UpgradedClientState must be provided to perform an IBC breaking upgrade. + * This will make the chain commit to the correct upgraded (self) client state + * before the upgrade occurs, so that connecting chains can verify that the + * new upgraded client is valid by verifying a proof on the previous version + * of the chain. This will allow IBC connections to persist smoothly across + * planned chain upgrades + */ + upgradedClientState?: Any; +} +export interface UpgradeProposalProtoMsg { + typeUrl: "/ibc.core.client.v1.UpgradeProposal"; + value: Uint8Array; +} +/** + * UpgradeProposal is a gov Content type for initiating an IBC breaking + * upgrade. + * + * Deprecated: Please use MsgIBCSoftwareUpgrade in favour of this message type. + */ +/** @deprecated */ +export interface UpgradeProposalAmino { + title: string; + description: string; + plan: PlanAmino; + /** + * An UpgradedClientState must be provided to perform an IBC breaking upgrade. + * This will make the chain commit to the correct upgraded (self) client state + * before the upgrade occurs, so that connecting chains can verify that the + * new upgraded client is valid by verifying a proof on the previous version + * of the chain. This will allow IBC connections to persist smoothly across + * planned chain upgrades + */ + upgraded_client_state?: AnyAmino; +} +export interface UpgradeProposalAminoMsg { + type: "cosmos-sdk/UpgradeProposal"; + value: UpgradeProposalAmino; +} +function createBaseIdentifiedClientState(): IdentifiedClientState { + return { + clientId: "", + clientState: undefined + }; +} +export const IdentifiedClientState = { + typeUrl: "/ibc.core.client.v1.IdentifiedClientState", + aminoType: "cosmos-sdk/IdentifiedClientState", + is(o: any): o is IdentifiedClientState { + return o && (o.$typeUrl === IdentifiedClientState.typeUrl || typeof o.clientId === "string"); + }, + isAmino(o: any): o is IdentifiedClientStateAmino { + return o && (o.$typeUrl === IdentifiedClientState.typeUrl || typeof o.client_id === "string"); + }, + encode(message: IdentifiedClientState, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.clientState !== undefined) { + Any.encode(message.clientState, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): IdentifiedClientState { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIdentifiedClientState(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.clientState = Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): IdentifiedClientState { + const message = createBaseIdentifiedClientState(); + message.clientId = object.clientId ?? ""; + message.clientState = object.clientState !== undefined && object.clientState !== null ? Any.fromPartial(object.clientState) : undefined; + return message; + }, + fromAmino(object: IdentifiedClientStateAmino): IdentifiedClientState { + const message = createBaseIdentifiedClientState(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + if (object.client_state !== undefined && object.client_state !== null) { + message.clientState = Any.fromAmino(object.client_state); + } + return message; + }, + toAmino(message: IdentifiedClientState): IdentifiedClientStateAmino { + const obj: any = {}; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; + return obj; + }, + fromAminoMsg(object: IdentifiedClientStateAminoMsg): IdentifiedClientState { + return IdentifiedClientState.fromAmino(object.value); + }, + toAminoMsg(message: IdentifiedClientState): IdentifiedClientStateAminoMsg { + return { + type: "cosmos-sdk/IdentifiedClientState", + value: IdentifiedClientState.toAmino(message) + }; + }, + fromProtoMsg(message: IdentifiedClientStateProtoMsg): IdentifiedClientState { + return IdentifiedClientState.decode(message.value); + }, + toProto(message: IdentifiedClientState): Uint8Array { + return IdentifiedClientState.encode(message).finish(); + }, + toProtoMsg(message: IdentifiedClientState): IdentifiedClientStateProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.IdentifiedClientState", + value: IdentifiedClientState.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(IdentifiedClientState.typeUrl, IdentifiedClientState); +GlobalDecoderRegistry.registerAminoProtoMapping(IdentifiedClientState.aminoType, IdentifiedClientState.typeUrl); +function createBaseConsensusStateWithHeight(): ConsensusStateWithHeight { + return { + height: Height.fromPartial({}), + consensusState: undefined + }; +} +export const ConsensusStateWithHeight = { + typeUrl: "/ibc.core.client.v1.ConsensusStateWithHeight", + aminoType: "cosmos-sdk/ConsensusStateWithHeight", + is(o: any): o is ConsensusStateWithHeight { + return o && (o.$typeUrl === ConsensusStateWithHeight.typeUrl || Height.is(o.height)); + }, + isAmino(o: any): o is ConsensusStateWithHeightAmino { + return o && (o.$typeUrl === ConsensusStateWithHeight.typeUrl || Height.isAmino(o.height)); + }, + encode(message: ConsensusStateWithHeight, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== undefined) { + Height.encode(message.height, writer.uint32(10).fork()).ldelim(); + } + if (message.consensusState !== undefined) { + Any.encode(message.consensusState, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ConsensusStateWithHeight { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConsensusStateWithHeight(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = Height.decode(reader, reader.uint32()); + break; + case 2: + message.consensusState = Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ConsensusStateWithHeight { + const message = createBaseConsensusStateWithHeight(); + message.height = object.height !== undefined && object.height !== null ? Height.fromPartial(object.height) : undefined; + message.consensusState = object.consensusState !== undefined && object.consensusState !== null ? Any.fromPartial(object.consensusState) : undefined; + return message; + }, + fromAmino(object: ConsensusStateWithHeightAmino): ConsensusStateWithHeight { + const message = createBaseConsensusStateWithHeight(); + if (object.height !== undefined && object.height !== null) { + message.height = Height.fromAmino(object.height); + } + if (object.consensus_state !== undefined && object.consensus_state !== null) { + message.consensusState = Any.fromAmino(object.consensus_state); + } + return message; + }, + toAmino(message: ConsensusStateWithHeight): ConsensusStateWithHeightAmino { + const obj: any = {}; + obj.height = message.height ? Height.toAmino(message.height) : undefined; + obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; + return obj; + }, + fromAminoMsg(object: ConsensusStateWithHeightAminoMsg): ConsensusStateWithHeight { + return ConsensusStateWithHeight.fromAmino(object.value); + }, + toAminoMsg(message: ConsensusStateWithHeight): ConsensusStateWithHeightAminoMsg { + return { + type: "cosmos-sdk/ConsensusStateWithHeight", + value: ConsensusStateWithHeight.toAmino(message) + }; + }, + fromProtoMsg(message: ConsensusStateWithHeightProtoMsg): ConsensusStateWithHeight { + return ConsensusStateWithHeight.decode(message.value); + }, + toProto(message: ConsensusStateWithHeight): Uint8Array { + return ConsensusStateWithHeight.encode(message).finish(); + }, + toProtoMsg(message: ConsensusStateWithHeight): ConsensusStateWithHeightProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.ConsensusStateWithHeight", + value: ConsensusStateWithHeight.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ConsensusStateWithHeight.typeUrl, ConsensusStateWithHeight); +GlobalDecoderRegistry.registerAminoProtoMapping(ConsensusStateWithHeight.aminoType, ConsensusStateWithHeight.typeUrl); +function createBaseClientConsensusStates(): ClientConsensusStates { + return { + clientId: "", + consensusStates: [] + }; +} +export const ClientConsensusStates = { + typeUrl: "/ibc.core.client.v1.ClientConsensusStates", + aminoType: "cosmos-sdk/ClientConsensusStates", + is(o: any): o is ClientConsensusStates { + return o && (o.$typeUrl === ClientConsensusStates.typeUrl || typeof o.clientId === "string" && Array.isArray(o.consensusStates) && (!o.consensusStates.length || ConsensusStateWithHeight.is(o.consensusStates[0]))); + }, + isAmino(o: any): o is ClientConsensusStatesAmino { + return o && (o.$typeUrl === ClientConsensusStates.typeUrl || typeof o.client_id === "string" && Array.isArray(o.consensus_states) && (!o.consensus_states.length || ConsensusStateWithHeight.isAmino(o.consensus_states[0]))); + }, + encode(message: ClientConsensusStates, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + for (const v of message.consensusStates) { + ConsensusStateWithHeight.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ClientConsensusStates { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClientConsensusStates(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.consensusStates.push(ConsensusStateWithHeight.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ClientConsensusStates { + const message = createBaseClientConsensusStates(); + message.clientId = object.clientId ?? ""; + message.consensusStates = object.consensusStates?.map(e => ConsensusStateWithHeight.fromPartial(e)) || []; + return message; + }, + fromAmino(object: ClientConsensusStatesAmino): ClientConsensusStates { + const message = createBaseClientConsensusStates(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + message.consensusStates = object.consensus_states?.map(e => ConsensusStateWithHeight.fromAmino(e)) || []; + return message; + }, + toAmino(message: ClientConsensusStates): ClientConsensusStatesAmino { + const obj: any = {}; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + if (message.consensusStates) { + obj.consensus_states = message.consensusStates.map(e => e ? ConsensusStateWithHeight.toAmino(e) : undefined); + } else { + obj.consensus_states = message.consensusStates; + } + return obj; + }, + fromAminoMsg(object: ClientConsensusStatesAminoMsg): ClientConsensusStates { + return ClientConsensusStates.fromAmino(object.value); + }, + toAminoMsg(message: ClientConsensusStates): ClientConsensusStatesAminoMsg { + return { + type: "cosmos-sdk/ClientConsensusStates", + value: ClientConsensusStates.toAmino(message) + }; + }, + fromProtoMsg(message: ClientConsensusStatesProtoMsg): ClientConsensusStates { + return ClientConsensusStates.decode(message.value); + }, + toProto(message: ClientConsensusStates): Uint8Array { + return ClientConsensusStates.encode(message).finish(); + }, + toProtoMsg(message: ClientConsensusStates): ClientConsensusStatesProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.ClientConsensusStates", + value: ClientConsensusStates.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ClientConsensusStates.typeUrl, ClientConsensusStates); +GlobalDecoderRegistry.registerAminoProtoMapping(ClientConsensusStates.aminoType, ClientConsensusStates.typeUrl); +function createBaseHeight(): Height { + return { + revisionNumber: BigInt(0), + revisionHeight: BigInt(0) + }; +} +export const Height = { + typeUrl: "/ibc.core.client.v1.Height", + aminoType: "cosmos-sdk/Height", + is(o: any): o is Height { + return o && (o.$typeUrl === Height.typeUrl || typeof o.revisionNumber === "bigint" && typeof o.revisionHeight === "bigint"); + }, + isAmino(o: any): o is HeightAmino { + return o && (o.$typeUrl === Height.typeUrl || typeof o.revision_number === "bigint" && typeof o.revision_height === "bigint"); + }, + encode(message: Height, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.revisionNumber !== BigInt(0)) { + writer.uint32(8).uint64(message.revisionNumber); + } + if (message.revisionHeight !== BigInt(0)) { + writer.uint32(16).uint64(message.revisionHeight); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Height { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHeight(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.revisionNumber = reader.uint64(); + break; + case 2: + message.revisionHeight = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Height { + const message = createBaseHeight(); + message.revisionNumber = object.revisionNumber !== undefined && object.revisionNumber !== null ? BigInt(object.revisionNumber.toString()) : BigInt(0); + message.revisionHeight = object.revisionHeight !== undefined && object.revisionHeight !== null ? BigInt(object.revisionHeight.toString()) : BigInt(0); + return message; + }, + fromAmino(object: HeightAmino): Height { + return { + revisionNumber: BigInt(object.revision_number || "0"), + revisionHeight: BigInt(object.revision_height || "0") + }; + }, + toAmino(message: Height): HeightAmino { + const obj: any = {}; + obj.revision_number = message.revisionNumber !== BigInt(0) ? message.revisionNumber?.toString() : undefined; + obj.revision_height = message.revisionHeight !== BigInt(0) ? message.revisionHeight?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: HeightAminoMsg): Height { + return Height.fromAmino(object.value); + }, + toAminoMsg(message: Height): HeightAminoMsg { + return { + type: "cosmos-sdk/Height", + value: Height.toAmino(message) + }; + }, + fromProtoMsg(message: HeightProtoMsg): Height { + return Height.decode(message.value); + }, + toProto(message: Height): Uint8Array { + return Height.encode(message).finish(); + }, + toProtoMsg(message: Height): HeightProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.Height", + value: Height.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Height.typeUrl, Height); +GlobalDecoderRegistry.registerAminoProtoMapping(Height.aminoType, Height.typeUrl); +function createBaseParams(): Params { + return { + allowedClients: [] + }; +} +export const Params = { + typeUrl: "/ibc.core.client.v1.Params", + aminoType: "cosmos-sdk/Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || Array.isArray(o.allowedClients) && (!o.allowedClients.length || typeof o.allowedClients[0] === "string")); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || Array.isArray(o.allowed_clients) && (!o.allowed_clients.length || typeof o.allowed_clients[0] === "string")); + }, + encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.allowedClients) { + writer.uint32(10).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.allowedClients.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Params { + const message = createBaseParams(); + message.allowedClients = object.allowedClients?.map(e => e) || []; + return message; + }, + fromAmino(object: ParamsAmino): Params { + const message = createBaseParams(); + message.allowedClients = object.allowed_clients?.map(e => e) || []; + return message; + }, + toAmino(message: Params): ParamsAmino { + const obj: any = {}; + if (message.allowedClients) { + obj.allowed_clients = message.allowedClients.map(e => e); + } else { + obj.allowed_clients = message.allowedClients; + } + return obj; + }, + fromAminoMsg(object: ParamsAminoMsg): Params { + return Params.fromAmino(object.value); + }, + toAminoMsg(message: Params): ParamsAminoMsg { + return { + type: "cosmos-sdk/Params", + value: Params.toAmino(message) + }; + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.Params", + value: Params.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Params.typeUrl, Params); +GlobalDecoderRegistry.registerAminoProtoMapping(Params.aminoType, Params.typeUrl); +function createBaseClientUpdateProposal(): ClientUpdateProposal { + return { + title: "", + description: "", + subjectClientId: "", + substituteClientId: "" + }; +} +export const ClientUpdateProposal = { + typeUrl: "/ibc.core.client.v1.ClientUpdateProposal", + aminoType: "cosmos-sdk/ClientUpdateProposal", + is(o: any): o is ClientUpdateProposal { + return o && (o.$typeUrl === ClientUpdateProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.subjectClientId === "string" && typeof o.substituteClientId === "string"); + }, + isAmino(o: any): o is ClientUpdateProposalAmino { + return o && (o.$typeUrl === ClientUpdateProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && typeof o.subject_client_id === "string" && typeof o.substitute_client_id === "string"); + }, + encode(message: ClientUpdateProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.subjectClientId !== "") { + writer.uint32(26).string(message.subjectClientId); + } + if (message.substituteClientId !== "") { + writer.uint32(34).string(message.substituteClientId); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ClientUpdateProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClientUpdateProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + case 3: + message.subjectClientId = reader.string(); + break; + case 4: + message.substituteClientId = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ClientUpdateProposal { + const message = createBaseClientUpdateProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.subjectClientId = object.subjectClientId ?? ""; + message.substituteClientId = object.substituteClientId ?? ""; + return message; + }, + fromAmino(object: ClientUpdateProposalAmino): ClientUpdateProposal { + const message = createBaseClientUpdateProposal(); + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + if (object.subject_client_id !== undefined && object.subject_client_id !== null) { + message.subjectClientId = object.subject_client_id; + } + if (object.substitute_client_id !== undefined && object.substitute_client_id !== null) { + message.substituteClientId = object.substitute_client_id; + } + return message; + }, + toAmino(message: ClientUpdateProposal): ClientUpdateProposalAmino { + const obj: any = {}; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.subject_client_id = message.subjectClientId === "" ? undefined : message.subjectClientId; + obj.substitute_client_id = message.substituteClientId === "" ? undefined : message.substituteClientId; + return obj; + }, + fromAminoMsg(object: ClientUpdateProposalAminoMsg): ClientUpdateProposal { + return ClientUpdateProposal.fromAmino(object.value); + }, + toAminoMsg(message: ClientUpdateProposal): ClientUpdateProposalAminoMsg { + return { + type: "cosmos-sdk/ClientUpdateProposal", + value: ClientUpdateProposal.toAmino(message) + }; + }, + fromProtoMsg(message: ClientUpdateProposalProtoMsg): ClientUpdateProposal { + return ClientUpdateProposal.decode(message.value); + }, + toProto(message: ClientUpdateProposal): Uint8Array { + return ClientUpdateProposal.encode(message).finish(); + }, + toProtoMsg(message: ClientUpdateProposal): ClientUpdateProposalProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.ClientUpdateProposal", + value: ClientUpdateProposal.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ClientUpdateProposal.typeUrl, ClientUpdateProposal); +GlobalDecoderRegistry.registerAminoProtoMapping(ClientUpdateProposal.aminoType, ClientUpdateProposal.typeUrl); +function createBaseUpgradeProposal(): UpgradeProposal { + return { + title: "", + description: "", + plan: Plan.fromPartial({}), + upgradedClientState: undefined + }; +} +export const UpgradeProposal = { + typeUrl: "/ibc.core.client.v1.UpgradeProposal", + aminoType: "cosmos-sdk/UpgradeProposal", + is(o: any): o is UpgradeProposal { + return o && (o.$typeUrl === UpgradeProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Plan.is(o.plan)); + }, + isAmino(o: any): o is UpgradeProposalAmino { + return o && (o.$typeUrl === UpgradeProposal.typeUrl || typeof o.title === "string" && typeof o.description === "string" && Plan.isAmino(o.plan)); + }, + encode(message: UpgradeProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.title !== "") { + writer.uint32(10).string(message.title); + } + if (message.description !== "") { + writer.uint32(18).string(message.description); + } + if (message.plan !== undefined) { + Plan.encode(message.plan, writer.uint32(26).fork()).ldelim(); + } + if (message.upgradedClientState !== undefined) { + Any.encode(message.upgradedClientState, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): UpgradeProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpgradeProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.title = reader.string(); + break; + case 2: + message.description = reader.string(); + break; + case 3: + message.plan = Plan.decode(reader, reader.uint32()); + break; + case 4: + message.upgradedClientState = Any.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): UpgradeProposal { + const message = createBaseUpgradeProposal(); + message.title = object.title ?? ""; + message.description = object.description ?? ""; + message.plan = object.plan !== undefined && object.plan !== null ? Plan.fromPartial(object.plan) : undefined; + message.upgradedClientState = object.upgradedClientState !== undefined && object.upgradedClientState !== null ? Any.fromPartial(object.upgradedClientState) : undefined; + return message; + }, + fromAmino(object: UpgradeProposalAmino): UpgradeProposal { + const message = createBaseUpgradeProposal(); + if (object.title !== undefined && object.title !== null) { + message.title = object.title; + } + if (object.description !== undefined && object.description !== null) { + message.description = object.description; + } + if (object.plan !== undefined && object.plan !== null) { + message.plan = Plan.fromAmino(object.plan); + } + if (object.upgraded_client_state !== undefined && object.upgraded_client_state !== null) { + message.upgradedClientState = Any.fromAmino(object.upgraded_client_state); + } + return message; + }, + toAmino(message: UpgradeProposal): UpgradeProposalAmino { + const obj: any = {}; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.plan = message.plan ? Plan.toAmino(message.plan) : undefined; + obj.upgraded_client_state = message.upgradedClientState ? Any.toAmino(message.upgradedClientState) : undefined; + return obj; + }, + fromAminoMsg(object: UpgradeProposalAminoMsg): UpgradeProposal { + return UpgradeProposal.fromAmino(object.value); + }, + toAminoMsg(message: UpgradeProposal): UpgradeProposalAminoMsg { + return { + type: "cosmos-sdk/UpgradeProposal", + value: UpgradeProposal.toAmino(message) + }; + }, + fromProtoMsg(message: UpgradeProposalProtoMsg): UpgradeProposal { + return UpgradeProposal.decode(message.value); + }, + toProto(message: UpgradeProposal): Uint8Array { + return UpgradeProposal.encode(message).finish(); + }, + toProtoMsg(message: UpgradeProposal): UpgradeProposalProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.UpgradeProposal", + value: UpgradeProposal.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(UpgradeProposal.typeUrl, UpgradeProposal); +GlobalDecoderRegistry.registerAminoProtoMapping(UpgradeProposal.aminoType, UpgradeProposal.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/ibc/core/client/v1/tx.rpc.func.ts b/libs/interchain-query/src/ibc/core/client/v1/tx.rpc.func.ts new file mode 100644 index 00000000..cf8b181c --- /dev/null +++ b/libs/interchain-query/src/ibc/core/client/v1/tx.rpc.func.ts @@ -0,0 +1,67 @@ +import { buildTx, SigningClientResolver } from "../../../../helper-func-types"; +import { buildUseMutation } from "../../../../react-query"; +import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; +import { MsgCreateClient, MsgUpdateClient, MsgUpgradeClient, MsgSubmitMisbehaviour, MsgRecoverClient, MsgIBCSoftwareUpgrade, MsgUpdateParams } from "./tx"; +export const createCreateClient = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgCreateClient.typeUrl, + encoders: toEncoders(MsgCreateClient), + converters: toConverters(MsgCreateClient) +}); +export const useCreateClient = buildUseMutation({ + builderMutationFn: createCreateClient +}); +export const createUpdateClient = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgUpdateClient.typeUrl, + encoders: toEncoders(MsgUpdateClient), + converters: toConverters(MsgUpdateClient) +}); +export const useUpdateClient = buildUseMutation({ + builderMutationFn: createUpdateClient +}); +export const createUpgradeClient = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgUpgradeClient.typeUrl, + encoders: toEncoders(MsgUpgradeClient), + converters: toConverters(MsgUpgradeClient) +}); +export const useUpgradeClient = buildUseMutation({ + builderMutationFn: createUpgradeClient +}); +export const createSubmitMisbehaviour = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgSubmitMisbehaviour.typeUrl, + encoders: toEncoders(MsgSubmitMisbehaviour), + converters: toConverters(MsgSubmitMisbehaviour) +}); +export const useSubmitMisbehaviour = buildUseMutation({ + builderMutationFn: createSubmitMisbehaviour +}); +export const createRecoverClient = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgRecoverClient.typeUrl, + encoders: toEncoders(MsgRecoverClient), + converters: toConverters(MsgRecoverClient) +}); +export const useRecoverClient = buildUseMutation({ + builderMutationFn: createRecoverClient +}); +export const createIBCSoftwareUpgrade = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgIBCSoftwareUpgrade.typeUrl, + encoders: toEncoders(MsgIBCSoftwareUpgrade), + converters: toConverters(MsgIBCSoftwareUpgrade) +}); +export const useIBCSoftwareUpgrade = buildUseMutation({ + builderMutationFn: createIBCSoftwareUpgrade +}); +export const createUpdateClientParams = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgUpdateParams.typeUrl, + encoders: toEncoders(MsgUpdateParams), + converters: toConverters(MsgUpdateParams) +}); +export const useUpdateClientParams = buildUseMutation({ + builderMutationFn: createUpdateClientParams +}); \ No newline at end of file diff --git a/libs/interchain-query/src/ibc/core/client/v1/tx.ts b/libs/interchain-query/src/ibc/core/client/v1/tx.ts new file mode 100644 index 00000000..de0d64f7 --- /dev/null +++ b/libs/interchain-query/src/ibc/core/client/v1/tx.ts @@ -0,0 +1,1543 @@ +import { Any, AnyAmino } from "../../../../google/protobuf/any"; +import { Plan, PlanAmino } from "../../../../cosmos/upgrade/v1beta1/upgrade"; +import { Params, ParamsAmino } from "./client"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { GlobalDecoderRegistry } from "../../../../registry"; +/** MsgCreateClient defines a message to create an IBC client */ +export interface MsgCreateClient { + /** light client state */ + clientState?: Any; + /** + * consensus state associated with the client that corresponds to a given + * height. + */ + consensusState?: Any; + /** signer address */ + signer: string; +} +export interface MsgCreateClientProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgCreateClient"; + value: Uint8Array; +} +/** MsgCreateClient defines a message to create an IBC client */ +export interface MsgCreateClientAmino { + /** light client state */ + client_state?: AnyAmino; + /** + * consensus state associated with the client that corresponds to a given + * height. + */ + consensus_state?: AnyAmino; + /** signer address */ + signer: string; +} +export interface MsgCreateClientAminoMsg { + type: "cosmos-sdk/MsgCreateClient"; + value: MsgCreateClientAmino; +} +/** MsgCreateClientResponse defines the Msg/CreateClient response type. */ +export interface MsgCreateClientResponse {} +export interface MsgCreateClientResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgCreateClientResponse"; + value: Uint8Array; +} +/** MsgCreateClientResponse defines the Msg/CreateClient response type. */ +export interface MsgCreateClientResponseAmino {} +export interface MsgCreateClientResponseAminoMsg { + type: "cosmos-sdk/MsgCreateClientResponse"; + value: MsgCreateClientResponseAmino; +} +/** + * MsgUpdateClient defines an sdk.Msg to update a IBC client state using + * the given client message. + */ +export interface MsgUpdateClient { + /** client unique identifier */ + clientId: string; + /** client message to update the light client */ + clientMessage?: Any; + /** signer address */ + signer: string; +} +export interface MsgUpdateClientProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgUpdateClient"; + value: Uint8Array; +} +/** + * MsgUpdateClient defines an sdk.Msg to update a IBC client state using + * the given client message. + */ +export interface MsgUpdateClientAmino { + /** client unique identifier */ + client_id: string; + /** client message to update the light client */ + client_message?: AnyAmino; + /** signer address */ + signer: string; +} +export interface MsgUpdateClientAminoMsg { + type: "cosmos-sdk/MsgUpdateClient"; + value: MsgUpdateClientAmino; +} +/** MsgUpdateClientResponse defines the Msg/UpdateClient response type. */ +export interface MsgUpdateClientResponse {} +export interface MsgUpdateClientResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgUpdateClientResponse"; + value: Uint8Array; +} +/** MsgUpdateClientResponse defines the Msg/UpdateClient response type. */ +export interface MsgUpdateClientResponseAmino {} +export interface MsgUpdateClientResponseAminoMsg { + type: "cosmos-sdk/MsgUpdateClientResponse"; + value: MsgUpdateClientResponseAmino; +} +/** + * MsgUpgradeClient defines an sdk.Msg to upgrade an IBC client to a new client + * state + */ +export interface MsgUpgradeClient { + /** client unique identifier */ + clientId: string; + /** upgraded client state */ + clientState?: Any; + /** + * upgraded consensus state, only contains enough information to serve as a + * basis of trust in update logic + */ + consensusState?: Any; + /** proof that old chain committed to new client */ + proofUpgradeClient: Uint8Array; + /** proof that old chain committed to new consensus state */ + proofUpgradeConsensusState: Uint8Array; + /** signer address */ + signer: string; +} +export interface MsgUpgradeClientProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgUpgradeClient"; + value: Uint8Array; +} +/** + * MsgUpgradeClient defines an sdk.Msg to upgrade an IBC client to a new client + * state + */ +export interface MsgUpgradeClientAmino { + /** client unique identifier */ + client_id: string; + /** upgraded client state */ + client_state?: AnyAmino; + /** + * upgraded consensus state, only contains enough information to serve as a + * basis of trust in update logic + */ + consensus_state?: AnyAmino; + /** proof that old chain committed to new client */ + proof_upgrade_client: string; + /** proof that old chain committed to new consensus state */ + proof_upgrade_consensus_state: string; + /** signer address */ + signer: string; +} +export interface MsgUpgradeClientAminoMsg { + type: "cosmos-sdk/MsgUpgradeClient"; + value: MsgUpgradeClientAmino; +} +/** MsgUpgradeClientResponse defines the Msg/UpgradeClient response type. */ +export interface MsgUpgradeClientResponse {} +export interface MsgUpgradeClientResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgUpgradeClientResponse"; + value: Uint8Array; +} +/** MsgUpgradeClientResponse defines the Msg/UpgradeClient response type. */ +export interface MsgUpgradeClientResponseAmino {} +export interface MsgUpgradeClientResponseAminoMsg { + type: "cosmos-sdk/MsgUpgradeClientResponse"; + value: MsgUpgradeClientResponseAmino; +} +/** + * MsgSubmitMisbehaviour defines an sdk.Msg type that submits Evidence for + * light client misbehaviour. + * This message has been deprecated. Use MsgUpdateClient instead. + */ +/** @deprecated */ +export interface MsgSubmitMisbehaviour { + /** client unique identifier */ + clientId: string; + /** misbehaviour used for freezing the light client */ + misbehaviour?: Any; + /** signer address */ + signer: string; +} +export interface MsgSubmitMisbehaviourProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviour"; + value: Uint8Array; +} +/** + * MsgSubmitMisbehaviour defines an sdk.Msg type that submits Evidence for + * light client misbehaviour. + * This message has been deprecated. Use MsgUpdateClient instead. + */ +/** @deprecated */ +export interface MsgSubmitMisbehaviourAmino { + /** client unique identifier */ + client_id: string; + /** misbehaviour used for freezing the light client */ + misbehaviour?: AnyAmino; + /** signer address */ + signer: string; +} +export interface MsgSubmitMisbehaviourAminoMsg { + type: "cosmos-sdk/MsgSubmitMisbehaviour"; + value: MsgSubmitMisbehaviourAmino; +} +/** + * MsgSubmitMisbehaviourResponse defines the Msg/SubmitMisbehaviour response + * type. + */ +export interface MsgSubmitMisbehaviourResponse {} +export interface MsgSubmitMisbehaviourResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviourResponse"; + value: Uint8Array; +} +/** + * MsgSubmitMisbehaviourResponse defines the Msg/SubmitMisbehaviour response + * type. + */ +export interface MsgSubmitMisbehaviourResponseAmino {} +export interface MsgSubmitMisbehaviourResponseAminoMsg { + type: "cosmos-sdk/MsgSubmitMisbehaviourResponse"; + value: MsgSubmitMisbehaviourResponseAmino; +} +/** MsgRecoverClient defines the message used to recover a frozen or expired client. */ +export interface MsgRecoverClient { + /** the client identifier for the client to be updated if the proposal passes */ + subjectClientId: string; + /** + * the substitute client identifier for the client which will replace the subject + * client + */ + substituteClientId: string; + /** signer address */ + signer: string; +} +export interface MsgRecoverClientProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgRecoverClient"; + value: Uint8Array; +} +/** MsgRecoverClient defines the message used to recover a frozen or expired client. */ +export interface MsgRecoverClientAmino { + /** the client identifier for the client to be updated if the proposal passes */ + subject_client_id: string; + /** + * the substitute client identifier for the client which will replace the subject + * client + */ + substitute_client_id: string; + /** signer address */ + signer: string; +} +export interface MsgRecoverClientAminoMsg { + type: "cosmos-sdk/MsgRecoverClient"; + value: MsgRecoverClientAmino; +} +/** MsgRecoverClientResponse defines the Msg/RecoverClient response type. */ +export interface MsgRecoverClientResponse {} +export interface MsgRecoverClientResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgRecoverClientResponse"; + value: Uint8Array; +} +/** MsgRecoverClientResponse defines the Msg/RecoverClient response type. */ +export interface MsgRecoverClientResponseAmino {} +export interface MsgRecoverClientResponseAminoMsg { + type: "cosmos-sdk/MsgRecoverClientResponse"; + value: MsgRecoverClientResponseAmino; +} +/** MsgIBCSoftwareUpgrade defines the message used to schedule an upgrade of an IBC client using a v1 governance proposal */ +export interface MsgIBCSoftwareUpgrade { + plan: Plan; + /** + * An UpgradedClientState must be provided to perform an IBC breaking upgrade. + * This will make the chain commit to the correct upgraded (self) client state + * before the upgrade occurs, so that connecting chains can verify that the + * new upgraded client is valid by verifying a proof on the previous version + * of the chain. This will allow IBC connections to persist smoothly across + * planned chain upgrades. Correspondingly, the UpgradedClientState field has been + * deprecated in the Cosmos SDK to allow for this logic to exist solely in + * the 02-client module. + */ + upgradedClientState?: Any; + /** signer address */ + signer: string; +} +export interface MsgIBCSoftwareUpgradeProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgIBCSoftwareUpgrade"; + value: Uint8Array; +} +/** MsgIBCSoftwareUpgrade defines the message used to schedule an upgrade of an IBC client using a v1 governance proposal */ +export interface MsgIBCSoftwareUpgradeAmino { + plan: PlanAmino; + /** + * An UpgradedClientState must be provided to perform an IBC breaking upgrade. + * This will make the chain commit to the correct upgraded (self) client state + * before the upgrade occurs, so that connecting chains can verify that the + * new upgraded client is valid by verifying a proof on the previous version + * of the chain. This will allow IBC connections to persist smoothly across + * planned chain upgrades. Correspondingly, the UpgradedClientState field has been + * deprecated in the Cosmos SDK to allow for this logic to exist solely in + * the 02-client module. + */ + upgraded_client_state?: AnyAmino; + /** signer address */ + signer: string; +} +export interface MsgIBCSoftwareUpgradeAminoMsg { + type: "cosmos-sdk/MsgIBCSoftwareUpgrade"; + value: MsgIBCSoftwareUpgradeAmino; +} +/** MsgIBCSoftwareUpgradeResponse defines the Msg/IBCSoftwareUpgrade response type. */ +export interface MsgIBCSoftwareUpgradeResponse {} +export interface MsgIBCSoftwareUpgradeResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgIBCSoftwareUpgradeResponse"; + value: Uint8Array; +} +/** MsgIBCSoftwareUpgradeResponse defines the Msg/IBCSoftwareUpgrade response type. */ +export interface MsgIBCSoftwareUpgradeResponseAmino {} +export interface MsgIBCSoftwareUpgradeResponseAminoMsg { + type: "cosmos-sdk/MsgIBCSoftwareUpgradeResponse"; + value: MsgIBCSoftwareUpgradeResponseAmino; +} +/** MsgUpdateParams defines the sdk.Msg type to update the client parameters. */ +export interface MsgUpdateParams { + /** signer address */ + signer: string; + /** + * params defines the client parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params; +} +export interface MsgUpdateParamsProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgUpdateParams"; + value: Uint8Array; +} +/** MsgUpdateParams defines the sdk.Msg type to update the client parameters. */ +export interface MsgUpdateParamsAmino { + /** signer address */ + signer: string; + /** + * params defines the client parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: ParamsAmino; +} +export interface MsgUpdateParamsAminoMsg { + type: "cosmos-sdk/MsgUpdateParams"; + value: MsgUpdateParamsAmino; +} +/** MsgUpdateParamsResponse defines the MsgUpdateParams response type. */ +export interface MsgUpdateParamsResponse {} +export interface MsgUpdateParamsResponseProtoMsg { + typeUrl: "/ibc.core.client.v1.MsgUpdateParamsResponse"; + value: Uint8Array; +} +/** MsgUpdateParamsResponse defines the MsgUpdateParams response type. */ +export interface MsgUpdateParamsResponseAmino {} +export interface MsgUpdateParamsResponseAminoMsg { + type: "cosmos-sdk/MsgUpdateParamsResponse"; + value: MsgUpdateParamsResponseAmino; +} +function createBaseMsgCreateClient(): MsgCreateClient { + return { + clientState: undefined, + consensusState: undefined, + signer: "" + }; +} +export const MsgCreateClient = { + typeUrl: "/ibc.core.client.v1.MsgCreateClient", + aminoType: "cosmos-sdk/MsgCreateClient", + is(o: any): o is MsgCreateClient { + return o && (o.$typeUrl === MsgCreateClient.typeUrl || typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgCreateClientAmino { + return o && (o.$typeUrl === MsgCreateClient.typeUrl || typeof o.signer === "string"); + }, + encode(message: MsgCreateClient, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientState !== undefined) { + Any.encode(message.clientState, writer.uint32(10).fork()).ldelim(); + } + if (message.consensusState !== undefined) { + Any.encode(message.consensusState, writer.uint32(18).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(26).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateClient { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateClient(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientState = Any.decode(reader, reader.uint32()); + break; + case 2: + message.consensusState = Any.decode(reader, reader.uint32()); + break; + case 3: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgCreateClient { + const message = createBaseMsgCreateClient(); + message.clientState = object.clientState !== undefined && object.clientState !== null ? Any.fromPartial(object.clientState) : undefined; + message.consensusState = object.consensusState !== undefined && object.consensusState !== null ? Any.fromPartial(object.consensusState) : undefined; + message.signer = object.signer ?? ""; + return message; + }, + fromAmino(object: MsgCreateClientAmino): MsgCreateClient { + const message = createBaseMsgCreateClient(); + if (object.client_state !== undefined && object.client_state !== null) { + message.clientState = Any.fromAmino(object.client_state); + } + if (object.consensus_state !== undefined && object.consensus_state !== null) { + message.consensusState = Any.fromAmino(object.consensus_state); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgCreateClient): MsgCreateClientAmino { + const obj: any = {}; + obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; + obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; + obj.signer = message.signer === "" ? undefined : message.signer; + return obj; + }, + fromAminoMsg(object: MsgCreateClientAminoMsg): MsgCreateClient { + return MsgCreateClient.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreateClient): MsgCreateClientAminoMsg { + return { + type: "cosmos-sdk/MsgCreateClient", + value: MsgCreateClient.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreateClientProtoMsg): MsgCreateClient { + return MsgCreateClient.decode(message.value); + }, + toProto(message: MsgCreateClient): Uint8Array { + return MsgCreateClient.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateClient): MsgCreateClientProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.MsgCreateClient", + value: MsgCreateClient.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgCreateClient.typeUrl, MsgCreateClient); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgCreateClient.aminoType, MsgCreateClient.typeUrl); +function createBaseMsgCreateClientResponse(): MsgCreateClientResponse { + return {}; +} +export const MsgCreateClientResponse = { + typeUrl: "/ibc.core.client.v1.MsgCreateClientResponse", + aminoType: "cosmos-sdk/MsgCreateClientResponse", + is(o: any): o is MsgCreateClientResponse { + return o && o.$typeUrl === MsgCreateClientResponse.typeUrl; + }, + isAmino(o: any): o is MsgCreateClientResponseAmino { + return o && o.$typeUrl === MsgCreateClientResponse.typeUrl; + }, + encode(_: MsgCreateClientResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgCreateClientResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgCreateClientResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgCreateClientResponse { + const message = createBaseMsgCreateClientResponse(); + return message; + }, + fromAmino(_: MsgCreateClientResponseAmino): MsgCreateClientResponse { + const message = createBaseMsgCreateClientResponse(); + return message; + }, + toAmino(_: MsgCreateClientResponse): MsgCreateClientResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgCreateClientResponseAminoMsg): MsgCreateClientResponse { + return MsgCreateClientResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgCreateClientResponse): MsgCreateClientResponseAminoMsg { + return { + type: "cosmos-sdk/MsgCreateClientResponse", + value: MsgCreateClientResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgCreateClientResponseProtoMsg): MsgCreateClientResponse { + return MsgCreateClientResponse.decode(message.value); + }, + toProto(message: MsgCreateClientResponse): Uint8Array { + return MsgCreateClientResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgCreateClientResponse): MsgCreateClientResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.MsgCreateClientResponse", + value: MsgCreateClientResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgCreateClientResponse.typeUrl, MsgCreateClientResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgCreateClientResponse.aminoType, MsgCreateClientResponse.typeUrl); +function createBaseMsgUpdateClient(): MsgUpdateClient { + return { + clientId: "", + clientMessage: undefined, + signer: "" + }; +} +export const MsgUpdateClient = { + typeUrl: "/ibc.core.client.v1.MsgUpdateClient", + aminoType: "cosmos-sdk/MsgUpdateClient", + is(o: any): o is MsgUpdateClient { + return o && (o.$typeUrl === MsgUpdateClient.typeUrl || typeof o.clientId === "string" && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgUpdateClientAmino { + return o && (o.$typeUrl === MsgUpdateClient.typeUrl || typeof o.client_id === "string" && typeof o.signer === "string"); + }, + encode(message: MsgUpdateClient, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.clientMessage !== undefined) { + Any.encode(message.clientMessage, writer.uint32(18).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(26).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateClient { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateClient(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.clientMessage = Any.decode(reader, reader.uint32()); + break; + case 3: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUpdateClient { + const message = createBaseMsgUpdateClient(); + message.clientId = object.clientId ?? ""; + message.clientMessage = object.clientMessage !== undefined && object.clientMessage !== null ? Any.fromPartial(object.clientMessage) : undefined; + message.signer = object.signer ?? ""; + return message; + }, + fromAmino(object: MsgUpdateClientAmino): MsgUpdateClient { + const message = createBaseMsgUpdateClient(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + if (object.client_message !== undefined && object.client_message !== null) { + message.clientMessage = Any.fromAmino(object.client_message); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgUpdateClient): MsgUpdateClientAmino { + const obj: any = {}; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + obj.client_message = message.clientMessage ? Any.toAmino(message.clientMessage) : undefined; + obj.signer = message.signer === "" ? undefined : message.signer; + return obj; + }, + fromAminoMsg(object: MsgUpdateClientAminoMsg): MsgUpdateClient { + return MsgUpdateClient.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateClient): MsgUpdateClientAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateClient", + value: MsgUpdateClient.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateClientProtoMsg): MsgUpdateClient { + return MsgUpdateClient.decode(message.value); + }, + toProto(message: MsgUpdateClient): Uint8Array { + return MsgUpdateClient.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateClient): MsgUpdateClientProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.MsgUpdateClient", + value: MsgUpdateClient.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgUpdateClient.typeUrl, MsgUpdateClient); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgUpdateClient.aminoType, MsgUpdateClient.typeUrl); +function createBaseMsgUpdateClientResponse(): MsgUpdateClientResponse { + return {}; +} +export const MsgUpdateClientResponse = { + typeUrl: "/ibc.core.client.v1.MsgUpdateClientResponse", + aminoType: "cosmos-sdk/MsgUpdateClientResponse", + is(o: any): o is MsgUpdateClientResponse { + return o && o.$typeUrl === MsgUpdateClientResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateClientResponseAmino { + return o && o.$typeUrl === MsgUpdateClientResponse.typeUrl; + }, + encode(_: MsgUpdateClientResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateClientResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateClientResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgUpdateClientResponse { + const message = createBaseMsgUpdateClientResponse(); + return message; + }, + fromAmino(_: MsgUpdateClientResponseAmino): MsgUpdateClientResponse { + const message = createBaseMsgUpdateClientResponse(); + return message; + }, + toAmino(_: MsgUpdateClientResponse): MsgUpdateClientResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateClientResponseAminoMsg): MsgUpdateClientResponse { + return MsgUpdateClientResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateClientResponse): MsgUpdateClientResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateClientResponse", + value: MsgUpdateClientResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateClientResponseProtoMsg): MsgUpdateClientResponse { + return MsgUpdateClientResponse.decode(message.value); + }, + toProto(message: MsgUpdateClientResponse): Uint8Array { + return MsgUpdateClientResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateClientResponse): MsgUpdateClientResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.MsgUpdateClientResponse", + value: MsgUpdateClientResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgUpdateClientResponse.typeUrl, MsgUpdateClientResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgUpdateClientResponse.aminoType, MsgUpdateClientResponse.typeUrl); +function createBaseMsgUpgradeClient(): MsgUpgradeClient { + return { + clientId: "", + clientState: undefined, + consensusState: undefined, + proofUpgradeClient: new Uint8Array(), + proofUpgradeConsensusState: new Uint8Array(), + signer: "" + }; +} +export const MsgUpgradeClient = { + typeUrl: "/ibc.core.client.v1.MsgUpgradeClient", + aminoType: "cosmos-sdk/MsgUpgradeClient", + is(o: any): o is MsgUpgradeClient { + return o && (o.$typeUrl === MsgUpgradeClient.typeUrl || typeof o.clientId === "string" && (o.proofUpgradeClient instanceof Uint8Array || typeof o.proofUpgradeClient === "string") && (o.proofUpgradeConsensusState instanceof Uint8Array || typeof o.proofUpgradeConsensusState === "string") && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgUpgradeClientAmino { + return o && (o.$typeUrl === MsgUpgradeClient.typeUrl || typeof o.client_id === "string" && (o.proof_upgrade_client instanceof Uint8Array || typeof o.proof_upgrade_client === "string") && (o.proof_upgrade_consensus_state instanceof Uint8Array || typeof o.proof_upgrade_consensus_state === "string") && typeof o.signer === "string"); + }, + encode(message: MsgUpgradeClient, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.clientState !== undefined) { + Any.encode(message.clientState, writer.uint32(18).fork()).ldelim(); + } + if (message.consensusState !== undefined) { + Any.encode(message.consensusState, writer.uint32(26).fork()).ldelim(); + } + if (message.proofUpgradeClient.length !== 0) { + writer.uint32(34).bytes(message.proofUpgradeClient); + } + if (message.proofUpgradeConsensusState.length !== 0) { + writer.uint32(42).bytes(message.proofUpgradeConsensusState); + } + if (message.signer !== "") { + writer.uint32(50).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpgradeClient { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpgradeClient(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.clientState = Any.decode(reader, reader.uint32()); + break; + case 3: + message.consensusState = Any.decode(reader, reader.uint32()); + break; + case 4: + message.proofUpgradeClient = reader.bytes(); + break; + case 5: + message.proofUpgradeConsensusState = reader.bytes(); + break; + case 6: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUpgradeClient { + const message = createBaseMsgUpgradeClient(); + message.clientId = object.clientId ?? ""; + message.clientState = object.clientState !== undefined && object.clientState !== null ? Any.fromPartial(object.clientState) : undefined; + message.consensusState = object.consensusState !== undefined && object.consensusState !== null ? Any.fromPartial(object.consensusState) : undefined; + message.proofUpgradeClient = object.proofUpgradeClient ?? new Uint8Array(); + message.proofUpgradeConsensusState = object.proofUpgradeConsensusState ?? new Uint8Array(); + message.signer = object.signer ?? ""; + return message; + }, + fromAmino(object: MsgUpgradeClientAmino): MsgUpgradeClient { + const message = createBaseMsgUpgradeClient(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + if (object.client_state !== undefined && object.client_state !== null) { + message.clientState = Any.fromAmino(object.client_state); + } + if (object.consensus_state !== undefined && object.consensus_state !== null) { + message.consensusState = Any.fromAmino(object.consensus_state); + } + if (object.proof_upgrade_client !== undefined && object.proof_upgrade_client !== null) { + message.proofUpgradeClient = bytesFromBase64(object.proof_upgrade_client); + } + if (object.proof_upgrade_consensus_state !== undefined && object.proof_upgrade_consensus_state !== null) { + message.proofUpgradeConsensusState = bytesFromBase64(object.proof_upgrade_consensus_state); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgUpgradeClient): MsgUpgradeClientAmino { + const obj: any = {}; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; + obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; + obj.proof_upgrade_client = message.proofUpgradeClient ? base64FromBytes(message.proofUpgradeClient) : undefined; + obj.proof_upgrade_consensus_state = message.proofUpgradeConsensusState ? base64FromBytes(message.proofUpgradeConsensusState) : undefined; + obj.signer = message.signer === "" ? undefined : message.signer; + return obj; + }, + fromAminoMsg(object: MsgUpgradeClientAminoMsg): MsgUpgradeClient { + return MsgUpgradeClient.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpgradeClient): MsgUpgradeClientAminoMsg { + return { + type: "cosmos-sdk/MsgUpgradeClient", + value: MsgUpgradeClient.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpgradeClientProtoMsg): MsgUpgradeClient { + return MsgUpgradeClient.decode(message.value); + }, + toProto(message: MsgUpgradeClient): Uint8Array { + return MsgUpgradeClient.encode(message).finish(); + }, + toProtoMsg(message: MsgUpgradeClient): MsgUpgradeClientProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.MsgUpgradeClient", + value: MsgUpgradeClient.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgUpgradeClient.typeUrl, MsgUpgradeClient); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgUpgradeClient.aminoType, MsgUpgradeClient.typeUrl); +function createBaseMsgUpgradeClientResponse(): MsgUpgradeClientResponse { + return {}; +} +export const MsgUpgradeClientResponse = { + typeUrl: "/ibc.core.client.v1.MsgUpgradeClientResponse", + aminoType: "cosmos-sdk/MsgUpgradeClientResponse", + is(o: any): o is MsgUpgradeClientResponse { + return o && o.$typeUrl === MsgUpgradeClientResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpgradeClientResponseAmino { + return o && o.$typeUrl === MsgUpgradeClientResponse.typeUrl; + }, + encode(_: MsgUpgradeClientResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpgradeClientResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpgradeClientResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgUpgradeClientResponse { + const message = createBaseMsgUpgradeClientResponse(); + return message; + }, + fromAmino(_: MsgUpgradeClientResponseAmino): MsgUpgradeClientResponse { + const message = createBaseMsgUpgradeClientResponse(); + return message; + }, + toAmino(_: MsgUpgradeClientResponse): MsgUpgradeClientResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpgradeClientResponseAminoMsg): MsgUpgradeClientResponse { + return MsgUpgradeClientResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpgradeClientResponse): MsgUpgradeClientResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpgradeClientResponse", + value: MsgUpgradeClientResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpgradeClientResponseProtoMsg): MsgUpgradeClientResponse { + return MsgUpgradeClientResponse.decode(message.value); + }, + toProto(message: MsgUpgradeClientResponse): Uint8Array { + return MsgUpgradeClientResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpgradeClientResponse): MsgUpgradeClientResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.MsgUpgradeClientResponse", + value: MsgUpgradeClientResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgUpgradeClientResponse.typeUrl, MsgUpgradeClientResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgUpgradeClientResponse.aminoType, MsgUpgradeClientResponse.typeUrl); +function createBaseMsgSubmitMisbehaviour(): MsgSubmitMisbehaviour { + return { + clientId: "", + misbehaviour: undefined, + signer: "" + }; +} +export const MsgSubmitMisbehaviour = { + typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviour", + aminoType: "cosmos-sdk/MsgSubmitMisbehaviour", + is(o: any): o is MsgSubmitMisbehaviour { + return o && (o.$typeUrl === MsgSubmitMisbehaviour.typeUrl || typeof o.clientId === "string" && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgSubmitMisbehaviourAmino { + return o && (o.$typeUrl === MsgSubmitMisbehaviour.typeUrl || typeof o.client_id === "string" && typeof o.signer === "string"); + }, + encode(message: MsgSubmitMisbehaviour, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.misbehaviour !== undefined) { + Any.encode(message.misbehaviour, writer.uint32(18).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(26).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitMisbehaviour { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitMisbehaviour(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.misbehaviour = Any.decode(reader, reader.uint32()); + break; + case 3: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgSubmitMisbehaviour { + const message = createBaseMsgSubmitMisbehaviour(); + message.clientId = object.clientId ?? ""; + message.misbehaviour = object.misbehaviour !== undefined && object.misbehaviour !== null ? Any.fromPartial(object.misbehaviour) : undefined; + message.signer = object.signer ?? ""; + return message; + }, + fromAmino(object: MsgSubmitMisbehaviourAmino): MsgSubmitMisbehaviour { + const message = createBaseMsgSubmitMisbehaviour(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + if (object.misbehaviour !== undefined && object.misbehaviour !== null) { + message.misbehaviour = Any.fromAmino(object.misbehaviour); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgSubmitMisbehaviour): MsgSubmitMisbehaviourAmino { + const obj: any = {}; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + obj.misbehaviour = message.misbehaviour ? Any.toAmino(message.misbehaviour) : undefined; + obj.signer = message.signer === "" ? undefined : message.signer; + return obj; + }, + fromAminoMsg(object: MsgSubmitMisbehaviourAminoMsg): MsgSubmitMisbehaviour { + return MsgSubmitMisbehaviour.fromAmino(object.value); + }, + toAminoMsg(message: MsgSubmitMisbehaviour): MsgSubmitMisbehaviourAminoMsg { + return { + type: "cosmos-sdk/MsgSubmitMisbehaviour", + value: MsgSubmitMisbehaviour.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSubmitMisbehaviourProtoMsg): MsgSubmitMisbehaviour { + return MsgSubmitMisbehaviour.decode(message.value); + }, + toProto(message: MsgSubmitMisbehaviour): Uint8Array { + return MsgSubmitMisbehaviour.encode(message).finish(); + }, + toProtoMsg(message: MsgSubmitMisbehaviour): MsgSubmitMisbehaviourProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviour", + value: MsgSubmitMisbehaviour.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgSubmitMisbehaviour.typeUrl, MsgSubmitMisbehaviour); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgSubmitMisbehaviour.aminoType, MsgSubmitMisbehaviour.typeUrl); +function createBaseMsgSubmitMisbehaviourResponse(): MsgSubmitMisbehaviourResponse { + return {}; +} +export const MsgSubmitMisbehaviourResponse = { + typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviourResponse", + aminoType: "cosmos-sdk/MsgSubmitMisbehaviourResponse", + is(o: any): o is MsgSubmitMisbehaviourResponse { + return o && o.$typeUrl === MsgSubmitMisbehaviourResponse.typeUrl; + }, + isAmino(o: any): o is MsgSubmitMisbehaviourResponseAmino { + return o && o.$typeUrl === MsgSubmitMisbehaviourResponse.typeUrl; + }, + encode(_: MsgSubmitMisbehaviourResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgSubmitMisbehaviourResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgSubmitMisbehaviourResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgSubmitMisbehaviourResponse { + const message = createBaseMsgSubmitMisbehaviourResponse(); + return message; + }, + fromAmino(_: MsgSubmitMisbehaviourResponseAmino): MsgSubmitMisbehaviourResponse { + const message = createBaseMsgSubmitMisbehaviourResponse(); + return message; + }, + toAmino(_: MsgSubmitMisbehaviourResponse): MsgSubmitMisbehaviourResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgSubmitMisbehaviourResponseAminoMsg): MsgSubmitMisbehaviourResponse { + return MsgSubmitMisbehaviourResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgSubmitMisbehaviourResponse): MsgSubmitMisbehaviourResponseAminoMsg { + return { + type: "cosmos-sdk/MsgSubmitMisbehaviourResponse", + value: MsgSubmitMisbehaviourResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgSubmitMisbehaviourResponseProtoMsg): MsgSubmitMisbehaviourResponse { + return MsgSubmitMisbehaviourResponse.decode(message.value); + }, + toProto(message: MsgSubmitMisbehaviourResponse): Uint8Array { + return MsgSubmitMisbehaviourResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgSubmitMisbehaviourResponse): MsgSubmitMisbehaviourResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.MsgSubmitMisbehaviourResponse", + value: MsgSubmitMisbehaviourResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgSubmitMisbehaviourResponse.typeUrl, MsgSubmitMisbehaviourResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgSubmitMisbehaviourResponse.aminoType, MsgSubmitMisbehaviourResponse.typeUrl); +function createBaseMsgRecoverClient(): MsgRecoverClient { + return { + subjectClientId: "", + substituteClientId: "", + signer: "" + }; +} +export const MsgRecoverClient = { + typeUrl: "/ibc.core.client.v1.MsgRecoverClient", + aminoType: "cosmos-sdk/MsgRecoverClient", + is(o: any): o is MsgRecoverClient { + return o && (o.$typeUrl === MsgRecoverClient.typeUrl || typeof o.subjectClientId === "string" && typeof o.substituteClientId === "string" && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgRecoverClientAmino { + return o && (o.$typeUrl === MsgRecoverClient.typeUrl || typeof o.subject_client_id === "string" && typeof o.substitute_client_id === "string" && typeof o.signer === "string"); + }, + encode(message: MsgRecoverClient, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.subjectClientId !== "") { + writer.uint32(10).string(message.subjectClientId); + } + if (message.substituteClientId !== "") { + writer.uint32(18).string(message.substituteClientId); + } + if (message.signer !== "") { + writer.uint32(26).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgRecoverClient { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRecoverClient(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.subjectClientId = reader.string(); + break; + case 2: + message.substituteClientId = reader.string(); + break; + case 3: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgRecoverClient { + const message = createBaseMsgRecoverClient(); + message.subjectClientId = object.subjectClientId ?? ""; + message.substituteClientId = object.substituteClientId ?? ""; + message.signer = object.signer ?? ""; + return message; + }, + fromAmino(object: MsgRecoverClientAmino): MsgRecoverClient { + const message = createBaseMsgRecoverClient(); + if (object.subject_client_id !== undefined && object.subject_client_id !== null) { + message.subjectClientId = object.subject_client_id; + } + if (object.substitute_client_id !== undefined && object.substitute_client_id !== null) { + message.substituteClientId = object.substitute_client_id; + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgRecoverClient): MsgRecoverClientAmino { + const obj: any = {}; + obj.subject_client_id = message.subjectClientId === "" ? undefined : message.subjectClientId; + obj.substitute_client_id = message.substituteClientId === "" ? undefined : message.substituteClientId; + obj.signer = message.signer === "" ? undefined : message.signer; + return obj; + }, + fromAminoMsg(object: MsgRecoverClientAminoMsg): MsgRecoverClient { + return MsgRecoverClient.fromAmino(object.value); + }, + toAminoMsg(message: MsgRecoverClient): MsgRecoverClientAminoMsg { + return { + type: "cosmos-sdk/MsgRecoverClient", + value: MsgRecoverClient.toAmino(message) + }; + }, + fromProtoMsg(message: MsgRecoverClientProtoMsg): MsgRecoverClient { + return MsgRecoverClient.decode(message.value); + }, + toProto(message: MsgRecoverClient): Uint8Array { + return MsgRecoverClient.encode(message).finish(); + }, + toProtoMsg(message: MsgRecoverClient): MsgRecoverClientProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.MsgRecoverClient", + value: MsgRecoverClient.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgRecoverClient.typeUrl, MsgRecoverClient); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgRecoverClient.aminoType, MsgRecoverClient.typeUrl); +function createBaseMsgRecoverClientResponse(): MsgRecoverClientResponse { + return {}; +} +export const MsgRecoverClientResponse = { + typeUrl: "/ibc.core.client.v1.MsgRecoverClientResponse", + aminoType: "cosmos-sdk/MsgRecoverClientResponse", + is(o: any): o is MsgRecoverClientResponse { + return o && o.$typeUrl === MsgRecoverClientResponse.typeUrl; + }, + isAmino(o: any): o is MsgRecoverClientResponseAmino { + return o && o.$typeUrl === MsgRecoverClientResponse.typeUrl; + }, + encode(_: MsgRecoverClientResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgRecoverClientResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRecoverClientResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgRecoverClientResponse { + const message = createBaseMsgRecoverClientResponse(); + return message; + }, + fromAmino(_: MsgRecoverClientResponseAmino): MsgRecoverClientResponse { + const message = createBaseMsgRecoverClientResponse(); + return message; + }, + toAmino(_: MsgRecoverClientResponse): MsgRecoverClientResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgRecoverClientResponseAminoMsg): MsgRecoverClientResponse { + return MsgRecoverClientResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgRecoverClientResponse): MsgRecoverClientResponseAminoMsg { + return { + type: "cosmos-sdk/MsgRecoverClientResponse", + value: MsgRecoverClientResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgRecoverClientResponseProtoMsg): MsgRecoverClientResponse { + return MsgRecoverClientResponse.decode(message.value); + }, + toProto(message: MsgRecoverClientResponse): Uint8Array { + return MsgRecoverClientResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgRecoverClientResponse): MsgRecoverClientResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.MsgRecoverClientResponse", + value: MsgRecoverClientResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgRecoverClientResponse.typeUrl, MsgRecoverClientResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgRecoverClientResponse.aminoType, MsgRecoverClientResponse.typeUrl); +function createBaseMsgIBCSoftwareUpgrade(): MsgIBCSoftwareUpgrade { + return { + plan: Plan.fromPartial({}), + upgradedClientState: undefined, + signer: "" + }; +} +export const MsgIBCSoftwareUpgrade = { + typeUrl: "/ibc.core.client.v1.MsgIBCSoftwareUpgrade", + aminoType: "cosmos-sdk/MsgIBCSoftwareUpgrade", + is(o: any): o is MsgIBCSoftwareUpgrade { + return o && (o.$typeUrl === MsgIBCSoftwareUpgrade.typeUrl || Plan.is(o.plan) && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgIBCSoftwareUpgradeAmino { + return o && (o.$typeUrl === MsgIBCSoftwareUpgrade.typeUrl || Plan.isAmino(o.plan) && typeof o.signer === "string"); + }, + encode(message: MsgIBCSoftwareUpgrade, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.plan !== undefined) { + Plan.encode(message.plan, writer.uint32(10).fork()).ldelim(); + } + if (message.upgradedClientState !== undefined) { + Any.encode(message.upgradedClientState, writer.uint32(18).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(26).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgIBCSoftwareUpgrade { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgIBCSoftwareUpgrade(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.plan = Plan.decode(reader, reader.uint32()); + break; + case 2: + message.upgradedClientState = Any.decode(reader, reader.uint32()); + break; + case 3: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgIBCSoftwareUpgrade { + const message = createBaseMsgIBCSoftwareUpgrade(); + message.plan = object.plan !== undefined && object.plan !== null ? Plan.fromPartial(object.plan) : undefined; + message.upgradedClientState = object.upgradedClientState !== undefined && object.upgradedClientState !== null ? Any.fromPartial(object.upgradedClientState) : undefined; + message.signer = object.signer ?? ""; + return message; + }, + fromAmino(object: MsgIBCSoftwareUpgradeAmino): MsgIBCSoftwareUpgrade { + const message = createBaseMsgIBCSoftwareUpgrade(); + if (object.plan !== undefined && object.plan !== null) { + message.plan = Plan.fromAmino(object.plan); + } + if (object.upgraded_client_state !== undefined && object.upgraded_client_state !== null) { + message.upgradedClientState = Any.fromAmino(object.upgraded_client_state); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgIBCSoftwareUpgrade): MsgIBCSoftwareUpgradeAmino { + const obj: any = {}; + obj.plan = message.plan ? Plan.toAmino(message.plan) : undefined; + obj.upgraded_client_state = message.upgradedClientState ? Any.toAmino(message.upgradedClientState) : undefined; + obj.signer = message.signer === "" ? undefined : message.signer; + return obj; + }, + fromAminoMsg(object: MsgIBCSoftwareUpgradeAminoMsg): MsgIBCSoftwareUpgrade { + return MsgIBCSoftwareUpgrade.fromAmino(object.value); + }, + toAminoMsg(message: MsgIBCSoftwareUpgrade): MsgIBCSoftwareUpgradeAminoMsg { + return { + type: "cosmos-sdk/MsgIBCSoftwareUpgrade", + value: MsgIBCSoftwareUpgrade.toAmino(message) + }; + }, + fromProtoMsg(message: MsgIBCSoftwareUpgradeProtoMsg): MsgIBCSoftwareUpgrade { + return MsgIBCSoftwareUpgrade.decode(message.value); + }, + toProto(message: MsgIBCSoftwareUpgrade): Uint8Array { + return MsgIBCSoftwareUpgrade.encode(message).finish(); + }, + toProtoMsg(message: MsgIBCSoftwareUpgrade): MsgIBCSoftwareUpgradeProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.MsgIBCSoftwareUpgrade", + value: MsgIBCSoftwareUpgrade.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgIBCSoftwareUpgrade.typeUrl, MsgIBCSoftwareUpgrade); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgIBCSoftwareUpgrade.aminoType, MsgIBCSoftwareUpgrade.typeUrl); +function createBaseMsgIBCSoftwareUpgradeResponse(): MsgIBCSoftwareUpgradeResponse { + return {}; +} +export const MsgIBCSoftwareUpgradeResponse = { + typeUrl: "/ibc.core.client.v1.MsgIBCSoftwareUpgradeResponse", + aminoType: "cosmos-sdk/MsgIBCSoftwareUpgradeResponse", + is(o: any): o is MsgIBCSoftwareUpgradeResponse { + return o && o.$typeUrl === MsgIBCSoftwareUpgradeResponse.typeUrl; + }, + isAmino(o: any): o is MsgIBCSoftwareUpgradeResponseAmino { + return o && o.$typeUrl === MsgIBCSoftwareUpgradeResponse.typeUrl; + }, + encode(_: MsgIBCSoftwareUpgradeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgIBCSoftwareUpgradeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgIBCSoftwareUpgradeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgIBCSoftwareUpgradeResponse { + const message = createBaseMsgIBCSoftwareUpgradeResponse(); + return message; + }, + fromAmino(_: MsgIBCSoftwareUpgradeResponseAmino): MsgIBCSoftwareUpgradeResponse { + const message = createBaseMsgIBCSoftwareUpgradeResponse(); + return message; + }, + toAmino(_: MsgIBCSoftwareUpgradeResponse): MsgIBCSoftwareUpgradeResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgIBCSoftwareUpgradeResponseAminoMsg): MsgIBCSoftwareUpgradeResponse { + return MsgIBCSoftwareUpgradeResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgIBCSoftwareUpgradeResponse): MsgIBCSoftwareUpgradeResponseAminoMsg { + return { + type: "cosmos-sdk/MsgIBCSoftwareUpgradeResponse", + value: MsgIBCSoftwareUpgradeResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgIBCSoftwareUpgradeResponseProtoMsg): MsgIBCSoftwareUpgradeResponse { + return MsgIBCSoftwareUpgradeResponse.decode(message.value); + }, + toProto(message: MsgIBCSoftwareUpgradeResponse): Uint8Array { + return MsgIBCSoftwareUpgradeResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgIBCSoftwareUpgradeResponse): MsgIBCSoftwareUpgradeResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.MsgIBCSoftwareUpgradeResponse", + value: MsgIBCSoftwareUpgradeResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgIBCSoftwareUpgradeResponse.typeUrl, MsgIBCSoftwareUpgradeResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgIBCSoftwareUpgradeResponse.aminoType, MsgIBCSoftwareUpgradeResponse.typeUrl); +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { + signer: "", + params: Params.fromPartial({}) + }; +} +export const MsgUpdateParams = { + typeUrl: "/ibc.core.client.v1.MsgUpdateParams", + aminoType: "cosmos-sdk/MsgUpdateParams", + is(o: any): o is MsgUpdateParams { + return o && (o.$typeUrl === MsgUpdateParams.typeUrl || typeof o.signer === "string" && Params.is(o.params)); + }, + isAmino(o: any): o is MsgUpdateParamsAmino { + return o && (o.$typeUrl === MsgUpdateParams.typeUrl || typeof o.signer === "string" && Params.isAmino(o.params)); + }, + encode(message: MsgUpdateParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.signer !== "") { + writer.uint32(10).string(message.signer); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signer = reader.string(); + break; + case 2: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + message.signer = object.signer ?? ""; + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: MsgUpdateParamsAmino): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: MsgUpdateParams): MsgUpdateParamsAmino { + const obj: any = {}; + obj.signer = message.signer === "" ? undefined : message.signer; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsAminoMsg): MsgUpdateParams { + return MsgUpdateParams.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParams): MsgUpdateParamsAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateParams", + value: MsgUpdateParams.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsProtoMsg): MsgUpdateParams { + return MsgUpdateParams.decode(message.value); + }, + toProto(message: MsgUpdateParams): Uint8Array { + return MsgUpdateParams.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParams): MsgUpdateParamsProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.MsgUpdateParams", + value: MsgUpdateParams.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgUpdateParams.typeUrl, MsgUpdateParams); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgUpdateParams.aminoType, MsgUpdateParams.typeUrl); +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} +export const MsgUpdateParamsResponse = { + typeUrl: "/ibc.core.client.v1.MsgUpdateParamsResponse", + aminoType: "cosmos-sdk/MsgUpdateParamsResponse", + is(o: any): o is MsgUpdateParamsResponse { + return o && o.$typeUrl === MsgUpdateParamsResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateParamsResponseAmino { + return o && o.$typeUrl === MsgUpdateParamsResponse.typeUrl; + }, + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + fromAmino(_: MsgUpdateParamsResponseAmino): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + toAmino(_: MsgUpdateParamsResponse): MsgUpdateParamsResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsResponseAminoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsResponseProtoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.decode(message.value); + }, + toProto(message: MsgUpdateParamsResponse): Uint8Array { + return MsgUpdateParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseProtoMsg { + return { + typeUrl: "/ibc.core.client.v1.MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgUpdateParamsResponse.typeUrl, MsgUpdateParamsResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgUpdateParamsResponse.aminoType, MsgUpdateParamsResponse.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/ibc/core/commitment/v1/commitment.ts b/libs/interchain-query/src/ibc/core/commitment/v1/commitment.ts new file mode 100644 index 00000000..5061d630 --- /dev/null +++ b/libs/interchain-query/src/ibc/core/commitment/v1/commitment.ts @@ -0,0 +1,418 @@ +import { CommitmentProof, CommitmentProofAmino } from "../../../../cosmos/ics23/v1/proofs"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { GlobalDecoderRegistry } from "../../../../registry"; +/** + * MerkleRoot defines a merkle root hash. + * In the Cosmos SDK, the AppHash of a block header becomes the root. + */ +export interface MerkleRoot { + hash: Uint8Array; +} +export interface MerkleRootProtoMsg { + typeUrl: "/ibc.core.commitment.v1.MerkleRoot"; + value: Uint8Array; +} +/** + * MerkleRoot defines a merkle root hash. + * In the Cosmos SDK, the AppHash of a block header becomes the root. + */ +export interface MerkleRootAmino { + hash: string; +} +export interface MerkleRootAminoMsg { + type: "cosmos-sdk/MerkleRoot"; + value: MerkleRootAmino; +} +/** + * MerklePrefix is merkle path prefixed to the key. + * The constructed key from the Path and the key will be append(Path.KeyPath, + * append(Path.KeyPrefix, key...)) + */ +export interface MerklePrefix { + keyPrefix: Uint8Array; +} +export interface MerklePrefixProtoMsg { + typeUrl: "/ibc.core.commitment.v1.MerklePrefix"; + value: Uint8Array; +} +/** + * MerklePrefix is merkle path prefixed to the key. + * The constructed key from the Path and the key will be append(Path.KeyPath, + * append(Path.KeyPrefix, key...)) + */ +export interface MerklePrefixAmino { + key_prefix: string; +} +export interface MerklePrefixAminoMsg { + type: "cosmos-sdk/MerklePrefix"; + value: MerklePrefixAmino; +} +/** + * MerklePath is the path used to verify commitment proofs, which can be an + * arbitrary structured object (defined by a commitment type). + * MerklePath is represented from root-to-leaf + */ +export interface MerklePath { + keyPath: string[]; +} +export interface MerklePathProtoMsg { + typeUrl: "/ibc.core.commitment.v1.MerklePath"; + value: Uint8Array; +} +/** + * MerklePath is the path used to verify commitment proofs, which can be an + * arbitrary structured object (defined by a commitment type). + * MerklePath is represented from root-to-leaf + */ +export interface MerklePathAmino { + key_path: string[]; +} +export interface MerklePathAminoMsg { + type: "cosmos-sdk/MerklePath"; + value: MerklePathAmino; +} +/** + * MerkleProof is a wrapper type over a chain of CommitmentProofs. + * It demonstrates membership or non-membership for an element or set of + * elements, verifiable in conjunction with a known commitment root. Proofs + * should be succinct. + * MerkleProofs are ordered from leaf-to-root + */ +export interface MerkleProof { + proofs: CommitmentProof[]; +} +export interface MerkleProofProtoMsg { + typeUrl: "/ibc.core.commitment.v1.MerkleProof"; + value: Uint8Array; +} +/** + * MerkleProof is a wrapper type over a chain of CommitmentProofs. + * It demonstrates membership or non-membership for an element or set of + * elements, verifiable in conjunction with a known commitment root. Proofs + * should be succinct. + * MerkleProofs are ordered from leaf-to-root + */ +export interface MerkleProofAmino { + proofs: CommitmentProofAmino[]; +} +export interface MerkleProofAminoMsg { + type: "cosmos-sdk/MerkleProof"; + value: MerkleProofAmino; +} +function createBaseMerkleRoot(): MerkleRoot { + return { + hash: new Uint8Array() + }; +} +export const MerkleRoot = { + typeUrl: "/ibc.core.commitment.v1.MerkleRoot", + aminoType: "cosmos-sdk/MerkleRoot", + is(o: any): o is MerkleRoot { + return o && (o.$typeUrl === MerkleRoot.typeUrl || o.hash instanceof Uint8Array || typeof o.hash === "string"); + }, + isAmino(o: any): o is MerkleRootAmino { + return o && (o.$typeUrl === MerkleRoot.typeUrl || o.hash instanceof Uint8Array || typeof o.hash === "string"); + }, + encode(message: MerkleRoot, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.hash.length !== 0) { + writer.uint32(10).bytes(message.hash); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MerkleRoot { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMerkleRoot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MerkleRoot { + const message = createBaseMerkleRoot(); + message.hash = object.hash ?? new Uint8Array(); + return message; + }, + fromAmino(object: MerkleRootAmino): MerkleRoot { + const message = createBaseMerkleRoot(); + if (object.hash !== undefined && object.hash !== null) { + message.hash = bytesFromBase64(object.hash); + } + return message; + }, + toAmino(message: MerkleRoot): MerkleRootAmino { + const obj: any = {}; + obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; + return obj; + }, + fromAminoMsg(object: MerkleRootAminoMsg): MerkleRoot { + return MerkleRoot.fromAmino(object.value); + }, + toAminoMsg(message: MerkleRoot): MerkleRootAminoMsg { + return { + type: "cosmos-sdk/MerkleRoot", + value: MerkleRoot.toAmino(message) + }; + }, + fromProtoMsg(message: MerkleRootProtoMsg): MerkleRoot { + return MerkleRoot.decode(message.value); + }, + toProto(message: MerkleRoot): Uint8Array { + return MerkleRoot.encode(message).finish(); + }, + toProtoMsg(message: MerkleRoot): MerkleRootProtoMsg { + return { + typeUrl: "/ibc.core.commitment.v1.MerkleRoot", + value: MerkleRoot.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MerkleRoot.typeUrl, MerkleRoot); +GlobalDecoderRegistry.registerAminoProtoMapping(MerkleRoot.aminoType, MerkleRoot.typeUrl); +function createBaseMerklePrefix(): MerklePrefix { + return { + keyPrefix: new Uint8Array() + }; +} +export const MerklePrefix = { + typeUrl: "/ibc.core.commitment.v1.MerklePrefix", + aminoType: "cosmos-sdk/MerklePrefix", + is(o: any): o is MerklePrefix { + return o && (o.$typeUrl === MerklePrefix.typeUrl || o.keyPrefix instanceof Uint8Array || typeof o.keyPrefix === "string"); + }, + isAmino(o: any): o is MerklePrefixAmino { + return o && (o.$typeUrl === MerklePrefix.typeUrl || o.key_prefix instanceof Uint8Array || typeof o.key_prefix === "string"); + }, + encode(message: MerklePrefix, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.keyPrefix.length !== 0) { + writer.uint32(10).bytes(message.keyPrefix); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MerklePrefix { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMerklePrefix(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.keyPrefix = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MerklePrefix { + const message = createBaseMerklePrefix(); + message.keyPrefix = object.keyPrefix ?? new Uint8Array(); + return message; + }, + fromAmino(object: MerklePrefixAmino): MerklePrefix { + const message = createBaseMerklePrefix(); + if (object.key_prefix !== undefined && object.key_prefix !== null) { + message.keyPrefix = bytesFromBase64(object.key_prefix); + } + return message; + }, + toAmino(message: MerklePrefix): MerklePrefixAmino { + const obj: any = {}; + obj.key_prefix = message.keyPrefix ? base64FromBytes(message.keyPrefix) : undefined; + return obj; + }, + fromAminoMsg(object: MerklePrefixAminoMsg): MerklePrefix { + return MerklePrefix.fromAmino(object.value); + }, + toAminoMsg(message: MerklePrefix): MerklePrefixAminoMsg { + return { + type: "cosmos-sdk/MerklePrefix", + value: MerklePrefix.toAmino(message) + }; + }, + fromProtoMsg(message: MerklePrefixProtoMsg): MerklePrefix { + return MerklePrefix.decode(message.value); + }, + toProto(message: MerklePrefix): Uint8Array { + return MerklePrefix.encode(message).finish(); + }, + toProtoMsg(message: MerklePrefix): MerklePrefixProtoMsg { + return { + typeUrl: "/ibc.core.commitment.v1.MerklePrefix", + value: MerklePrefix.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MerklePrefix.typeUrl, MerklePrefix); +GlobalDecoderRegistry.registerAminoProtoMapping(MerklePrefix.aminoType, MerklePrefix.typeUrl); +function createBaseMerklePath(): MerklePath { + return { + keyPath: [] + }; +} +export const MerklePath = { + typeUrl: "/ibc.core.commitment.v1.MerklePath", + aminoType: "cosmos-sdk/MerklePath", + is(o: any): o is MerklePath { + return o && (o.$typeUrl === MerklePath.typeUrl || Array.isArray(o.keyPath) && (!o.keyPath.length || typeof o.keyPath[0] === "string")); + }, + isAmino(o: any): o is MerklePathAmino { + return o && (o.$typeUrl === MerklePath.typeUrl || Array.isArray(o.key_path) && (!o.key_path.length || typeof o.key_path[0] === "string")); + }, + encode(message: MerklePath, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.keyPath) { + writer.uint32(10).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MerklePath { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMerklePath(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.keyPath.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MerklePath { + const message = createBaseMerklePath(); + message.keyPath = object.keyPath?.map(e => e) || []; + return message; + }, + fromAmino(object: MerklePathAmino): MerklePath { + const message = createBaseMerklePath(); + message.keyPath = object.key_path?.map(e => e) || []; + return message; + }, + toAmino(message: MerklePath): MerklePathAmino { + const obj: any = {}; + if (message.keyPath) { + obj.key_path = message.keyPath.map(e => e); + } else { + obj.key_path = message.keyPath; + } + return obj; + }, + fromAminoMsg(object: MerklePathAminoMsg): MerklePath { + return MerklePath.fromAmino(object.value); + }, + toAminoMsg(message: MerklePath): MerklePathAminoMsg { + return { + type: "cosmos-sdk/MerklePath", + value: MerklePath.toAmino(message) + }; + }, + fromProtoMsg(message: MerklePathProtoMsg): MerklePath { + return MerklePath.decode(message.value); + }, + toProto(message: MerklePath): Uint8Array { + return MerklePath.encode(message).finish(); + }, + toProtoMsg(message: MerklePath): MerklePathProtoMsg { + return { + typeUrl: "/ibc.core.commitment.v1.MerklePath", + value: MerklePath.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MerklePath.typeUrl, MerklePath); +GlobalDecoderRegistry.registerAminoProtoMapping(MerklePath.aminoType, MerklePath.typeUrl); +function createBaseMerkleProof(): MerkleProof { + return { + proofs: [] + }; +} +export const MerkleProof = { + typeUrl: "/ibc.core.commitment.v1.MerkleProof", + aminoType: "cosmos-sdk/MerkleProof", + is(o: any): o is MerkleProof { + return o && (o.$typeUrl === MerkleProof.typeUrl || Array.isArray(o.proofs) && (!o.proofs.length || CommitmentProof.is(o.proofs[0]))); + }, + isAmino(o: any): o is MerkleProofAmino { + return o && (o.$typeUrl === MerkleProof.typeUrl || Array.isArray(o.proofs) && (!o.proofs.length || CommitmentProof.isAmino(o.proofs[0]))); + }, + encode(message: MerkleProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.proofs) { + CommitmentProof.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MerkleProof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMerkleProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.proofs.push(CommitmentProof.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MerkleProof { + const message = createBaseMerkleProof(); + message.proofs = object.proofs?.map(e => CommitmentProof.fromPartial(e)) || []; + return message; + }, + fromAmino(object: MerkleProofAmino): MerkleProof { + const message = createBaseMerkleProof(); + message.proofs = object.proofs?.map(e => CommitmentProof.fromAmino(e)) || []; + return message; + }, + toAmino(message: MerkleProof): MerkleProofAmino { + const obj: any = {}; + if (message.proofs) { + obj.proofs = message.proofs.map(e => e ? CommitmentProof.toAmino(e) : undefined); + } else { + obj.proofs = message.proofs; + } + return obj; + }, + fromAminoMsg(object: MerkleProofAminoMsg): MerkleProof { + return MerkleProof.fromAmino(object.value); + }, + toAminoMsg(message: MerkleProof): MerkleProofAminoMsg { + return { + type: "cosmos-sdk/MerkleProof", + value: MerkleProof.toAmino(message) + }; + }, + fromProtoMsg(message: MerkleProofProtoMsg): MerkleProof { + return MerkleProof.decode(message.value); + }, + toProto(message: MerkleProof): Uint8Array { + return MerkleProof.encode(message).finish(); + }, + toProtoMsg(message: MerkleProof): MerkleProofProtoMsg { + return { + typeUrl: "/ibc.core.commitment.v1.MerkleProof", + value: MerkleProof.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MerkleProof.typeUrl, MerkleProof); +GlobalDecoderRegistry.registerAminoProtoMapping(MerkleProof.aminoType, MerkleProof.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/ibc/core/connection/v1/connection.ts b/libs/interchain-query/src/ibc/core/connection/v1/connection.ts new file mode 100644 index 00000000..1791709d --- /dev/null +++ b/libs/interchain-query/src/ibc/core/connection/v1/connection.ts @@ -0,0 +1,1010 @@ +import { MerklePrefix, MerklePrefixAmino } from "../../commitment/v1/commitment"; +import { isSet, DeepPartial } from "../../../../helpers"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { GlobalDecoderRegistry } from "../../../../registry"; +/** + * State defines if a connection is in one of the following states: + * INIT, TRYOPEN, OPEN or UNINITIALIZED. + */ +export enum State { + /** STATE_UNINITIALIZED_UNSPECIFIED - Default State */ + STATE_UNINITIALIZED_UNSPECIFIED = 0, + /** STATE_INIT - A connection end has just started the opening handshake. */ + STATE_INIT = 1, + /** + * STATE_TRYOPEN - A connection end has acknowledged the handshake step on the counterparty + * chain. + */ + STATE_TRYOPEN = 2, + /** STATE_OPEN - A connection end has completed the handshake. */ + STATE_OPEN = 3, + UNRECOGNIZED = -1, +} +export const StateAmino = State; +export function stateFromJSON(object: any): State { + switch (object) { + case 0: + case "STATE_UNINITIALIZED_UNSPECIFIED": + return State.STATE_UNINITIALIZED_UNSPECIFIED; + case 1: + case "STATE_INIT": + return State.STATE_INIT; + case 2: + case "STATE_TRYOPEN": + return State.STATE_TRYOPEN; + case 3: + case "STATE_OPEN": + return State.STATE_OPEN; + case -1: + case "UNRECOGNIZED": + default: + return State.UNRECOGNIZED; + } +} +export function stateToJSON(object: State): string { + switch (object) { + case State.STATE_UNINITIALIZED_UNSPECIFIED: + return "STATE_UNINITIALIZED_UNSPECIFIED"; + case State.STATE_INIT: + return "STATE_INIT"; + case State.STATE_TRYOPEN: + return "STATE_TRYOPEN"; + case State.STATE_OPEN: + return "STATE_OPEN"; + case State.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** + * ConnectionEnd defines a stateful object on a chain connected to another + * separate one. + * NOTE: there must only be 2 defined ConnectionEnds to establish + * a connection between two chains. + */ +export interface ConnectionEnd { + /** client associated with this connection. */ + clientId: string; + /** + * IBC version which can be utilised to determine encodings or protocols for + * channels or packets utilising this connection. + */ + versions: Version[]; + /** current state of the connection end. */ + state: State; + /** counterparty chain associated with this connection. */ + counterparty: Counterparty; + /** + * delay period that must pass before a consensus state can be used for + * packet-verification NOTE: delay period logic is only implemented by some + * clients. + */ + delayPeriod: bigint; +} +export interface ConnectionEndProtoMsg { + typeUrl: "/ibc.core.connection.v1.ConnectionEnd"; + value: Uint8Array; +} +/** + * ConnectionEnd defines a stateful object on a chain connected to another + * separate one. + * NOTE: there must only be 2 defined ConnectionEnds to establish + * a connection between two chains. + */ +export interface ConnectionEndAmino { + /** client associated with this connection. */ + client_id: string; + /** + * IBC version which can be utilised to determine encodings or protocols for + * channels or packets utilising this connection. + */ + versions: VersionAmino[]; + /** current state of the connection end. */ + state: State; + /** counterparty chain associated with this connection. */ + counterparty: CounterpartyAmino; + /** + * delay period that must pass before a consensus state can be used for + * packet-verification NOTE: delay period logic is only implemented by some + * clients. + */ + delay_period: string; +} +export interface ConnectionEndAminoMsg { + type: "cosmos-sdk/ConnectionEnd"; + value: ConnectionEndAmino; +} +/** + * IdentifiedConnection defines a connection with additional connection + * identifier field. + */ +export interface IdentifiedConnection { + /** connection identifier. */ + id: string; + /** client associated with this connection. */ + clientId: string; + /** + * IBC version which can be utilised to determine encodings or protocols for + * channels or packets utilising this connection + */ + versions: Version[]; + /** current state of the connection end. */ + state: State; + /** counterparty chain associated with this connection. */ + counterparty: Counterparty; + /** delay period associated with this connection. */ + delayPeriod: bigint; +} +export interface IdentifiedConnectionProtoMsg { + typeUrl: "/ibc.core.connection.v1.IdentifiedConnection"; + value: Uint8Array; +} +/** + * IdentifiedConnection defines a connection with additional connection + * identifier field. + */ +export interface IdentifiedConnectionAmino { + /** connection identifier. */ + id: string; + /** client associated with this connection. */ + client_id: string; + /** + * IBC version which can be utilised to determine encodings or protocols for + * channels or packets utilising this connection + */ + versions: VersionAmino[]; + /** current state of the connection end. */ + state: State; + /** counterparty chain associated with this connection. */ + counterparty: CounterpartyAmino; + /** delay period associated with this connection. */ + delay_period: string; +} +export interface IdentifiedConnectionAminoMsg { + type: "cosmos-sdk/IdentifiedConnection"; + value: IdentifiedConnectionAmino; +} +/** Counterparty defines the counterparty chain associated with a connection end. */ +export interface Counterparty { + /** + * identifies the client on the counterparty chain associated with a given + * connection. + */ + clientId: string; + /** + * identifies the connection end on the counterparty chain associated with a + * given connection. + */ + connectionId: string; + /** commitment merkle prefix of the counterparty chain. */ + prefix: MerklePrefix; +} +export interface CounterpartyProtoMsg { + typeUrl: "/ibc.core.connection.v1.Counterparty"; + value: Uint8Array; +} +/** Counterparty defines the counterparty chain associated with a connection end. */ +export interface CounterpartyAmino { + /** + * identifies the client on the counterparty chain associated with a given + * connection. + */ + client_id: string; + /** + * identifies the connection end on the counterparty chain associated with a + * given connection. + */ + connection_id: string; + /** commitment merkle prefix of the counterparty chain. */ + prefix: MerklePrefixAmino; +} +export interface CounterpartyAminoMsg { + type: "cosmos-sdk/Counterparty"; + value: CounterpartyAmino; +} +/** ClientPaths define all the connection paths for a client state. */ +export interface ClientPaths { + /** list of connection paths */ + paths: string[]; +} +export interface ClientPathsProtoMsg { + typeUrl: "/ibc.core.connection.v1.ClientPaths"; + value: Uint8Array; +} +/** ClientPaths define all the connection paths for a client state. */ +export interface ClientPathsAmino { + /** list of connection paths */ + paths: string[]; +} +export interface ClientPathsAminoMsg { + type: "cosmos-sdk/ClientPaths"; + value: ClientPathsAmino; +} +/** ConnectionPaths define all the connection paths for a given client state. */ +export interface ConnectionPaths { + /** client state unique identifier */ + clientId: string; + /** list of connection paths */ + paths: string[]; +} +export interface ConnectionPathsProtoMsg { + typeUrl: "/ibc.core.connection.v1.ConnectionPaths"; + value: Uint8Array; +} +/** ConnectionPaths define all the connection paths for a given client state. */ +export interface ConnectionPathsAmino { + /** client state unique identifier */ + client_id: string; + /** list of connection paths */ + paths: string[]; +} +export interface ConnectionPathsAminoMsg { + type: "cosmos-sdk/ConnectionPaths"; + value: ConnectionPathsAmino; +} +/** + * Version defines the versioning scheme used to negotiate the IBC version in + * the connection handshake. + */ +export interface Version { + /** unique version identifier */ + identifier: string; + /** list of features compatible with the specified identifier */ + features: string[]; +} +export interface VersionProtoMsg { + typeUrl: "/ibc.core.connection.v1.Version"; + value: Uint8Array; +} +/** + * Version defines the versioning scheme used to negotiate the IBC version in + * the connection handshake. + */ +export interface VersionAmino { + /** unique version identifier */ + identifier: string; + /** list of features compatible with the specified identifier */ + features: string[]; +} +export interface VersionAminoMsg { + type: "cosmos-sdk/Version"; + value: VersionAmino; +} +/** Params defines the set of Connection parameters. */ +export interface Params { + /** + * maximum expected time per block (in nanoseconds), used to enforce block delay. This parameter should reflect the + * largest amount of time that the chain might reasonably take to produce the next block under normal operating + * conditions. A safe choice is 3-5x the expected time per block. + */ + maxExpectedTimePerBlock: bigint; +} +export interface ParamsProtoMsg { + typeUrl: "/ibc.core.connection.v1.Params"; + value: Uint8Array; +} +/** Params defines the set of Connection parameters. */ +export interface ParamsAmino { + /** + * maximum expected time per block (in nanoseconds), used to enforce block delay. This parameter should reflect the + * largest amount of time that the chain might reasonably take to produce the next block under normal operating + * conditions. A safe choice is 3-5x the expected time per block. + */ + max_expected_time_per_block: string; +} +export interface ParamsAminoMsg { + type: "cosmos-sdk/Params"; + value: ParamsAmino; +} +function createBaseConnectionEnd(): ConnectionEnd { + return { + clientId: "", + versions: [], + state: 0, + counterparty: Counterparty.fromPartial({}), + delayPeriod: BigInt(0) + }; +} +export const ConnectionEnd = { + typeUrl: "/ibc.core.connection.v1.ConnectionEnd", + aminoType: "cosmos-sdk/ConnectionEnd", + is(o: any): o is ConnectionEnd { + return o && (o.$typeUrl === ConnectionEnd.typeUrl || typeof o.clientId === "string" && Array.isArray(o.versions) && (!o.versions.length || Version.is(o.versions[0])) && isSet(o.state) && Counterparty.is(o.counterparty) && typeof o.delayPeriod === "bigint"); + }, + isAmino(o: any): o is ConnectionEndAmino { + return o && (o.$typeUrl === ConnectionEnd.typeUrl || typeof o.client_id === "string" && Array.isArray(o.versions) && (!o.versions.length || Version.isAmino(o.versions[0])) && isSet(o.state) && Counterparty.isAmino(o.counterparty) && typeof o.delay_period === "bigint"); + }, + encode(message: ConnectionEnd, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + for (const v of message.versions) { + Version.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.state !== 0) { + writer.uint32(24).int32(message.state); + } + if (message.counterparty !== undefined) { + Counterparty.encode(message.counterparty, writer.uint32(34).fork()).ldelim(); + } + if (message.delayPeriod !== BigInt(0)) { + writer.uint32(40).uint64(message.delayPeriod); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ConnectionEnd { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConnectionEnd(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.versions.push(Version.decode(reader, reader.uint32())); + break; + case 3: + message.state = (reader.int32() as any); + break; + case 4: + message.counterparty = Counterparty.decode(reader, reader.uint32()); + break; + case 5: + message.delayPeriod = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ConnectionEnd { + const message = createBaseConnectionEnd(); + message.clientId = object.clientId ?? ""; + message.versions = object.versions?.map(e => Version.fromPartial(e)) || []; + message.state = object.state ?? 0; + message.counterparty = object.counterparty !== undefined && object.counterparty !== null ? Counterparty.fromPartial(object.counterparty) : undefined; + message.delayPeriod = object.delayPeriod !== undefined && object.delayPeriod !== null ? BigInt(object.delayPeriod.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ConnectionEndAmino): ConnectionEnd { + const message = createBaseConnectionEnd(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + message.versions = object.versions?.map(e => Version.fromAmino(e)) || []; + if (object.state !== undefined && object.state !== null) { + message.state = object.state; + } + if (object.counterparty !== undefined && object.counterparty !== null) { + message.counterparty = Counterparty.fromAmino(object.counterparty); + } + if (object.delay_period !== undefined && object.delay_period !== null) { + message.delayPeriod = BigInt(object.delay_period); + } + return message; + }, + toAmino(message: ConnectionEnd): ConnectionEndAmino { + const obj: any = {}; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + if (message.versions) { + obj.versions = message.versions.map(e => e ? Version.toAmino(e) : undefined); + } else { + obj.versions = message.versions; + } + obj.state = message.state === 0 ? undefined : message.state; + obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; + obj.delay_period = message.delayPeriod !== BigInt(0) ? message.delayPeriod?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ConnectionEndAminoMsg): ConnectionEnd { + return ConnectionEnd.fromAmino(object.value); + }, + toAminoMsg(message: ConnectionEnd): ConnectionEndAminoMsg { + return { + type: "cosmos-sdk/ConnectionEnd", + value: ConnectionEnd.toAmino(message) + }; + }, + fromProtoMsg(message: ConnectionEndProtoMsg): ConnectionEnd { + return ConnectionEnd.decode(message.value); + }, + toProto(message: ConnectionEnd): Uint8Array { + return ConnectionEnd.encode(message).finish(); + }, + toProtoMsg(message: ConnectionEnd): ConnectionEndProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.ConnectionEnd", + value: ConnectionEnd.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ConnectionEnd.typeUrl, ConnectionEnd); +GlobalDecoderRegistry.registerAminoProtoMapping(ConnectionEnd.aminoType, ConnectionEnd.typeUrl); +function createBaseIdentifiedConnection(): IdentifiedConnection { + return { + id: "", + clientId: "", + versions: [], + state: 0, + counterparty: Counterparty.fromPartial({}), + delayPeriod: BigInt(0) + }; +} +export const IdentifiedConnection = { + typeUrl: "/ibc.core.connection.v1.IdentifiedConnection", + aminoType: "cosmos-sdk/IdentifiedConnection", + is(o: any): o is IdentifiedConnection { + return o && (o.$typeUrl === IdentifiedConnection.typeUrl || typeof o.id === "string" && typeof o.clientId === "string" && Array.isArray(o.versions) && (!o.versions.length || Version.is(o.versions[0])) && isSet(o.state) && Counterparty.is(o.counterparty) && typeof o.delayPeriod === "bigint"); + }, + isAmino(o: any): o is IdentifiedConnectionAmino { + return o && (o.$typeUrl === IdentifiedConnection.typeUrl || typeof o.id === "string" && typeof o.client_id === "string" && Array.isArray(o.versions) && (!o.versions.length || Version.isAmino(o.versions[0])) && isSet(o.state) && Counterparty.isAmino(o.counterparty) && typeof o.delay_period === "bigint"); + }, + encode(message: IdentifiedConnection, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.id !== "") { + writer.uint32(10).string(message.id); + } + if (message.clientId !== "") { + writer.uint32(18).string(message.clientId); + } + for (const v of message.versions) { + Version.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.state !== 0) { + writer.uint32(32).int32(message.state); + } + if (message.counterparty !== undefined) { + Counterparty.encode(message.counterparty, writer.uint32(42).fork()).ldelim(); + } + if (message.delayPeriod !== BigInt(0)) { + writer.uint32(48).uint64(message.delayPeriod); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): IdentifiedConnection { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIdentifiedConnection(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.string(); + break; + case 2: + message.clientId = reader.string(); + break; + case 3: + message.versions.push(Version.decode(reader, reader.uint32())); + break; + case 4: + message.state = (reader.int32() as any); + break; + case 5: + message.counterparty = Counterparty.decode(reader, reader.uint32()); + break; + case 6: + message.delayPeriod = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): IdentifiedConnection { + const message = createBaseIdentifiedConnection(); + message.id = object.id ?? ""; + message.clientId = object.clientId ?? ""; + message.versions = object.versions?.map(e => Version.fromPartial(e)) || []; + message.state = object.state ?? 0; + message.counterparty = object.counterparty !== undefined && object.counterparty !== null ? Counterparty.fromPartial(object.counterparty) : undefined; + message.delayPeriod = object.delayPeriod !== undefined && object.delayPeriod !== null ? BigInt(object.delayPeriod.toString()) : BigInt(0); + return message; + }, + fromAmino(object: IdentifiedConnectionAmino): IdentifiedConnection { + const message = createBaseIdentifiedConnection(); + if (object.id !== undefined && object.id !== null) { + message.id = object.id; + } + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + message.versions = object.versions?.map(e => Version.fromAmino(e)) || []; + if (object.state !== undefined && object.state !== null) { + message.state = object.state; + } + if (object.counterparty !== undefined && object.counterparty !== null) { + message.counterparty = Counterparty.fromAmino(object.counterparty); + } + if (object.delay_period !== undefined && object.delay_period !== null) { + message.delayPeriod = BigInt(object.delay_period); + } + return message; + }, + toAmino(message: IdentifiedConnection): IdentifiedConnectionAmino { + const obj: any = {}; + obj.id = message.id === "" ? undefined : message.id; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + if (message.versions) { + obj.versions = message.versions.map(e => e ? Version.toAmino(e) : undefined); + } else { + obj.versions = message.versions; + } + obj.state = message.state === 0 ? undefined : message.state; + obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; + obj.delay_period = message.delayPeriod !== BigInt(0) ? message.delayPeriod?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: IdentifiedConnectionAminoMsg): IdentifiedConnection { + return IdentifiedConnection.fromAmino(object.value); + }, + toAminoMsg(message: IdentifiedConnection): IdentifiedConnectionAminoMsg { + return { + type: "cosmos-sdk/IdentifiedConnection", + value: IdentifiedConnection.toAmino(message) + }; + }, + fromProtoMsg(message: IdentifiedConnectionProtoMsg): IdentifiedConnection { + return IdentifiedConnection.decode(message.value); + }, + toProto(message: IdentifiedConnection): Uint8Array { + return IdentifiedConnection.encode(message).finish(); + }, + toProtoMsg(message: IdentifiedConnection): IdentifiedConnectionProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.IdentifiedConnection", + value: IdentifiedConnection.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(IdentifiedConnection.typeUrl, IdentifiedConnection); +GlobalDecoderRegistry.registerAminoProtoMapping(IdentifiedConnection.aminoType, IdentifiedConnection.typeUrl); +function createBaseCounterparty(): Counterparty { + return { + clientId: "", + connectionId: "", + prefix: MerklePrefix.fromPartial({}) + }; +} +export const Counterparty = { + typeUrl: "/ibc.core.connection.v1.Counterparty", + aminoType: "cosmos-sdk/Counterparty", + is(o: any): o is Counterparty { + return o && (o.$typeUrl === Counterparty.typeUrl || typeof o.clientId === "string" && typeof o.connectionId === "string" && MerklePrefix.is(o.prefix)); + }, + isAmino(o: any): o is CounterpartyAmino { + return o && (o.$typeUrl === Counterparty.typeUrl || typeof o.client_id === "string" && typeof o.connection_id === "string" && MerklePrefix.isAmino(o.prefix)); + }, + encode(message: Counterparty, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.connectionId !== "") { + writer.uint32(18).string(message.connectionId); + } + if (message.prefix !== undefined) { + MerklePrefix.encode(message.prefix, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Counterparty { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCounterparty(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.connectionId = reader.string(); + break; + case 3: + message.prefix = MerklePrefix.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Counterparty { + const message = createBaseCounterparty(); + message.clientId = object.clientId ?? ""; + message.connectionId = object.connectionId ?? ""; + message.prefix = object.prefix !== undefined && object.prefix !== null ? MerklePrefix.fromPartial(object.prefix) : undefined; + return message; + }, + fromAmino(object: CounterpartyAmino): Counterparty { + const message = createBaseCounterparty(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + if (object.connection_id !== undefined && object.connection_id !== null) { + message.connectionId = object.connection_id; + } + if (object.prefix !== undefined && object.prefix !== null) { + message.prefix = MerklePrefix.fromAmino(object.prefix); + } + return message; + }, + toAmino(message: Counterparty): CounterpartyAmino { + const obj: any = {}; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; + obj.prefix = message.prefix ? MerklePrefix.toAmino(message.prefix) : undefined; + return obj; + }, + fromAminoMsg(object: CounterpartyAminoMsg): Counterparty { + return Counterparty.fromAmino(object.value); + }, + toAminoMsg(message: Counterparty): CounterpartyAminoMsg { + return { + type: "cosmos-sdk/Counterparty", + value: Counterparty.toAmino(message) + }; + }, + fromProtoMsg(message: CounterpartyProtoMsg): Counterparty { + return Counterparty.decode(message.value); + }, + toProto(message: Counterparty): Uint8Array { + return Counterparty.encode(message).finish(); + }, + toProtoMsg(message: Counterparty): CounterpartyProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.Counterparty", + value: Counterparty.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Counterparty.typeUrl, Counterparty); +GlobalDecoderRegistry.registerAminoProtoMapping(Counterparty.aminoType, Counterparty.typeUrl); +function createBaseClientPaths(): ClientPaths { + return { + paths: [] + }; +} +export const ClientPaths = { + typeUrl: "/ibc.core.connection.v1.ClientPaths", + aminoType: "cosmos-sdk/ClientPaths", + is(o: any): o is ClientPaths { + return o && (o.$typeUrl === ClientPaths.typeUrl || Array.isArray(o.paths) && (!o.paths.length || typeof o.paths[0] === "string")); + }, + isAmino(o: any): o is ClientPathsAmino { + return o && (o.$typeUrl === ClientPaths.typeUrl || Array.isArray(o.paths) && (!o.paths.length || typeof o.paths[0] === "string")); + }, + encode(message: ClientPaths, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.paths) { + writer.uint32(10).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ClientPaths { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseClientPaths(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.paths.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ClientPaths { + const message = createBaseClientPaths(); + message.paths = object.paths?.map(e => e) || []; + return message; + }, + fromAmino(object: ClientPathsAmino): ClientPaths { + const message = createBaseClientPaths(); + message.paths = object.paths?.map(e => e) || []; + return message; + }, + toAmino(message: ClientPaths): ClientPathsAmino { + const obj: any = {}; + if (message.paths) { + obj.paths = message.paths.map(e => e); + } else { + obj.paths = message.paths; + } + return obj; + }, + fromAminoMsg(object: ClientPathsAminoMsg): ClientPaths { + return ClientPaths.fromAmino(object.value); + }, + toAminoMsg(message: ClientPaths): ClientPathsAminoMsg { + return { + type: "cosmos-sdk/ClientPaths", + value: ClientPaths.toAmino(message) + }; + }, + fromProtoMsg(message: ClientPathsProtoMsg): ClientPaths { + return ClientPaths.decode(message.value); + }, + toProto(message: ClientPaths): Uint8Array { + return ClientPaths.encode(message).finish(); + }, + toProtoMsg(message: ClientPaths): ClientPathsProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.ClientPaths", + value: ClientPaths.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ClientPaths.typeUrl, ClientPaths); +GlobalDecoderRegistry.registerAminoProtoMapping(ClientPaths.aminoType, ClientPaths.typeUrl); +function createBaseConnectionPaths(): ConnectionPaths { + return { + clientId: "", + paths: [] + }; +} +export const ConnectionPaths = { + typeUrl: "/ibc.core.connection.v1.ConnectionPaths", + aminoType: "cosmos-sdk/ConnectionPaths", + is(o: any): o is ConnectionPaths { + return o && (o.$typeUrl === ConnectionPaths.typeUrl || typeof o.clientId === "string" && Array.isArray(o.paths) && (!o.paths.length || typeof o.paths[0] === "string")); + }, + isAmino(o: any): o is ConnectionPathsAmino { + return o && (o.$typeUrl === ConnectionPaths.typeUrl || typeof o.client_id === "string" && Array.isArray(o.paths) && (!o.paths.length || typeof o.paths[0] === "string")); + }, + encode(message: ConnectionPaths, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + for (const v of message.paths) { + writer.uint32(18).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ConnectionPaths { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConnectionPaths(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.paths.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ConnectionPaths { + const message = createBaseConnectionPaths(); + message.clientId = object.clientId ?? ""; + message.paths = object.paths?.map(e => e) || []; + return message; + }, + fromAmino(object: ConnectionPathsAmino): ConnectionPaths { + const message = createBaseConnectionPaths(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + message.paths = object.paths?.map(e => e) || []; + return message; + }, + toAmino(message: ConnectionPaths): ConnectionPathsAmino { + const obj: any = {}; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + if (message.paths) { + obj.paths = message.paths.map(e => e); + } else { + obj.paths = message.paths; + } + return obj; + }, + fromAminoMsg(object: ConnectionPathsAminoMsg): ConnectionPaths { + return ConnectionPaths.fromAmino(object.value); + }, + toAminoMsg(message: ConnectionPaths): ConnectionPathsAminoMsg { + return { + type: "cosmos-sdk/ConnectionPaths", + value: ConnectionPaths.toAmino(message) + }; + }, + fromProtoMsg(message: ConnectionPathsProtoMsg): ConnectionPaths { + return ConnectionPaths.decode(message.value); + }, + toProto(message: ConnectionPaths): Uint8Array { + return ConnectionPaths.encode(message).finish(); + }, + toProtoMsg(message: ConnectionPaths): ConnectionPathsProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.ConnectionPaths", + value: ConnectionPaths.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ConnectionPaths.typeUrl, ConnectionPaths); +GlobalDecoderRegistry.registerAminoProtoMapping(ConnectionPaths.aminoType, ConnectionPaths.typeUrl); +function createBaseVersion(): Version { + return { + identifier: "", + features: [] + }; +} +export const Version = { + typeUrl: "/ibc.core.connection.v1.Version", + aminoType: "cosmos-sdk/Version", + is(o: any): o is Version { + return o && (o.$typeUrl === Version.typeUrl || typeof o.identifier === "string" && Array.isArray(o.features) && (!o.features.length || typeof o.features[0] === "string")); + }, + isAmino(o: any): o is VersionAmino { + return o && (o.$typeUrl === Version.typeUrl || typeof o.identifier === "string" && Array.isArray(o.features) && (!o.features.length || typeof o.features[0] === "string")); + }, + encode(message: Version, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.identifier !== "") { + writer.uint32(10).string(message.identifier); + } + for (const v of message.features) { + writer.uint32(18).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Version { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVersion(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.identifier = reader.string(); + break; + case 2: + message.features.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Version { + const message = createBaseVersion(); + message.identifier = object.identifier ?? ""; + message.features = object.features?.map(e => e) || []; + return message; + }, + fromAmino(object: VersionAmino): Version { + const message = createBaseVersion(); + if (object.identifier !== undefined && object.identifier !== null) { + message.identifier = object.identifier; + } + message.features = object.features?.map(e => e) || []; + return message; + }, + toAmino(message: Version): VersionAmino { + const obj: any = {}; + obj.identifier = message.identifier === "" ? undefined : message.identifier; + if (message.features) { + obj.features = message.features.map(e => e); + } else { + obj.features = message.features; + } + return obj; + }, + fromAminoMsg(object: VersionAminoMsg): Version { + return Version.fromAmino(object.value); + }, + toAminoMsg(message: Version): VersionAminoMsg { + return { + type: "cosmos-sdk/Version", + value: Version.toAmino(message) + }; + }, + fromProtoMsg(message: VersionProtoMsg): Version { + return Version.decode(message.value); + }, + toProto(message: Version): Uint8Array { + return Version.encode(message).finish(); + }, + toProtoMsg(message: Version): VersionProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.Version", + value: Version.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Version.typeUrl, Version); +GlobalDecoderRegistry.registerAminoProtoMapping(Version.aminoType, Version.typeUrl); +function createBaseParams(): Params { + return { + maxExpectedTimePerBlock: BigInt(0) + }; +} +export const Params = { + typeUrl: "/ibc.core.connection.v1.Params", + aminoType: "cosmos-sdk/Params", + is(o: any): o is Params { + return o && (o.$typeUrl === Params.typeUrl || typeof o.maxExpectedTimePerBlock === "bigint"); + }, + isAmino(o: any): o is ParamsAmino { + return o && (o.$typeUrl === Params.typeUrl || typeof o.max_expected_time_per_block === "bigint"); + }, + encode(message: Params, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.maxExpectedTimePerBlock !== BigInt(0)) { + writer.uint32(8).uint64(message.maxExpectedTimePerBlock); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Params { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.maxExpectedTimePerBlock = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Params { + const message = createBaseParams(); + message.maxExpectedTimePerBlock = object.maxExpectedTimePerBlock !== undefined && object.maxExpectedTimePerBlock !== null ? BigInt(object.maxExpectedTimePerBlock.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ParamsAmino): Params { + const message = createBaseParams(); + if (object.max_expected_time_per_block !== undefined && object.max_expected_time_per_block !== null) { + message.maxExpectedTimePerBlock = BigInt(object.max_expected_time_per_block); + } + return message; + }, + toAmino(message: Params): ParamsAmino { + const obj: any = {}; + obj.max_expected_time_per_block = message.maxExpectedTimePerBlock !== BigInt(0) ? message.maxExpectedTimePerBlock?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ParamsAminoMsg): Params { + return Params.fromAmino(object.value); + }, + toAminoMsg(message: Params): ParamsAminoMsg { + return { + type: "cosmos-sdk/Params", + value: Params.toAmino(message) + }; + }, + fromProtoMsg(message: ParamsProtoMsg): Params { + return Params.decode(message.value); + }, + toProto(message: Params): Uint8Array { + return Params.encode(message).finish(); + }, + toProtoMsg(message: Params): ParamsProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.Params", + value: Params.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Params.typeUrl, Params); +GlobalDecoderRegistry.registerAminoProtoMapping(Params.aminoType, Params.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/ibc/core/connection/v1/tx.rpc.func.ts b/libs/interchain-query/src/ibc/core/connection/v1/tx.rpc.func.ts new file mode 100644 index 00000000..2c81e862 --- /dev/null +++ b/libs/interchain-query/src/ibc/core/connection/v1/tx.rpc.func.ts @@ -0,0 +1,49 @@ +import { buildTx, SigningClientResolver } from "../../../../helper-func-types"; +import { buildUseMutation } from "../../../../react-query"; +import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; +import { MsgConnectionOpenInit, MsgConnectionOpenTry, MsgConnectionOpenAck, MsgConnectionOpenConfirm, MsgUpdateParams } from "./tx"; +export const createConnectionOpenInit = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgConnectionOpenInit.typeUrl, + encoders: toEncoders(MsgConnectionOpenInit), + converters: toConverters(MsgConnectionOpenInit) +}); +export const useConnectionOpenInit = buildUseMutation({ + builderMutationFn: createConnectionOpenInit +}); +export const createConnectionOpenTry = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgConnectionOpenTry.typeUrl, + encoders: toEncoders(MsgConnectionOpenTry), + converters: toConverters(MsgConnectionOpenTry) +}); +export const useConnectionOpenTry = buildUseMutation({ + builderMutationFn: createConnectionOpenTry +}); +export const createConnectionOpenAck = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgConnectionOpenAck.typeUrl, + encoders: toEncoders(MsgConnectionOpenAck), + converters: toConverters(MsgConnectionOpenAck) +}); +export const useConnectionOpenAck = buildUseMutation({ + builderMutationFn: createConnectionOpenAck +}); +export const createConnectionOpenConfirm = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgConnectionOpenConfirm.typeUrl, + encoders: toEncoders(MsgConnectionOpenConfirm), + converters: toConverters(MsgConnectionOpenConfirm) +}); +export const useConnectionOpenConfirm = buildUseMutation({ + builderMutationFn: createConnectionOpenConfirm +}); +export const createUpdateConnectionParams = (clientResolver?: SigningClientResolver) => buildTx({ + clientResolver, + typeUrl: MsgUpdateParams.typeUrl, + encoders: toEncoders(MsgUpdateParams), + converters: toConverters(MsgUpdateParams) +}); +export const useUpdateConnectionParams = buildUseMutation({ + builderMutationFn: createUpdateConnectionParams +}); \ No newline at end of file diff --git a/libs/interchain-query/src/ibc/core/connection/v1/tx.ts b/libs/interchain-query/src/ibc/core/connection/v1/tx.ts new file mode 100644 index 00000000..cb3ad6d9 --- /dev/null +++ b/libs/interchain-query/src/ibc/core/connection/v1/tx.ts @@ -0,0 +1,1365 @@ +import { Counterparty, CounterpartyAmino, Version, VersionAmino } from "./connection"; +import { Any, AnyAmino } from "../../../../google/protobuf/any"; +import { Height, HeightAmino, Params, ParamsAmino } from "../../client/v1/client"; +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { GlobalDecoderRegistry } from "../../../../registry"; +/** + * MsgConnectionOpenInit defines the msg sent by an account on Chain A to + * initialize a connection with Chain B. + */ +export interface MsgConnectionOpenInit { + clientId: string; + counterparty: Counterparty; + version?: Version; + delayPeriod: bigint; + signer: string; +} +export interface MsgConnectionOpenInitProtoMsg { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenInit"; + value: Uint8Array; +} +/** + * MsgConnectionOpenInit defines the msg sent by an account on Chain A to + * initialize a connection with Chain B. + */ +export interface MsgConnectionOpenInitAmino { + client_id: string; + counterparty: CounterpartyAmino; + version?: VersionAmino; + delay_period: string; + signer: string; +} +export interface MsgConnectionOpenInitAminoMsg { + type: "cosmos-sdk/MsgConnectionOpenInit"; + value: MsgConnectionOpenInitAmino; +} +/** + * MsgConnectionOpenInitResponse defines the Msg/ConnectionOpenInit response + * type. + */ +export interface MsgConnectionOpenInitResponse {} +export interface MsgConnectionOpenInitResponseProtoMsg { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenInitResponse"; + value: Uint8Array; +} +/** + * MsgConnectionOpenInitResponse defines the Msg/ConnectionOpenInit response + * type. + */ +export interface MsgConnectionOpenInitResponseAmino {} +export interface MsgConnectionOpenInitResponseAminoMsg { + type: "cosmos-sdk/MsgConnectionOpenInitResponse"; + value: MsgConnectionOpenInitResponseAmino; +} +/** + * MsgConnectionOpenTry defines a msg sent by a Relayer to try to open a + * connection on Chain B. + */ +export interface MsgConnectionOpenTry { + clientId: string; + /** Deprecated: this field is unused. Crossing hellos are no longer supported in core IBC. */ + /** @deprecated */ + previousConnectionId: string; + clientState?: Any; + counterparty: Counterparty; + delayPeriod: bigint; + counterpartyVersions: Version[]; + proofHeight: Height; + /** + * proof of the initialization the connection on Chain A: `UNINITIALIZED -> + * INIT` + */ + proofInit: Uint8Array; + /** proof of client state included in message */ + proofClient: Uint8Array; + /** proof of client consensus state */ + proofConsensus: Uint8Array; + consensusHeight: Height; + signer: string; + /** optional proof data for host state machines that are unable to introspect their own consensus state */ + hostConsensusStateProof: Uint8Array; +} +export interface MsgConnectionOpenTryProtoMsg { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTry"; + value: Uint8Array; +} +/** + * MsgConnectionOpenTry defines a msg sent by a Relayer to try to open a + * connection on Chain B. + */ +export interface MsgConnectionOpenTryAmino { + client_id: string; + /** Deprecated: this field is unused. Crossing hellos are no longer supported in core IBC. */ + /** @deprecated */ + previous_connection_id: string; + client_state?: AnyAmino; + counterparty: CounterpartyAmino; + delay_period: string; + counterparty_versions: VersionAmino[]; + proof_height: HeightAmino; + /** + * proof of the initialization the connection on Chain A: `UNINITIALIZED -> + * INIT` + */ + proof_init: string; + /** proof of client state included in message */ + proof_client: string; + /** proof of client consensus state */ + proof_consensus: string; + consensus_height: HeightAmino; + signer: string; + /** optional proof data for host state machines that are unable to introspect their own consensus state */ + host_consensus_state_proof: string; +} +export interface MsgConnectionOpenTryAminoMsg { + type: "cosmos-sdk/MsgConnectionOpenTry"; + value: MsgConnectionOpenTryAmino; +} +/** MsgConnectionOpenTryResponse defines the Msg/ConnectionOpenTry response type. */ +export interface MsgConnectionOpenTryResponse {} +export interface MsgConnectionOpenTryResponseProtoMsg { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTryResponse"; + value: Uint8Array; +} +/** MsgConnectionOpenTryResponse defines the Msg/ConnectionOpenTry response type. */ +export interface MsgConnectionOpenTryResponseAmino {} +export interface MsgConnectionOpenTryResponseAminoMsg { + type: "cosmos-sdk/MsgConnectionOpenTryResponse"; + value: MsgConnectionOpenTryResponseAmino; +} +/** + * MsgConnectionOpenAck defines a msg sent by a Relayer to Chain A to + * acknowledge the change of connection state to TRYOPEN on Chain B. + */ +export interface MsgConnectionOpenAck { + connectionId: string; + counterpartyConnectionId: string; + version?: Version; + clientState?: Any; + proofHeight: Height; + /** + * proof of the initialization the connection on Chain B: `UNINITIALIZED -> + * TRYOPEN` + */ + proofTry: Uint8Array; + /** proof of client state included in message */ + proofClient: Uint8Array; + /** proof of client consensus state */ + proofConsensus: Uint8Array; + consensusHeight: Height; + signer: string; + /** optional proof data for host state machines that are unable to introspect their own consensus state */ + hostConsensusStateProof: Uint8Array; +} +export interface MsgConnectionOpenAckProtoMsg { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAck"; + value: Uint8Array; +} +/** + * MsgConnectionOpenAck defines a msg sent by a Relayer to Chain A to + * acknowledge the change of connection state to TRYOPEN on Chain B. + */ +export interface MsgConnectionOpenAckAmino { + connection_id: string; + counterparty_connection_id: string; + version?: VersionAmino; + client_state?: AnyAmino; + proof_height: HeightAmino; + /** + * proof of the initialization the connection on Chain B: `UNINITIALIZED -> + * TRYOPEN` + */ + proof_try: string; + /** proof of client state included in message */ + proof_client: string; + /** proof of client consensus state */ + proof_consensus: string; + consensus_height: HeightAmino; + signer: string; + /** optional proof data for host state machines that are unable to introspect their own consensus state */ + host_consensus_state_proof: string; +} +export interface MsgConnectionOpenAckAminoMsg { + type: "cosmos-sdk/MsgConnectionOpenAck"; + value: MsgConnectionOpenAckAmino; +} +/** MsgConnectionOpenAckResponse defines the Msg/ConnectionOpenAck response type. */ +export interface MsgConnectionOpenAckResponse {} +export interface MsgConnectionOpenAckResponseProtoMsg { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAckResponse"; + value: Uint8Array; +} +/** MsgConnectionOpenAckResponse defines the Msg/ConnectionOpenAck response type. */ +export interface MsgConnectionOpenAckResponseAmino {} +export interface MsgConnectionOpenAckResponseAminoMsg { + type: "cosmos-sdk/MsgConnectionOpenAckResponse"; + value: MsgConnectionOpenAckResponseAmino; +} +/** + * MsgConnectionOpenConfirm defines a msg sent by a Relayer to Chain B to + * acknowledge the change of connection state to OPEN on Chain A. + */ +export interface MsgConnectionOpenConfirm { + connectionId: string; + /** proof for the change of the connection state on Chain A: `INIT -> OPEN` */ + proofAck: Uint8Array; + proofHeight: Height; + signer: string; +} +export interface MsgConnectionOpenConfirmProtoMsg { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirm"; + value: Uint8Array; +} +/** + * MsgConnectionOpenConfirm defines a msg sent by a Relayer to Chain B to + * acknowledge the change of connection state to OPEN on Chain A. + */ +export interface MsgConnectionOpenConfirmAmino { + connection_id: string; + /** proof for the change of the connection state on Chain A: `INIT -> OPEN` */ + proof_ack: string; + proof_height: HeightAmino; + signer: string; +} +export interface MsgConnectionOpenConfirmAminoMsg { + type: "cosmos-sdk/MsgConnectionOpenConfirm"; + value: MsgConnectionOpenConfirmAmino; +} +/** + * MsgConnectionOpenConfirmResponse defines the Msg/ConnectionOpenConfirm + * response type. + */ +export interface MsgConnectionOpenConfirmResponse {} +export interface MsgConnectionOpenConfirmResponseProtoMsg { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirmResponse"; + value: Uint8Array; +} +/** + * MsgConnectionOpenConfirmResponse defines the Msg/ConnectionOpenConfirm + * response type. + */ +export interface MsgConnectionOpenConfirmResponseAmino {} +export interface MsgConnectionOpenConfirmResponseAminoMsg { + type: "cosmos-sdk/MsgConnectionOpenConfirmResponse"; + value: MsgConnectionOpenConfirmResponseAmino; +} +/** MsgUpdateParams defines the sdk.Msg type to update the connection parameters. */ +export interface MsgUpdateParams { + /** signer address */ + signer: string; + /** + * params defines the connection parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: Params; +} +export interface MsgUpdateParamsProtoMsg { + typeUrl: "/ibc.core.connection.v1.MsgUpdateParams"; + value: Uint8Array; +} +/** MsgUpdateParams defines the sdk.Msg type to update the connection parameters. */ +export interface MsgUpdateParamsAmino { + /** signer address */ + signer: string; + /** + * params defines the connection parameters to update. + * + * NOTE: All parameters must be supplied. + */ + params: ParamsAmino; +} +export interface MsgUpdateParamsAminoMsg { + type: "cosmos-sdk/MsgUpdateParams"; + value: MsgUpdateParamsAmino; +} +/** MsgUpdateParamsResponse defines the MsgUpdateParams response type. */ +export interface MsgUpdateParamsResponse {} +export interface MsgUpdateParamsResponseProtoMsg { + typeUrl: "/ibc.core.connection.v1.MsgUpdateParamsResponse"; + value: Uint8Array; +} +/** MsgUpdateParamsResponse defines the MsgUpdateParams response type. */ +export interface MsgUpdateParamsResponseAmino {} +export interface MsgUpdateParamsResponseAminoMsg { + type: "cosmos-sdk/MsgUpdateParamsResponse"; + value: MsgUpdateParamsResponseAmino; +} +function createBaseMsgConnectionOpenInit(): MsgConnectionOpenInit { + return { + clientId: "", + counterparty: Counterparty.fromPartial({}), + version: undefined, + delayPeriod: BigInt(0), + signer: "" + }; +} +export const MsgConnectionOpenInit = { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenInit", + aminoType: "cosmos-sdk/MsgConnectionOpenInit", + is(o: any): o is MsgConnectionOpenInit { + return o && (o.$typeUrl === MsgConnectionOpenInit.typeUrl || typeof o.clientId === "string" && Counterparty.is(o.counterparty) && typeof o.delayPeriod === "bigint" && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgConnectionOpenInitAmino { + return o && (o.$typeUrl === MsgConnectionOpenInit.typeUrl || typeof o.client_id === "string" && Counterparty.isAmino(o.counterparty) && typeof o.delay_period === "bigint" && typeof o.signer === "string"); + }, + encode(message: MsgConnectionOpenInit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.counterparty !== undefined) { + Counterparty.encode(message.counterparty, writer.uint32(18).fork()).ldelim(); + } + if (message.version !== undefined) { + Version.encode(message.version, writer.uint32(26).fork()).ldelim(); + } + if (message.delayPeriod !== BigInt(0)) { + writer.uint32(32).uint64(message.delayPeriod); + } + if (message.signer !== "") { + writer.uint32(42).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgConnectionOpenInit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgConnectionOpenInit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.counterparty = Counterparty.decode(reader, reader.uint32()); + break; + case 3: + message.version = Version.decode(reader, reader.uint32()); + break; + case 4: + message.delayPeriod = reader.uint64(); + break; + case 5: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgConnectionOpenInit { + const message = createBaseMsgConnectionOpenInit(); + message.clientId = object.clientId ?? ""; + message.counterparty = object.counterparty !== undefined && object.counterparty !== null ? Counterparty.fromPartial(object.counterparty) : undefined; + message.version = object.version !== undefined && object.version !== null ? Version.fromPartial(object.version) : undefined; + message.delayPeriod = object.delayPeriod !== undefined && object.delayPeriod !== null ? BigInt(object.delayPeriod.toString()) : BigInt(0); + message.signer = object.signer ?? ""; + return message; + }, + fromAmino(object: MsgConnectionOpenInitAmino): MsgConnectionOpenInit { + const message = createBaseMsgConnectionOpenInit(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + if (object.counterparty !== undefined && object.counterparty !== null) { + message.counterparty = Counterparty.fromAmino(object.counterparty); + } + if (object.version !== undefined && object.version !== null) { + message.version = Version.fromAmino(object.version); + } + if (object.delay_period !== undefined && object.delay_period !== null) { + message.delayPeriod = BigInt(object.delay_period); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgConnectionOpenInit): MsgConnectionOpenInitAmino { + const obj: any = {}; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; + obj.version = message.version ? Version.toAmino(message.version) : undefined; + obj.delay_period = message.delayPeriod !== BigInt(0) ? message.delayPeriod?.toString() : undefined; + obj.signer = message.signer === "" ? undefined : message.signer; + return obj; + }, + fromAminoMsg(object: MsgConnectionOpenInitAminoMsg): MsgConnectionOpenInit { + return MsgConnectionOpenInit.fromAmino(object.value); + }, + toAminoMsg(message: MsgConnectionOpenInit): MsgConnectionOpenInitAminoMsg { + return { + type: "cosmos-sdk/MsgConnectionOpenInit", + value: MsgConnectionOpenInit.toAmino(message) + }; + }, + fromProtoMsg(message: MsgConnectionOpenInitProtoMsg): MsgConnectionOpenInit { + return MsgConnectionOpenInit.decode(message.value); + }, + toProto(message: MsgConnectionOpenInit): Uint8Array { + return MsgConnectionOpenInit.encode(message).finish(); + }, + toProtoMsg(message: MsgConnectionOpenInit): MsgConnectionOpenInitProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenInit", + value: MsgConnectionOpenInit.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgConnectionOpenInit.typeUrl, MsgConnectionOpenInit); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgConnectionOpenInit.aminoType, MsgConnectionOpenInit.typeUrl); +function createBaseMsgConnectionOpenInitResponse(): MsgConnectionOpenInitResponse { + return {}; +} +export const MsgConnectionOpenInitResponse = { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenInitResponse", + aminoType: "cosmos-sdk/MsgConnectionOpenInitResponse", + is(o: any): o is MsgConnectionOpenInitResponse { + return o && o.$typeUrl === MsgConnectionOpenInitResponse.typeUrl; + }, + isAmino(o: any): o is MsgConnectionOpenInitResponseAmino { + return o && o.$typeUrl === MsgConnectionOpenInitResponse.typeUrl; + }, + encode(_: MsgConnectionOpenInitResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgConnectionOpenInitResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgConnectionOpenInitResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgConnectionOpenInitResponse { + const message = createBaseMsgConnectionOpenInitResponse(); + return message; + }, + fromAmino(_: MsgConnectionOpenInitResponseAmino): MsgConnectionOpenInitResponse { + const message = createBaseMsgConnectionOpenInitResponse(); + return message; + }, + toAmino(_: MsgConnectionOpenInitResponse): MsgConnectionOpenInitResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgConnectionOpenInitResponseAminoMsg): MsgConnectionOpenInitResponse { + return MsgConnectionOpenInitResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgConnectionOpenInitResponse): MsgConnectionOpenInitResponseAminoMsg { + return { + type: "cosmos-sdk/MsgConnectionOpenInitResponse", + value: MsgConnectionOpenInitResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgConnectionOpenInitResponseProtoMsg): MsgConnectionOpenInitResponse { + return MsgConnectionOpenInitResponse.decode(message.value); + }, + toProto(message: MsgConnectionOpenInitResponse): Uint8Array { + return MsgConnectionOpenInitResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgConnectionOpenInitResponse): MsgConnectionOpenInitResponseProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenInitResponse", + value: MsgConnectionOpenInitResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgConnectionOpenInitResponse.typeUrl, MsgConnectionOpenInitResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgConnectionOpenInitResponse.aminoType, MsgConnectionOpenInitResponse.typeUrl); +function createBaseMsgConnectionOpenTry(): MsgConnectionOpenTry { + return { + clientId: "", + previousConnectionId: "", + clientState: undefined, + counterparty: Counterparty.fromPartial({}), + delayPeriod: BigInt(0), + counterpartyVersions: [], + proofHeight: Height.fromPartial({}), + proofInit: new Uint8Array(), + proofClient: new Uint8Array(), + proofConsensus: new Uint8Array(), + consensusHeight: Height.fromPartial({}), + signer: "", + hostConsensusStateProof: new Uint8Array() + }; +} +export const MsgConnectionOpenTry = { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTry", + aminoType: "cosmos-sdk/MsgConnectionOpenTry", + is(o: any): o is MsgConnectionOpenTry { + return o && (o.$typeUrl === MsgConnectionOpenTry.typeUrl || typeof o.clientId === "string" && typeof o.previousConnectionId === "string" && Counterparty.is(o.counterparty) && typeof o.delayPeriod === "bigint" && Array.isArray(o.counterpartyVersions) && (!o.counterpartyVersions.length || Version.is(o.counterpartyVersions[0])) && Height.is(o.proofHeight) && (o.proofInit instanceof Uint8Array || typeof o.proofInit === "string") && (o.proofClient instanceof Uint8Array || typeof o.proofClient === "string") && (o.proofConsensus instanceof Uint8Array || typeof o.proofConsensus === "string") && Height.is(o.consensusHeight) && typeof o.signer === "string" && (o.hostConsensusStateProof instanceof Uint8Array || typeof o.hostConsensusStateProof === "string")); + }, + isAmino(o: any): o is MsgConnectionOpenTryAmino { + return o && (o.$typeUrl === MsgConnectionOpenTry.typeUrl || typeof o.client_id === "string" && typeof o.previous_connection_id === "string" && Counterparty.isAmino(o.counterparty) && typeof o.delay_period === "bigint" && Array.isArray(o.counterparty_versions) && (!o.counterparty_versions.length || Version.isAmino(o.counterparty_versions[0])) && Height.isAmino(o.proof_height) && (o.proof_init instanceof Uint8Array || typeof o.proof_init === "string") && (o.proof_client instanceof Uint8Array || typeof o.proof_client === "string") && (o.proof_consensus instanceof Uint8Array || typeof o.proof_consensus === "string") && Height.isAmino(o.consensus_height) && typeof o.signer === "string" && (o.host_consensus_state_proof instanceof Uint8Array || typeof o.host_consensus_state_proof === "string")); + }, + encode(message: MsgConnectionOpenTry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.clientId !== "") { + writer.uint32(10).string(message.clientId); + } + if (message.previousConnectionId !== "") { + writer.uint32(18).string(message.previousConnectionId); + } + if (message.clientState !== undefined) { + Any.encode(message.clientState, writer.uint32(26).fork()).ldelim(); + } + if (message.counterparty !== undefined) { + Counterparty.encode(message.counterparty, writer.uint32(34).fork()).ldelim(); + } + if (message.delayPeriod !== BigInt(0)) { + writer.uint32(40).uint64(message.delayPeriod); + } + for (const v of message.counterpartyVersions) { + Version.encode(v!, writer.uint32(50).fork()).ldelim(); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(58).fork()).ldelim(); + } + if (message.proofInit.length !== 0) { + writer.uint32(66).bytes(message.proofInit); + } + if (message.proofClient.length !== 0) { + writer.uint32(74).bytes(message.proofClient); + } + if (message.proofConsensus.length !== 0) { + writer.uint32(82).bytes(message.proofConsensus); + } + if (message.consensusHeight !== undefined) { + Height.encode(message.consensusHeight, writer.uint32(90).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(98).string(message.signer); + } + if (message.hostConsensusStateProof.length !== 0) { + writer.uint32(106).bytes(message.hostConsensusStateProof); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgConnectionOpenTry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgConnectionOpenTry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.clientId = reader.string(); + break; + case 2: + message.previousConnectionId = reader.string(); + break; + case 3: + message.clientState = Any.decode(reader, reader.uint32()); + break; + case 4: + message.counterparty = Counterparty.decode(reader, reader.uint32()); + break; + case 5: + message.delayPeriod = reader.uint64(); + break; + case 6: + message.counterpartyVersions.push(Version.decode(reader, reader.uint32())); + break; + case 7: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + case 8: + message.proofInit = reader.bytes(); + break; + case 9: + message.proofClient = reader.bytes(); + break; + case 10: + message.proofConsensus = reader.bytes(); + break; + case 11: + message.consensusHeight = Height.decode(reader, reader.uint32()); + break; + case 12: + message.signer = reader.string(); + break; + case 13: + message.hostConsensusStateProof = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgConnectionOpenTry { + const message = createBaseMsgConnectionOpenTry(); + message.clientId = object.clientId ?? ""; + message.previousConnectionId = object.previousConnectionId ?? ""; + message.clientState = object.clientState !== undefined && object.clientState !== null ? Any.fromPartial(object.clientState) : undefined; + message.counterparty = object.counterparty !== undefined && object.counterparty !== null ? Counterparty.fromPartial(object.counterparty) : undefined; + message.delayPeriod = object.delayPeriod !== undefined && object.delayPeriod !== null ? BigInt(object.delayPeriod.toString()) : BigInt(0); + message.counterpartyVersions = object.counterpartyVersions?.map(e => Version.fromPartial(e)) || []; + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; + message.proofInit = object.proofInit ?? new Uint8Array(); + message.proofClient = object.proofClient ?? new Uint8Array(); + message.proofConsensus = object.proofConsensus ?? new Uint8Array(); + message.consensusHeight = object.consensusHeight !== undefined && object.consensusHeight !== null ? Height.fromPartial(object.consensusHeight) : undefined; + message.signer = object.signer ?? ""; + message.hostConsensusStateProof = object.hostConsensusStateProof ?? new Uint8Array(); + return message; + }, + fromAmino(object: MsgConnectionOpenTryAmino): MsgConnectionOpenTry { + const message = createBaseMsgConnectionOpenTry(); + if (object.client_id !== undefined && object.client_id !== null) { + message.clientId = object.client_id; + } + if (object.previous_connection_id !== undefined && object.previous_connection_id !== null) { + message.previousConnectionId = object.previous_connection_id; + } + if (object.client_state !== undefined && object.client_state !== null) { + message.clientState = Any.fromAmino(object.client_state); + } + if (object.counterparty !== undefined && object.counterparty !== null) { + message.counterparty = Counterparty.fromAmino(object.counterparty); + } + if (object.delay_period !== undefined && object.delay_period !== null) { + message.delayPeriod = BigInt(object.delay_period); + } + message.counterpartyVersions = object.counterparty_versions?.map(e => Version.fromAmino(e)) || []; + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + if (object.proof_init !== undefined && object.proof_init !== null) { + message.proofInit = bytesFromBase64(object.proof_init); + } + if (object.proof_client !== undefined && object.proof_client !== null) { + message.proofClient = bytesFromBase64(object.proof_client); + } + if (object.proof_consensus !== undefined && object.proof_consensus !== null) { + message.proofConsensus = bytesFromBase64(object.proof_consensus); + } + if (object.consensus_height !== undefined && object.consensus_height !== null) { + message.consensusHeight = Height.fromAmino(object.consensus_height); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + if (object.host_consensus_state_proof !== undefined && object.host_consensus_state_proof !== null) { + message.hostConsensusStateProof = bytesFromBase64(object.host_consensus_state_proof); + } + return message; + }, + toAmino(message: MsgConnectionOpenTry): MsgConnectionOpenTryAmino { + const obj: any = {}; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + obj.previous_connection_id = message.previousConnectionId === "" ? undefined : message.previousConnectionId; + obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; + obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; + obj.delay_period = message.delayPeriod !== BigInt(0) ? message.delayPeriod?.toString() : undefined; + if (message.counterpartyVersions) { + obj.counterparty_versions = message.counterpartyVersions.map(e => e ? Version.toAmino(e) : undefined); + } else { + obj.counterparty_versions = message.counterpartyVersions; + } + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + obj.proof_init = message.proofInit ? base64FromBytes(message.proofInit) : undefined; + obj.proof_client = message.proofClient ? base64FromBytes(message.proofClient) : undefined; + obj.proof_consensus = message.proofConsensus ? base64FromBytes(message.proofConsensus) : undefined; + obj.consensus_height = message.consensusHeight ? Height.toAmino(message.consensusHeight) : {}; + obj.signer = message.signer === "" ? undefined : message.signer; + obj.host_consensus_state_proof = message.hostConsensusStateProof ? base64FromBytes(message.hostConsensusStateProof) : undefined; + return obj; + }, + fromAminoMsg(object: MsgConnectionOpenTryAminoMsg): MsgConnectionOpenTry { + return MsgConnectionOpenTry.fromAmino(object.value); + }, + toAminoMsg(message: MsgConnectionOpenTry): MsgConnectionOpenTryAminoMsg { + return { + type: "cosmos-sdk/MsgConnectionOpenTry", + value: MsgConnectionOpenTry.toAmino(message) + }; + }, + fromProtoMsg(message: MsgConnectionOpenTryProtoMsg): MsgConnectionOpenTry { + return MsgConnectionOpenTry.decode(message.value); + }, + toProto(message: MsgConnectionOpenTry): Uint8Array { + return MsgConnectionOpenTry.encode(message).finish(); + }, + toProtoMsg(message: MsgConnectionOpenTry): MsgConnectionOpenTryProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTry", + value: MsgConnectionOpenTry.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgConnectionOpenTry.typeUrl, MsgConnectionOpenTry); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgConnectionOpenTry.aminoType, MsgConnectionOpenTry.typeUrl); +function createBaseMsgConnectionOpenTryResponse(): MsgConnectionOpenTryResponse { + return {}; +} +export const MsgConnectionOpenTryResponse = { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTryResponse", + aminoType: "cosmos-sdk/MsgConnectionOpenTryResponse", + is(o: any): o is MsgConnectionOpenTryResponse { + return o && o.$typeUrl === MsgConnectionOpenTryResponse.typeUrl; + }, + isAmino(o: any): o is MsgConnectionOpenTryResponseAmino { + return o && o.$typeUrl === MsgConnectionOpenTryResponse.typeUrl; + }, + encode(_: MsgConnectionOpenTryResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgConnectionOpenTryResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgConnectionOpenTryResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgConnectionOpenTryResponse { + const message = createBaseMsgConnectionOpenTryResponse(); + return message; + }, + fromAmino(_: MsgConnectionOpenTryResponseAmino): MsgConnectionOpenTryResponse { + const message = createBaseMsgConnectionOpenTryResponse(); + return message; + }, + toAmino(_: MsgConnectionOpenTryResponse): MsgConnectionOpenTryResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgConnectionOpenTryResponseAminoMsg): MsgConnectionOpenTryResponse { + return MsgConnectionOpenTryResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgConnectionOpenTryResponse): MsgConnectionOpenTryResponseAminoMsg { + return { + type: "cosmos-sdk/MsgConnectionOpenTryResponse", + value: MsgConnectionOpenTryResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgConnectionOpenTryResponseProtoMsg): MsgConnectionOpenTryResponse { + return MsgConnectionOpenTryResponse.decode(message.value); + }, + toProto(message: MsgConnectionOpenTryResponse): Uint8Array { + return MsgConnectionOpenTryResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgConnectionOpenTryResponse): MsgConnectionOpenTryResponseProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenTryResponse", + value: MsgConnectionOpenTryResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgConnectionOpenTryResponse.typeUrl, MsgConnectionOpenTryResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgConnectionOpenTryResponse.aminoType, MsgConnectionOpenTryResponse.typeUrl); +function createBaseMsgConnectionOpenAck(): MsgConnectionOpenAck { + return { + connectionId: "", + counterpartyConnectionId: "", + version: undefined, + clientState: undefined, + proofHeight: Height.fromPartial({}), + proofTry: new Uint8Array(), + proofClient: new Uint8Array(), + proofConsensus: new Uint8Array(), + consensusHeight: Height.fromPartial({}), + signer: "", + hostConsensusStateProof: new Uint8Array() + }; +} +export const MsgConnectionOpenAck = { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAck", + aminoType: "cosmos-sdk/MsgConnectionOpenAck", + is(o: any): o is MsgConnectionOpenAck { + return o && (o.$typeUrl === MsgConnectionOpenAck.typeUrl || typeof o.connectionId === "string" && typeof o.counterpartyConnectionId === "string" && Height.is(o.proofHeight) && (o.proofTry instanceof Uint8Array || typeof o.proofTry === "string") && (o.proofClient instanceof Uint8Array || typeof o.proofClient === "string") && (o.proofConsensus instanceof Uint8Array || typeof o.proofConsensus === "string") && Height.is(o.consensusHeight) && typeof o.signer === "string" && (o.hostConsensusStateProof instanceof Uint8Array || typeof o.hostConsensusStateProof === "string")); + }, + isAmino(o: any): o is MsgConnectionOpenAckAmino { + return o && (o.$typeUrl === MsgConnectionOpenAck.typeUrl || typeof o.connection_id === "string" && typeof o.counterparty_connection_id === "string" && Height.isAmino(o.proof_height) && (o.proof_try instanceof Uint8Array || typeof o.proof_try === "string") && (o.proof_client instanceof Uint8Array || typeof o.proof_client === "string") && (o.proof_consensus instanceof Uint8Array || typeof o.proof_consensus === "string") && Height.isAmino(o.consensus_height) && typeof o.signer === "string" && (o.host_consensus_state_proof instanceof Uint8Array || typeof o.host_consensus_state_proof === "string")); + }, + encode(message: MsgConnectionOpenAck, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.connectionId !== "") { + writer.uint32(10).string(message.connectionId); + } + if (message.counterpartyConnectionId !== "") { + writer.uint32(18).string(message.counterpartyConnectionId); + } + if (message.version !== undefined) { + Version.encode(message.version, writer.uint32(26).fork()).ldelim(); + } + if (message.clientState !== undefined) { + Any.encode(message.clientState, writer.uint32(34).fork()).ldelim(); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(42).fork()).ldelim(); + } + if (message.proofTry.length !== 0) { + writer.uint32(50).bytes(message.proofTry); + } + if (message.proofClient.length !== 0) { + writer.uint32(58).bytes(message.proofClient); + } + if (message.proofConsensus.length !== 0) { + writer.uint32(66).bytes(message.proofConsensus); + } + if (message.consensusHeight !== undefined) { + Height.encode(message.consensusHeight, writer.uint32(74).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(82).string(message.signer); + } + if (message.hostConsensusStateProof.length !== 0) { + writer.uint32(90).bytes(message.hostConsensusStateProof); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgConnectionOpenAck { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgConnectionOpenAck(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.connectionId = reader.string(); + break; + case 2: + message.counterpartyConnectionId = reader.string(); + break; + case 3: + message.version = Version.decode(reader, reader.uint32()); + break; + case 4: + message.clientState = Any.decode(reader, reader.uint32()); + break; + case 5: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + case 6: + message.proofTry = reader.bytes(); + break; + case 7: + message.proofClient = reader.bytes(); + break; + case 8: + message.proofConsensus = reader.bytes(); + break; + case 9: + message.consensusHeight = Height.decode(reader, reader.uint32()); + break; + case 10: + message.signer = reader.string(); + break; + case 11: + message.hostConsensusStateProof = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgConnectionOpenAck { + const message = createBaseMsgConnectionOpenAck(); + message.connectionId = object.connectionId ?? ""; + message.counterpartyConnectionId = object.counterpartyConnectionId ?? ""; + message.version = object.version !== undefined && object.version !== null ? Version.fromPartial(object.version) : undefined; + message.clientState = object.clientState !== undefined && object.clientState !== null ? Any.fromPartial(object.clientState) : undefined; + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; + message.proofTry = object.proofTry ?? new Uint8Array(); + message.proofClient = object.proofClient ?? new Uint8Array(); + message.proofConsensus = object.proofConsensus ?? new Uint8Array(); + message.consensusHeight = object.consensusHeight !== undefined && object.consensusHeight !== null ? Height.fromPartial(object.consensusHeight) : undefined; + message.signer = object.signer ?? ""; + message.hostConsensusStateProof = object.hostConsensusStateProof ?? new Uint8Array(); + return message; + }, + fromAmino(object: MsgConnectionOpenAckAmino): MsgConnectionOpenAck { + const message = createBaseMsgConnectionOpenAck(); + if (object.connection_id !== undefined && object.connection_id !== null) { + message.connectionId = object.connection_id; + } + if (object.counterparty_connection_id !== undefined && object.counterparty_connection_id !== null) { + message.counterpartyConnectionId = object.counterparty_connection_id; + } + if (object.version !== undefined && object.version !== null) { + message.version = Version.fromAmino(object.version); + } + if (object.client_state !== undefined && object.client_state !== null) { + message.clientState = Any.fromAmino(object.client_state); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + if (object.proof_try !== undefined && object.proof_try !== null) { + message.proofTry = bytesFromBase64(object.proof_try); + } + if (object.proof_client !== undefined && object.proof_client !== null) { + message.proofClient = bytesFromBase64(object.proof_client); + } + if (object.proof_consensus !== undefined && object.proof_consensus !== null) { + message.proofConsensus = bytesFromBase64(object.proof_consensus); + } + if (object.consensus_height !== undefined && object.consensus_height !== null) { + message.consensusHeight = Height.fromAmino(object.consensus_height); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + if (object.host_consensus_state_proof !== undefined && object.host_consensus_state_proof !== null) { + message.hostConsensusStateProof = bytesFromBase64(object.host_consensus_state_proof); + } + return message; + }, + toAmino(message: MsgConnectionOpenAck): MsgConnectionOpenAckAmino { + const obj: any = {}; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; + obj.counterparty_connection_id = message.counterpartyConnectionId === "" ? undefined : message.counterpartyConnectionId; + obj.version = message.version ? Version.toAmino(message.version) : undefined; + obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + obj.proof_try = message.proofTry ? base64FromBytes(message.proofTry) : undefined; + obj.proof_client = message.proofClient ? base64FromBytes(message.proofClient) : undefined; + obj.proof_consensus = message.proofConsensus ? base64FromBytes(message.proofConsensus) : undefined; + obj.consensus_height = message.consensusHeight ? Height.toAmino(message.consensusHeight) : {}; + obj.signer = message.signer === "" ? undefined : message.signer; + obj.host_consensus_state_proof = message.hostConsensusStateProof ? base64FromBytes(message.hostConsensusStateProof) : undefined; + return obj; + }, + fromAminoMsg(object: MsgConnectionOpenAckAminoMsg): MsgConnectionOpenAck { + return MsgConnectionOpenAck.fromAmino(object.value); + }, + toAminoMsg(message: MsgConnectionOpenAck): MsgConnectionOpenAckAminoMsg { + return { + type: "cosmos-sdk/MsgConnectionOpenAck", + value: MsgConnectionOpenAck.toAmino(message) + }; + }, + fromProtoMsg(message: MsgConnectionOpenAckProtoMsg): MsgConnectionOpenAck { + return MsgConnectionOpenAck.decode(message.value); + }, + toProto(message: MsgConnectionOpenAck): Uint8Array { + return MsgConnectionOpenAck.encode(message).finish(); + }, + toProtoMsg(message: MsgConnectionOpenAck): MsgConnectionOpenAckProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAck", + value: MsgConnectionOpenAck.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgConnectionOpenAck.typeUrl, MsgConnectionOpenAck); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgConnectionOpenAck.aminoType, MsgConnectionOpenAck.typeUrl); +function createBaseMsgConnectionOpenAckResponse(): MsgConnectionOpenAckResponse { + return {}; +} +export const MsgConnectionOpenAckResponse = { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAckResponse", + aminoType: "cosmos-sdk/MsgConnectionOpenAckResponse", + is(o: any): o is MsgConnectionOpenAckResponse { + return o && o.$typeUrl === MsgConnectionOpenAckResponse.typeUrl; + }, + isAmino(o: any): o is MsgConnectionOpenAckResponseAmino { + return o && o.$typeUrl === MsgConnectionOpenAckResponse.typeUrl; + }, + encode(_: MsgConnectionOpenAckResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgConnectionOpenAckResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgConnectionOpenAckResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgConnectionOpenAckResponse { + const message = createBaseMsgConnectionOpenAckResponse(); + return message; + }, + fromAmino(_: MsgConnectionOpenAckResponseAmino): MsgConnectionOpenAckResponse { + const message = createBaseMsgConnectionOpenAckResponse(); + return message; + }, + toAmino(_: MsgConnectionOpenAckResponse): MsgConnectionOpenAckResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgConnectionOpenAckResponseAminoMsg): MsgConnectionOpenAckResponse { + return MsgConnectionOpenAckResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgConnectionOpenAckResponse): MsgConnectionOpenAckResponseAminoMsg { + return { + type: "cosmos-sdk/MsgConnectionOpenAckResponse", + value: MsgConnectionOpenAckResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgConnectionOpenAckResponseProtoMsg): MsgConnectionOpenAckResponse { + return MsgConnectionOpenAckResponse.decode(message.value); + }, + toProto(message: MsgConnectionOpenAckResponse): Uint8Array { + return MsgConnectionOpenAckResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgConnectionOpenAckResponse): MsgConnectionOpenAckResponseProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenAckResponse", + value: MsgConnectionOpenAckResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgConnectionOpenAckResponse.typeUrl, MsgConnectionOpenAckResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgConnectionOpenAckResponse.aminoType, MsgConnectionOpenAckResponse.typeUrl); +function createBaseMsgConnectionOpenConfirm(): MsgConnectionOpenConfirm { + return { + connectionId: "", + proofAck: new Uint8Array(), + proofHeight: Height.fromPartial({}), + signer: "" + }; +} +export const MsgConnectionOpenConfirm = { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirm", + aminoType: "cosmos-sdk/MsgConnectionOpenConfirm", + is(o: any): o is MsgConnectionOpenConfirm { + return o && (o.$typeUrl === MsgConnectionOpenConfirm.typeUrl || typeof o.connectionId === "string" && (o.proofAck instanceof Uint8Array || typeof o.proofAck === "string") && Height.is(o.proofHeight) && typeof o.signer === "string"); + }, + isAmino(o: any): o is MsgConnectionOpenConfirmAmino { + return o && (o.$typeUrl === MsgConnectionOpenConfirm.typeUrl || typeof o.connection_id === "string" && (o.proof_ack instanceof Uint8Array || typeof o.proof_ack === "string") && Height.isAmino(o.proof_height) && typeof o.signer === "string"); + }, + encode(message: MsgConnectionOpenConfirm, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.connectionId !== "") { + writer.uint32(10).string(message.connectionId); + } + if (message.proofAck.length !== 0) { + writer.uint32(18).bytes(message.proofAck); + } + if (message.proofHeight !== undefined) { + Height.encode(message.proofHeight, writer.uint32(26).fork()).ldelim(); + } + if (message.signer !== "") { + writer.uint32(34).string(message.signer); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgConnectionOpenConfirm { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgConnectionOpenConfirm(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.connectionId = reader.string(); + break; + case 2: + message.proofAck = reader.bytes(); + break; + case 3: + message.proofHeight = Height.decode(reader, reader.uint32()); + break; + case 4: + message.signer = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgConnectionOpenConfirm { + const message = createBaseMsgConnectionOpenConfirm(); + message.connectionId = object.connectionId ?? ""; + message.proofAck = object.proofAck ?? new Uint8Array(); + message.proofHeight = object.proofHeight !== undefined && object.proofHeight !== null ? Height.fromPartial(object.proofHeight) : undefined; + message.signer = object.signer ?? ""; + return message; + }, + fromAmino(object: MsgConnectionOpenConfirmAmino): MsgConnectionOpenConfirm { + const message = createBaseMsgConnectionOpenConfirm(); + if (object.connection_id !== undefined && object.connection_id !== null) { + message.connectionId = object.connection_id; + } + if (object.proof_ack !== undefined && object.proof_ack !== null) { + message.proofAck = bytesFromBase64(object.proof_ack); + } + if (object.proof_height !== undefined && object.proof_height !== null) { + message.proofHeight = Height.fromAmino(object.proof_height); + } + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + return message; + }, + toAmino(message: MsgConnectionOpenConfirm): MsgConnectionOpenConfirmAmino { + const obj: any = {}; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; + obj.proof_ack = message.proofAck ? base64FromBytes(message.proofAck) : undefined; + obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; + obj.signer = message.signer === "" ? undefined : message.signer; + return obj; + }, + fromAminoMsg(object: MsgConnectionOpenConfirmAminoMsg): MsgConnectionOpenConfirm { + return MsgConnectionOpenConfirm.fromAmino(object.value); + }, + toAminoMsg(message: MsgConnectionOpenConfirm): MsgConnectionOpenConfirmAminoMsg { + return { + type: "cosmos-sdk/MsgConnectionOpenConfirm", + value: MsgConnectionOpenConfirm.toAmino(message) + }; + }, + fromProtoMsg(message: MsgConnectionOpenConfirmProtoMsg): MsgConnectionOpenConfirm { + return MsgConnectionOpenConfirm.decode(message.value); + }, + toProto(message: MsgConnectionOpenConfirm): Uint8Array { + return MsgConnectionOpenConfirm.encode(message).finish(); + }, + toProtoMsg(message: MsgConnectionOpenConfirm): MsgConnectionOpenConfirmProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirm", + value: MsgConnectionOpenConfirm.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgConnectionOpenConfirm.typeUrl, MsgConnectionOpenConfirm); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgConnectionOpenConfirm.aminoType, MsgConnectionOpenConfirm.typeUrl); +function createBaseMsgConnectionOpenConfirmResponse(): MsgConnectionOpenConfirmResponse { + return {}; +} +export const MsgConnectionOpenConfirmResponse = { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirmResponse", + aminoType: "cosmos-sdk/MsgConnectionOpenConfirmResponse", + is(o: any): o is MsgConnectionOpenConfirmResponse { + return o && o.$typeUrl === MsgConnectionOpenConfirmResponse.typeUrl; + }, + isAmino(o: any): o is MsgConnectionOpenConfirmResponseAmino { + return o && o.$typeUrl === MsgConnectionOpenConfirmResponse.typeUrl; + }, + encode(_: MsgConnectionOpenConfirmResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgConnectionOpenConfirmResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgConnectionOpenConfirmResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgConnectionOpenConfirmResponse { + const message = createBaseMsgConnectionOpenConfirmResponse(); + return message; + }, + fromAmino(_: MsgConnectionOpenConfirmResponseAmino): MsgConnectionOpenConfirmResponse { + const message = createBaseMsgConnectionOpenConfirmResponse(); + return message; + }, + toAmino(_: MsgConnectionOpenConfirmResponse): MsgConnectionOpenConfirmResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgConnectionOpenConfirmResponseAminoMsg): MsgConnectionOpenConfirmResponse { + return MsgConnectionOpenConfirmResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgConnectionOpenConfirmResponse): MsgConnectionOpenConfirmResponseAminoMsg { + return { + type: "cosmos-sdk/MsgConnectionOpenConfirmResponse", + value: MsgConnectionOpenConfirmResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgConnectionOpenConfirmResponseProtoMsg): MsgConnectionOpenConfirmResponse { + return MsgConnectionOpenConfirmResponse.decode(message.value); + }, + toProto(message: MsgConnectionOpenConfirmResponse): Uint8Array { + return MsgConnectionOpenConfirmResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgConnectionOpenConfirmResponse): MsgConnectionOpenConfirmResponseProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.MsgConnectionOpenConfirmResponse", + value: MsgConnectionOpenConfirmResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgConnectionOpenConfirmResponse.typeUrl, MsgConnectionOpenConfirmResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgConnectionOpenConfirmResponse.aminoType, MsgConnectionOpenConfirmResponse.typeUrl); +function createBaseMsgUpdateParams(): MsgUpdateParams { + return { + signer: "", + params: Params.fromPartial({}) + }; +} +export const MsgUpdateParams = { + typeUrl: "/ibc.core.connection.v1.MsgUpdateParams", + aminoType: "cosmos-sdk/MsgUpdateParams", + is(o: any): o is MsgUpdateParams { + return o && (o.$typeUrl === MsgUpdateParams.typeUrl || typeof o.signer === "string" && Params.is(o.params)); + }, + isAmino(o: any): o is MsgUpdateParamsAmino { + return o && (o.$typeUrl === MsgUpdateParams.typeUrl || typeof o.signer === "string" && Params.isAmino(o.params)); + }, + encode(message: MsgUpdateParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.signer !== "") { + writer.uint32(10).string(message.signer); + } + if (message.params !== undefined) { + Params.encode(message.params, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signer = reader.string(); + break; + case 2: + message.params = Params.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + message.signer = object.signer ?? ""; + message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined; + return message; + }, + fromAmino(object: MsgUpdateParamsAmino): MsgUpdateParams { + const message = createBaseMsgUpdateParams(); + if (object.signer !== undefined && object.signer !== null) { + message.signer = object.signer; + } + if (object.params !== undefined && object.params !== null) { + message.params = Params.fromAmino(object.params); + } + return message; + }, + toAmino(message: MsgUpdateParams): MsgUpdateParamsAmino { + const obj: any = {}; + obj.signer = message.signer === "" ? undefined : message.signer; + obj.params = message.params ? Params.toAmino(message.params) : undefined; + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsAminoMsg): MsgUpdateParams { + return MsgUpdateParams.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParams): MsgUpdateParamsAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateParams", + value: MsgUpdateParams.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsProtoMsg): MsgUpdateParams { + return MsgUpdateParams.decode(message.value); + }, + toProto(message: MsgUpdateParams): Uint8Array { + return MsgUpdateParams.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParams): MsgUpdateParamsProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.MsgUpdateParams", + value: MsgUpdateParams.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgUpdateParams.typeUrl, MsgUpdateParams); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgUpdateParams.aminoType, MsgUpdateParams.typeUrl); +function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse { + return {}; +} +export const MsgUpdateParamsResponse = { + typeUrl: "/ibc.core.connection.v1.MsgUpdateParamsResponse", + aminoType: "cosmos-sdk/MsgUpdateParamsResponse", + is(o: any): o is MsgUpdateParamsResponse { + return o && o.$typeUrl === MsgUpdateParamsResponse.typeUrl; + }, + isAmino(o: any): o is MsgUpdateParamsResponseAmino { + return o && o.$typeUrl === MsgUpdateParamsResponse.typeUrl; + }, + encode(_: MsgUpdateParamsResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgUpdateParamsResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgUpdateParamsResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + fromAmino(_: MsgUpdateParamsResponseAmino): MsgUpdateParamsResponse { + const message = createBaseMsgUpdateParamsResponse(); + return message; + }, + toAmino(_: MsgUpdateParamsResponse): MsgUpdateParamsResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgUpdateParamsResponseAminoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseAminoMsg { + return { + type: "cosmos-sdk/MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgUpdateParamsResponseProtoMsg): MsgUpdateParamsResponse { + return MsgUpdateParamsResponse.decode(message.value); + }, + toProto(message: MsgUpdateParamsResponse): Uint8Array { + return MsgUpdateParamsResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgUpdateParamsResponse): MsgUpdateParamsResponseProtoMsg { + return { + typeUrl: "/ibc.core.connection.v1.MsgUpdateParamsResponse", + value: MsgUpdateParamsResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgUpdateParamsResponse.typeUrl, MsgUpdateParamsResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgUpdateParamsResponse.aminoType, MsgUpdateParamsResponse.typeUrl); \ No newline at end of file diff --git a/libs/interchain-query/src/injective/types/v1beta1/account.ts b/libs/interchain-query/src/injective/types/v1beta1/account.ts new file mode 100644 index 00000000..08000833 --- /dev/null +++ b/libs/interchain-query/src/injective/types/v1beta1/account.ts @@ -0,0 +1,110 @@ +import { BaseAccount, BaseAccountAmino } from "../../../cosmos/auth/v1beta1/auth"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; +/** + * EthAccount implements the authtypes.AccountI interface and embeds an + * authtypes.BaseAccount type. It is compatible with the auth AccountKeeper. + */ +export interface EthAccount { + baseAccount?: BaseAccount; + codeHash: Uint8Array; +} +export interface EthAccountProtoMsg { + typeUrl: "/injective.types.v1beta1.EthAccount"; + value: Uint8Array; +} +/** + * EthAccount implements the authtypes.AccountI interface and embeds an + * authtypes.BaseAccount type. It is compatible with the auth AccountKeeper. + */ +export interface EthAccountAmino { + base_account?: BaseAccountAmino; + code_hash: string; +} +export interface EthAccountAminoMsg { + type: "/injective.types.v1beta1.EthAccount"; + value: EthAccountAmino; +} +function createBaseEthAccount(): EthAccount { + return { + baseAccount: undefined, + codeHash: new Uint8Array() + }; +} +export const EthAccount = { + typeUrl: "/injective.types.v1beta1.EthAccount", + is(o: any): o is EthAccount { + return o && (o.$typeUrl === EthAccount.typeUrl || o.codeHash instanceof Uint8Array || typeof o.codeHash === "string"); + }, + isAmino(o: any): o is EthAccountAmino { + return o && (o.$typeUrl === EthAccount.typeUrl || o.code_hash instanceof Uint8Array || typeof o.code_hash === "string"); + }, + encode(message: EthAccount, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.baseAccount !== undefined) { + BaseAccount.encode(message.baseAccount, writer.uint32(10).fork()).ldelim(); + } + if (message.codeHash.length !== 0) { + writer.uint32(18).bytes(message.codeHash); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EthAccount { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEthAccount(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.baseAccount = BaseAccount.decode(reader, reader.uint32()); + break; + case 2: + message.codeHash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): EthAccount { + const message = createBaseEthAccount(); + message.baseAccount = object.baseAccount !== undefined && object.baseAccount !== null ? BaseAccount.fromPartial(object.baseAccount) : undefined; + message.codeHash = object.codeHash ?? new Uint8Array(); + return message; + }, + fromAmino(object: EthAccountAmino): EthAccount { + const message = createBaseEthAccount(); + if (object.base_account !== undefined && object.base_account !== null) { + message.baseAccount = BaseAccount.fromAmino(object.base_account); + } + if (object.code_hash !== undefined && object.code_hash !== null) { + message.codeHash = bytesFromBase64(object.code_hash); + } + return message; + }, + toAmino(message: EthAccount): EthAccountAmino { + const obj: any = {}; + obj.base_account = message.baseAccount ? BaseAccount.toAmino(message.baseAccount) : undefined; + obj.code_hash = message.codeHash ? base64FromBytes(message.codeHash) : undefined; + return obj; + }, + fromAminoMsg(object: EthAccountAminoMsg): EthAccount { + return EthAccount.fromAmino(object.value); + }, + fromProtoMsg(message: EthAccountProtoMsg): EthAccount { + return EthAccount.decode(message.value); + }, + toProto(message: EthAccount): Uint8Array { + return EthAccount.encode(message).finish(); + }, + toProtoMsg(message: EthAccount): EthAccountProtoMsg { + return { + typeUrl: "/injective.types.v1beta1.EthAccount", + value: EthAccount.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(EthAccount.typeUrl, EthAccount); \ No newline at end of file diff --git a/libs/interchain-query/src/react-query.ts b/libs/interchain-query/src/react-query.ts new file mode 100644 index 00000000..3a436d41 --- /dev/null +++ b/libs/interchain-query/src/react-query.ts @@ -0,0 +1,185 @@ +/** +* This file and any referenced files were automatically generated by @cosmology/telescope@1.10.8 +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + + import { getRpcClient } from './extern' +import { + isRpc, + Rpc, +} from './helpers' +import { + ITxArgs, + ISigningClient, + StdFee, + DeliverTxResponse, + SigningClientResolver, + RpcResolver, + isISigningClient +} from './helper-func-types' +import { + useQuery, + useQueryClient, + UseQueryOptions, + useMutation, + UseMutationOptions, + QueryKey, +} from '@tanstack/react-query'; + +import { HttpEndpoint } from "@interchainjs/types"; +import { Rpc as ProtobufRpcClient } from "./helpers"; + +export const DEFAULT_RPC_CLIENT_QUERY_KEY = 'rpcClient'; +export const DEFAULT_RPC_ENDPOINT_QUERY_KEY = 'rpcEndPoint'; +export const DEFAULT_SIGNING_CLIENT_QUERY_KEY = 'signingClient'; + +export interface CacheResolver { + rpcEndpoint?: string | HttpEndpoint; + clientQueryKey?: string; +} + +export function isCacheResolver(resolver: unknown) : resolver is CacheResolver { + return resolver !== null && resolver !== undefined && (resolver as CacheResolver).rpcEndpoint !== undefined && (resolver as CacheResolver).clientQueryKey !== undefined; +} + +export interface ReactQueryParams { + options?: UseQueryOptions; +} + +export interface UseRpcClientQuery extends ReactQueryParams { + clientResolver?: CacheResolver; +} + + +export interface UseRpcEndpointQuery extends ReactQueryParams { + getter: () => Promise; + rpcEndPointKey?: string; +} + +export const useRpcEndpoint = ({ + getter, + options, + rpcEndPointKey, +}: UseRpcEndpointQuery) => { + const key = rpcEndPointKey || DEFAULT_RPC_ENDPOINT_QUERY_KEY; + return useQuery([key, getter], async () => { + return await getter(); + }, options); +}; + +export const useRpcClient = ({ + options, + clientResolver +}: UseRpcClientQuery) => { + const queryClient = useQueryClient({ + context: options?.context + }); + + const key = clientResolver?.clientQueryKey || DEFAULT_RPC_CLIENT_QUERY_KEY; + return useQuery([key, clientResolver?.rpcEndpoint], async () => { + if(!clientResolver?.rpcEndpoint) { + throw new Error('rpcEndpoint is required'); + } + + const client = await getRpcClient(clientResolver.rpcEndpoint); + if(!client) { + throw new Error('Failed to connect to rpc client'); + } + + queryClient.setQueryData([key], client); + + return client; + }, options); +}; + +export interface UseQueryBuilderOptions { + builderQueryFn: (clientResolver?: RpcResolver) => (request: TReq) => Promise, + queryKeyPrefix: string, +} + + +export function buildUseQuery(opts: UseQueryBuilderOptions) { + return ({ + request, + options, + clientResolver, + customizedQueryKey, + }: UseQueryParams) => { + const queryClient = useQueryClient({ + context: options?.context + }); + + let rpcResolver: RpcResolver | undefined; + + if(isRpc(clientResolver)) { + rpcResolver = clientResolver; + } else if(isCacheResolver(clientResolver)) { + const key = clientResolver.clientQueryKey || DEFAULT_RPC_CLIENT_QUERY_KEY; + const queryKey = clientResolver.rpcEndpoint ? [key, clientResolver.rpcEndpoint] : [key]; + rpcResolver = queryClient.getQueryData(queryKey); + + if(!rpcResolver && clientResolver.rpcEndpoint) { + rpcResolver = clientResolver.rpcEndpoint; + } + } else { + rpcResolver = clientResolver; + } + + const queryFn = opts.builderQueryFn(rpcResolver); + return useQuery(customizedQueryKey || [opts.queryKeyPrefix, request], () => queryFn(request), options); + }; +} + +export interface UseQueryParams extends ReactQueryParams { + request: TReq; + clientResolver?: CacheResolver | RpcResolver; + customizedQueryKey?: QueryKey +} + +export interface ReactMutationParams { + options?: UseMutationOptions; + clientResolver?: CacheResolver | SigningClientResolver; +} + + +export interface UseMutationBuilderOptions { + builderMutationFn: (clientResolver?: SigningClientResolver) => ( + signerAddress: string, + message: TMsg, + fee: StdFee | 'auto', + memo: string + ) => Promise, +} + + +export function buildUseMutation(opts: UseMutationBuilderOptions) { + return ({ + options, + clientResolver + }: ReactMutationParams>) => { + const queryClient = useQueryClient({ + context: options?.context + }); + + let signingClientResolver: SigningClientResolver | undefined; + + if(isISigningClient(clientResolver)) { + signingClientResolver = clientResolver; + } else if(isCacheResolver(clientResolver)) { + const key = clientResolver.clientQueryKey || DEFAULT_SIGNING_CLIENT_QUERY_KEY; + const queryKey = clientResolver.rpcEndpoint ? [key, clientResolver.rpcEndpoint] : [key]; + signingClientResolver = queryClient.getQueryData(queryKey); + } else { + clientResolver = clientResolver; + } + + const mutationFn = opts.builderMutationFn(signingClientResolver); + + return useMutation>( + (reqData: ITxArgs) => mutationFn(reqData.signerAddress, reqData.message, reqData.fee, reqData.memo), + options as Omit, unknown>, "mutationFn"> + ); + }; +} diff --git a/libs/interchain-query/src/registry.ts b/libs/interchain-query/src/registry.ts new file mode 100644 index 00000000..4a0180cf --- /dev/null +++ b/libs/interchain-query/src/registry.ts @@ -0,0 +1,218 @@ +/** +* This file and any referenced files were automatically generated by @cosmology/telescope@1.10.8 +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + +import { BinaryReader } from "./binary"; +import { Any, AnyAmino } from "./google/protobuf/any"; +import { IProtoType, TelescopeGeneratedCodec } from "./types"; + +export class GlobalDecoderRegistry { + static registry: { + [key: string]: TelescopeGeneratedCodec; + } = {}; + + static aminoProtoMapping: { + [key: string]: string; + } = {}; + + static registerAminoProtoMapping(aminoType: string, typeUrl: string) { + GlobalDecoderRegistry.aminoProtoMapping[aminoType] = typeUrl; + } + + static register( + key: string, + decoder: TelescopeGeneratedCodec + ) { + GlobalDecoderRegistry.registry[key] = decoder; + } + static getDecoder( + key: string + ): TelescopeGeneratedCodec { + return GlobalDecoderRegistry.registry[key]; + } + static getDecoderByInstance( + obj: unknown + ): TelescopeGeneratedCodec | null { + if (obj === undefined || obj === null) { + return null; + } + const protoType = obj as IProtoType; + + if (protoType.$typeUrl) { + return GlobalDecoderRegistry.getDecoder( + protoType.$typeUrl + ); + } + + for (const key in GlobalDecoderRegistry.registry) { + if ( + Object.prototype.hasOwnProperty.call( + GlobalDecoderRegistry.registry, + key + ) + ) { + const element = GlobalDecoderRegistry.registry[key]; + + if (element.is!(obj)) { + return element; + } + + if (element.isSDK && element.isSDK(obj)) { + return element; + } + + if (element.isAmino && element.isAmino(obj)) { + return element; + } + } + } + + return null; + } + static getDecoderByAminoType( + type: string + ): TelescopeGeneratedCodec | null { + if (type === undefined || type === null) { + return null; + } + + const typeUrl = GlobalDecoderRegistry.aminoProtoMapping[type]; + + if (!typeUrl) { + return null; + } + + return GlobalDecoderRegistry.getDecoder(typeUrl); + } + static wrapAny(obj: unknown): Any { + if(Any.is(obj)){ + return obj; + } + + const decoder = getDecoderByInstance(obj); + + return { + typeUrl: decoder.typeUrl, + value: decoder.encode(obj).finish(), + }; + } + static unwrapAny(input: BinaryReader | Uint8Array | Any) { + let data; + + if (Any.is(input)) { + data = input; + } else { + const reader = + input instanceof BinaryReader ? input : new BinaryReader(input); + + data = Any.decode(reader, reader.uint32()); + } + + const decoder = GlobalDecoderRegistry.getDecoder( + data.typeUrl + ); + + if (!decoder) { + return data; + } + + return decoder.decode(data.value); + } + static fromJSON(object: any): T { + const decoder = getDecoderByInstance(object); + return decoder.fromJSON!(object); + } + static toJSON(message: T): any { + const decoder = getDecoderByInstance(message); + return decoder.toJSON!(message); + } + static fromPartial(object: unknown): T { + const decoder = getDecoderByInstance(object); + return decoder ? decoder.fromPartial(object) : (object as T); + } + static fromSDK(object: SDK): T { + const decoder = getDecoderByInstance(object); + return decoder.fromSDK!(object); + } + static fromSDKJSON(object: any): SDK { + const decoder = getDecoderByInstance(object); + return decoder.fromSDKJSON!(object); + } + static toSDK(object: T): SDK { + const decoder = getDecoderByInstance(object); + return decoder.toSDK!(object); + } + static fromAmino(object: Amino): T { + const decoder = getDecoderByInstance(object); + return decoder.fromAmino!(object); + } + static fromAminoMsg(object: AnyAmino): T { + const decoder = GlobalDecoderRegistry.getDecoderByAminoType< + T, + unknown, + Amino + >(object.type); + + if (!decoder) { + throw new Error(`There's no decoder for the amino type ${object.type}`); + } + + return decoder.fromAminoMsg!(object); + } + static toAmino(object: T): Amino { + let data: any; + let decoder: TelescopeGeneratedCodec; + if (Any.is(object)) { + data = GlobalDecoderRegistry.unwrapAny(object); + + decoder = GlobalDecoderRegistry.getDecoder(object.typeUrl); + + if (!decoder) { + decoder = Any; + } + } else { + data = object; + decoder = getDecoderByInstance(object); + } + + return decoder.toAmino!(data); + } + static toAminoMsg(object: T): AnyAmino { + let data: any; + let decoder: TelescopeGeneratedCodec; + if (Any.is(object)) { + data = GlobalDecoderRegistry.unwrapAny(object); + + decoder = GlobalDecoderRegistry.getDecoder(object.typeUrl); + + if (!decoder) { + decoder = Any; + } + } else { + data = object; + decoder = getDecoderByInstance(object); + } + + return decoder.toAminoMsg!(data); + } +} + +function getDecoderByInstance( + obj: unknown +): TelescopeGeneratedCodec { + const decoder = GlobalDecoderRegistry.getDecoderByInstance( + obj + ); + + if (!decoder) { + throw new Error( + `There's no decoder for the instance ${JSON.stringify(obj)}` + ); + } + + return decoder; +} + +GlobalDecoderRegistry.register(Any.typeUrl, Any); diff --git a/libs/interchain-query/src/tendermint/abci/types.ts b/libs/interchain-query/src/tendermint/abci/types.ts new file mode 100644 index 00000000..4759afd1 --- /dev/null +++ b/libs/interchain-query/src/tendermint/abci/types.ts @@ -0,0 +1,6283 @@ +import { Timestamp } from "../../google/protobuf/timestamp"; +import { ConsensusParams, ConsensusParamsAmino } from "../types/params"; +import { ProofOps, ProofOpsAmino } from "../crypto/proof"; +import { PublicKey, PublicKeyAmino } from "../crypto/keys"; +import { BlockIDFlag } from "../types/validator"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes, isSet } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; +export enum CheckTxType { + NEW = 0, + RECHECK = 1, + UNRECOGNIZED = -1, +} +export const CheckTxTypeAmino = CheckTxType; +export function checkTxTypeFromJSON(object: any): CheckTxType { + switch (object) { + case 0: + case "NEW": + return CheckTxType.NEW; + case 1: + case "RECHECK": + return CheckTxType.RECHECK; + case -1: + case "UNRECOGNIZED": + default: + return CheckTxType.UNRECOGNIZED; + } +} +export function checkTxTypeToJSON(object: CheckTxType): string { + switch (object) { + case CheckTxType.NEW: + return "NEW"; + case CheckTxType.RECHECK: + return "RECHECK"; + case CheckTxType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export enum ResponseOfferSnapshot_Result { + /** UNKNOWN - Unknown result, abort all snapshot restoration */ + UNKNOWN = 0, + /** ACCEPT - Snapshot accepted, apply chunks */ + ACCEPT = 1, + /** ABORT - Abort all snapshot restoration */ + ABORT = 2, + /** REJECT - Reject this specific snapshot, try others */ + REJECT = 3, + /** REJECT_FORMAT - Reject all snapshots of this format, try others */ + REJECT_FORMAT = 4, + /** REJECT_SENDER - Reject all snapshots from the sender(s), try others */ + REJECT_SENDER = 5, + UNRECOGNIZED = -1, +} +export const ResponseOfferSnapshot_ResultAmino = ResponseOfferSnapshot_Result; +export function responseOfferSnapshot_ResultFromJSON(object: any): ResponseOfferSnapshot_Result { + switch (object) { + case 0: + case "UNKNOWN": + return ResponseOfferSnapshot_Result.UNKNOWN; + case 1: + case "ACCEPT": + return ResponseOfferSnapshot_Result.ACCEPT; + case 2: + case "ABORT": + return ResponseOfferSnapshot_Result.ABORT; + case 3: + case "REJECT": + return ResponseOfferSnapshot_Result.REJECT; + case 4: + case "REJECT_FORMAT": + return ResponseOfferSnapshot_Result.REJECT_FORMAT; + case 5: + case "REJECT_SENDER": + return ResponseOfferSnapshot_Result.REJECT_SENDER; + case -1: + case "UNRECOGNIZED": + default: + return ResponseOfferSnapshot_Result.UNRECOGNIZED; + } +} +export function responseOfferSnapshot_ResultToJSON(object: ResponseOfferSnapshot_Result): string { + switch (object) { + case ResponseOfferSnapshot_Result.UNKNOWN: + return "UNKNOWN"; + case ResponseOfferSnapshot_Result.ACCEPT: + return "ACCEPT"; + case ResponseOfferSnapshot_Result.ABORT: + return "ABORT"; + case ResponseOfferSnapshot_Result.REJECT: + return "REJECT"; + case ResponseOfferSnapshot_Result.REJECT_FORMAT: + return "REJECT_FORMAT"; + case ResponseOfferSnapshot_Result.REJECT_SENDER: + return "REJECT_SENDER"; + case ResponseOfferSnapshot_Result.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export enum ResponseApplySnapshotChunk_Result { + /** UNKNOWN - Unknown result, abort all snapshot restoration */ + UNKNOWN = 0, + /** ACCEPT - Chunk successfully accepted */ + ACCEPT = 1, + /** ABORT - Abort all snapshot restoration */ + ABORT = 2, + /** RETRY - Retry chunk (combine with refetch and reject) */ + RETRY = 3, + /** RETRY_SNAPSHOT - Retry snapshot (combine with refetch and reject) */ + RETRY_SNAPSHOT = 4, + /** REJECT_SNAPSHOT - Reject this snapshot, try others */ + REJECT_SNAPSHOT = 5, + UNRECOGNIZED = -1, +} +export const ResponseApplySnapshotChunk_ResultAmino = ResponseApplySnapshotChunk_Result; +export function responseApplySnapshotChunk_ResultFromJSON(object: any): ResponseApplySnapshotChunk_Result { + switch (object) { + case 0: + case "UNKNOWN": + return ResponseApplySnapshotChunk_Result.UNKNOWN; + case 1: + case "ACCEPT": + return ResponseApplySnapshotChunk_Result.ACCEPT; + case 2: + case "ABORT": + return ResponseApplySnapshotChunk_Result.ABORT; + case 3: + case "RETRY": + return ResponseApplySnapshotChunk_Result.RETRY; + case 4: + case "RETRY_SNAPSHOT": + return ResponseApplySnapshotChunk_Result.RETRY_SNAPSHOT; + case 5: + case "REJECT_SNAPSHOT": + return ResponseApplySnapshotChunk_Result.REJECT_SNAPSHOT; + case -1: + case "UNRECOGNIZED": + default: + return ResponseApplySnapshotChunk_Result.UNRECOGNIZED; + } +} +export function responseApplySnapshotChunk_ResultToJSON(object: ResponseApplySnapshotChunk_Result): string { + switch (object) { + case ResponseApplySnapshotChunk_Result.UNKNOWN: + return "UNKNOWN"; + case ResponseApplySnapshotChunk_Result.ACCEPT: + return "ACCEPT"; + case ResponseApplySnapshotChunk_Result.ABORT: + return "ABORT"; + case ResponseApplySnapshotChunk_Result.RETRY: + return "RETRY"; + case ResponseApplySnapshotChunk_Result.RETRY_SNAPSHOT: + return "RETRY_SNAPSHOT"; + case ResponseApplySnapshotChunk_Result.REJECT_SNAPSHOT: + return "REJECT_SNAPSHOT"; + case ResponseApplySnapshotChunk_Result.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export enum ResponseProcessProposal_ProposalStatus { + UNKNOWN = 0, + ACCEPT = 1, + REJECT = 2, + UNRECOGNIZED = -1, +} +export const ResponseProcessProposal_ProposalStatusAmino = ResponseProcessProposal_ProposalStatus; +export function responseProcessProposal_ProposalStatusFromJSON(object: any): ResponseProcessProposal_ProposalStatus { + switch (object) { + case 0: + case "UNKNOWN": + return ResponseProcessProposal_ProposalStatus.UNKNOWN; + case 1: + case "ACCEPT": + return ResponseProcessProposal_ProposalStatus.ACCEPT; + case 2: + case "REJECT": + return ResponseProcessProposal_ProposalStatus.REJECT; + case -1: + case "UNRECOGNIZED": + default: + return ResponseProcessProposal_ProposalStatus.UNRECOGNIZED; + } +} +export function responseProcessProposal_ProposalStatusToJSON(object: ResponseProcessProposal_ProposalStatus): string { + switch (object) { + case ResponseProcessProposal_ProposalStatus.UNKNOWN: + return "UNKNOWN"; + case ResponseProcessProposal_ProposalStatus.ACCEPT: + return "ACCEPT"; + case ResponseProcessProposal_ProposalStatus.REJECT: + return "REJECT"; + case ResponseProcessProposal_ProposalStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export enum ResponseVerifyVoteExtension_VerifyStatus { + UNKNOWN = 0, + ACCEPT = 1, + /** + * REJECT - Rejecting the vote extension will reject the entire precommit by the sender. + * Incorrectly implementing this thus has liveness implications as it may affect + * CometBFT's ability to receive 2/3+ valid votes to finalize the block. + * Honest nodes should never be rejected. + */ + REJECT = 2, + UNRECOGNIZED = -1, +} +export const ResponseVerifyVoteExtension_VerifyStatusAmino = ResponseVerifyVoteExtension_VerifyStatus; +export function responseVerifyVoteExtension_VerifyStatusFromJSON(object: any): ResponseVerifyVoteExtension_VerifyStatus { + switch (object) { + case 0: + case "UNKNOWN": + return ResponseVerifyVoteExtension_VerifyStatus.UNKNOWN; + case 1: + case "ACCEPT": + return ResponseVerifyVoteExtension_VerifyStatus.ACCEPT; + case 2: + case "REJECT": + return ResponseVerifyVoteExtension_VerifyStatus.REJECT; + case -1: + case "UNRECOGNIZED": + default: + return ResponseVerifyVoteExtension_VerifyStatus.UNRECOGNIZED; + } +} +export function responseVerifyVoteExtension_VerifyStatusToJSON(object: ResponseVerifyVoteExtension_VerifyStatus): string { + switch (object) { + case ResponseVerifyVoteExtension_VerifyStatus.UNKNOWN: + return "UNKNOWN"; + case ResponseVerifyVoteExtension_VerifyStatus.ACCEPT: + return "ACCEPT"; + case ResponseVerifyVoteExtension_VerifyStatus.REJECT: + return "REJECT"; + case ResponseVerifyVoteExtension_VerifyStatus.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export enum MisbehaviorType { + UNKNOWN = 0, + DUPLICATE_VOTE = 1, + LIGHT_CLIENT_ATTACK = 2, + UNRECOGNIZED = -1, +} +export const MisbehaviorTypeAmino = MisbehaviorType; +export function misbehaviorTypeFromJSON(object: any): MisbehaviorType { + switch (object) { + case 0: + case "UNKNOWN": + return MisbehaviorType.UNKNOWN; + case 1: + case "DUPLICATE_VOTE": + return MisbehaviorType.DUPLICATE_VOTE; + case 2: + case "LIGHT_CLIENT_ATTACK": + return MisbehaviorType.LIGHT_CLIENT_ATTACK; + case -1: + case "UNRECOGNIZED": + default: + return MisbehaviorType.UNRECOGNIZED; + } +} +export function misbehaviorTypeToJSON(object: MisbehaviorType): string { + switch (object) { + case MisbehaviorType.UNKNOWN: + return "UNKNOWN"; + case MisbehaviorType.DUPLICATE_VOTE: + return "DUPLICATE_VOTE"; + case MisbehaviorType.LIGHT_CLIENT_ATTACK: + return "LIGHT_CLIENT_ATTACK"; + case MisbehaviorType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export interface Request { + echo?: RequestEcho; + flush?: RequestFlush; + info?: RequestInfo; + initChain?: RequestInitChain; + query?: RequestQuery; + checkTx?: RequestCheckTx; + commit?: RequestCommit; + listSnapshots?: RequestListSnapshots; + offerSnapshot?: RequestOfferSnapshot; + loadSnapshotChunk?: RequestLoadSnapshotChunk; + applySnapshotChunk?: RequestApplySnapshotChunk; + prepareProposal?: RequestPrepareProposal; + processProposal?: RequestProcessProposal; + extendVote?: RequestExtendVote; + verifyVoteExtension?: RequestVerifyVoteExtension; + finalizeBlock?: RequestFinalizeBlock; +} +export interface RequestProtoMsg { + typeUrl: "/tendermint.abci.Request"; + value: Uint8Array; +} +export interface RequestAmino { + echo?: RequestEchoAmino; + flush?: RequestFlushAmino; + info?: RequestInfoAmino; + init_chain?: RequestInitChainAmino; + query?: RequestQueryAmino; + check_tx?: RequestCheckTxAmino; + commit?: RequestCommitAmino; + list_snapshots?: RequestListSnapshotsAmino; + offer_snapshot?: RequestOfferSnapshotAmino; + load_snapshot_chunk?: RequestLoadSnapshotChunkAmino; + apply_snapshot_chunk?: RequestApplySnapshotChunkAmino; + prepare_proposal?: RequestPrepareProposalAmino; + process_proposal?: RequestProcessProposalAmino; + extend_vote?: RequestExtendVoteAmino; + verify_vote_extension?: RequestVerifyVoteExtensionAmino; + finalize_block?: RequestFinalizeBlockAmino; +} +export interface RequestAminoMsg { + type: "/tendermint.abci.Request"; + value: RequestAmino; +} +export interface RequestEcho { + message: string; +} +export interface RequestEchoProtoMsg { + typeUrl: "/tendermint.abci.RequestEcho"; + value: Uint8Array; +} +export interface RequestEchoAmino { + message: string; +} +export interface RequestEchoAminoMsg { + type: "/tendermint.abci.RequestEcho"; + value: RequestEchoAmino; +} +export interface RequestFlush {} +export interface RequestFlushProtoMsg { + typeUrl: "/tendermint.abci.RequestFlush"; + value: Uint8Array; +} +export interface RequestFlushAmino {} +export interface RequestFlushAminoMsg { + type: "/tendermint.abci.RequestFlush"; + value: RequestFlushAmino; +} +export interface RequestInfo { + version: string; + blockVersion: bigint; + p2pVersion: bigint; + abciVersion: string; +} +export interface RequestInfoProtoMsg { + typeUrl: "/tendermint.abci.RequestInfo"; + value: Uint8Array; +} +export interface RequestInfoAmino { + version: string; + block_version: string; + p2p_version: string; + abci_version: string; +} +export interface RequestInfoAminoMsg { + type: "/tendermint.abci.RequestInfo"; + value: RequestInfoAmino; +} +export interface RequestInitChain { + time: Date; + chainId: string; + consensusParams?: ConsensusParams; + validators: ValidatorUpdate[]; + appStateBytes: Uint8Array; + initialHeight: bigint; +} +export interface RequestInitChainProtoMsg { + typeUrl: "/tendermint.abci.RequestInitChain"; + value: Uint8Array; +} +export interface RequestInitChainAmino { + time: string; + chain_id: string; + consensus_params?: ConsensusParamsAmino; + validators: ValidatorUpdateAmino[]; + app_state_bytes: string; + initial_height: string; +} +export interface RequestInitChainAminoMsg { + type: "/tendermint.abci.RequestInitChain"; + value: RequestInitChainAmino; +} +export interface RequestQuery { + data: Uint8Array; + path: string; + height: bigint; + prove: boolean; +} +export interface RequestQueryProtoMsg { + typeUrl: "/tendermint.abci.RequestQuery"; + value: Uint8Array; +} +export interface RequestQueryAmino { + data: string; + path: string; + height: string; + prove: boolean; +} +export interface RequestQueryAminoMsg { + type: "/tendermint.abci.RequestQuery"; + value: RequestQueryAmino; +} +export interface RequestCheckTx { + tx: Uint8Array; + type: CheckTxType; +} +export interface RequestCheckTxProtoMsg { + typeUrl: "/tendermint.abci.RequestCheckTx"; + value: Uint8Array; +} +export interface RequestCheckTxAmino { + tx: string; + type: CheckTxType; +} +export interface RequestCheckTxAminoMsg { + type: "/tendermint.abci.RequestCheckTx"; + value: RequestCheckTxAmino; +} +export interface RequestCommit {} +export interface RequestCommitProtoMsg { + typeUrl: "/tendermint.abci.RequestCommit"; + value: Uint8Array; +} +export interface RequestCommitAmino {} +export interface RequestCommitAminoMsg { + type: "/tendermint.abci.RequestCommit"; + value: RequestCommitAmino; +} +/** lists available snapshots */ +export interface RequestListSnapshots {} +export interface RequestListSnapshotsProtoMsg { + typeUrl: "/tendermint.abci.RequestListSnapshots"; + value: Uint8Array; +} +/** lists available snapshots */ +export interface RequestListSnapshotsAmino {} +export interface RequestListSnapshotsAminoMsg { + type: "/tendermint.abci.RequestListSnapshots"; + value: RequestListSnapshotsAmino; +} +/** offers a snapshot to the application */ +export interface RequestOfferSnapshot { + /** snapshot offered by peers */ + snapshot?: Snapshot; + /** light client-verified app hash for snapshot height */ + appHash: Uint8Array; +} +export interface RequestOfferSnapshotProtoMsg { + typeUrl: "/tendermint.abci.RequestOfferSnapshot"; + value: Uint8Array; +} +/** offers a snapshot to the application */ +export interface RequestOfferSnapshotAmino { + /** snapshot offered by peers */ + snapshot?: SnapshotAmino; + /** light client-verified app hash for snapshot height */ + app_hash: string; +} +export interface RequestOfferSnapshotAminoMsg { + type: "/tendermint.abci.RequestOfferSnapshot"; + value: RequestOfferSnapshotAmino; +} +/** loads a snapshot chunk */ +export interface RequestLoadSnapshotChunk { + height: bigint; + format: number; + chunk: number; +} +export interface RequestLoadSnapshotChunkProtoMsg { + typeUrl: "/tendermint.abci.RequestLoadSnapshotChunk"; + value: Uint8Array; +} +/** loads a snapshot chunk */ +export interface RequestLoadSnapshotChunkAmino { + height: string; + format: number; + chunk: number; +} +export interface RequestLoadSnapshotChunkAminoMsg { + type: "/tendermint.abci.RequestLoadSnapshotChunk"; + value: RequestLoadSnapshotChunkAmino; +} +/** Applies a snapshot chunk */ +export interface RequestApplySnapshotChunk { + index: number; + chunk: Uint8Array; + sender: string; +} +export interface RequestApplySnapshotChunkProtoMsg { + typeUrl: "/tendermint.abci.RequestApplySnapshotChunk"; + value: Uint8Array; +} +/** Applies a snapshot chunk */ +export interface RequestApplySnapshotChunkAmino { + index: number; + chunk: string; + sender: string; +} +export interface RequestApplySnapshotChunkAminoMsg { + type: "/tendermint.abci.RequestApplySnapshotChunk"; + value: RequestApplySnapshotChunkAmino; +} +export interface RequestPrepareProposal { + /** the modified transactions cannot exceed this size. */ + maxTxBytes: bigint; + /** + * txs is an array of transactions that will be included in a block, + * sent to the app for possible modifications. + */ + txs: Uint8Array[]; + localLastCommit: ExtendedCommitInfo; + misbehavior: Misbehavior[]; + height: bigint; + time: Date; + nextValidatorsHash: Uint8Array; + /** address of the public key of the validator proposing the block. */ + proposerAddress: Uint8Array; +} +export interface RequestPrepareProposalProtoMsg { + typeUrl: "/tendermint.abci.RequestPrepareProposal"; + value: Uint8Array; +} +export interface RequestPrepareProposalAmino { + /** the modified transactions cannot exceed this size. */ + max_tx_bytes: string; + /** + * txs is an array of transactions that will be included in a block, + * sent to the app for possible modifications. + */ + txs: string[]; + local_last_commit: ExtendedCommitInfoAmino; + misbehavior: MisbehaviorAmino[]; + height: string; + time: string; + next_validators_hash: string; + /** address of the public key of the validator proposing the block. */ + proposer_address: string; +} +export interface RequestPrepareProposalAminoMsg { + type: "/tendermint.abci.RequestPrepareProposal"; + value: RequestPrepareProposalAmino; +} +export interface RequestProcessProposal { + txs: Uint8Array[]; + proposedLastCommit: CommitInfo; + misbehavior: Misbehavior[]; + /** hash is the merkle root hash of the fields of the proposed block. */ + hash: Uint8Array; + height: bigint; + time: Date; + nextValidatorsHash: Uint8Array; + /** address of the public key of the original proposer of the block. */ + proposerAddress: Uint8Array; +} +export interface RequestProcessProposalProtoMsg { + typeUrl: "/tendermint.abci.RequestProcessProposal"; + value: Uint8Array; +} +export interface RequestProcessProposalAmino { + txs: string[]; + proposed_last_commit: CommitInfoAmino; + misbehavior: MisbehaviorAmino[]; + /** hash is the merkle root hash of the fields of the proposed block. */ + hash: string; + height: string; + time: string; + next_validators_hash: string; + /** address of the public key of the original proposer of the block. */ + proposer_address: string; +} +export interface RequestProcessProposalAminoMsg { + type: "/tendermint.abci.RequestProcessProposal"; + value: RequestProcessProposalAmino; +} +/** Extends a vote with application-injected data */ +export interface RequestExtendVote { + /** the hash of the block that this vote may be referring to */ + hash: Uint8Array; + /** the height of the extended vote */ + height: bigint; + /** info of the block that this vote may be referring to */ + time: Date; + txs: Uint8Array[]; + proposedLastCommit: CommitInfo; + misbehavior: Misbehavior[]; + nextValidatorsHash: Uint8Array; + /** address of the public key of the original proposer of the block. */ + proposerAddress: Uint8Array; +} +export interface RequestExtendVoteProtoMsg { + typeUrl: "/tendermint.abci.RequestExtendVote"; + value: Uint8Array; +} +/** Extends a vote with application-injected data */ +export interface RequestExtendVoteAmino { + /** the hash of the block that this vote may be referring to */ + hash: string; + /** the height of the extended vote */ + height: string; + /** info of the block that this vote may be referring to */ + time: string; + txs: string[]; + proposed_last_commit: CommitInfoAmino; + misbehavior: MisbehaviorAmino[]; + next_validators_hash: string; + /** address of the public key of the original proposer of the block. */ + proposer_address: string; +} +export interface RequestExtendVoteAminoMsg { + type: "/tendermint.abci.RequestExtendVote"; + value: RequestExtendVoteAmino; +} +/** Verify the vote extension */ +export interface RequestVerifyVoteExtension { + /** the hash of the block that this received vote corresponds to */ + hash: Uint8Array; + /** the validator that signed the vote extension */ + validatorAddress: Uint8Array; + height: bigint; + voteExtension: Uint8Array; +} +export interface RequestVerifyVoteExtensionProtoMsg { + typeUrl: "/tendermint.abci.RequestVerifyVoteExtension"; + value: Uint8Array; +} +/** Verify the vote extension */ +export interface RequestVerifyVoteExtensionAmino { + /** the hash of the block that this received vote corresponds to */ + hash: string; + /** the validator that signed the vote extension */ + validator_address: string; + height: string; + vote_extension: string; +} +export interface RequestVerifyVoteExtensionAminoMsg { + type: "/tendermint.abci.RequestVerifyVoteExtension"; + value: RequestVerifyVoteExtensionAmino; +} +export interface RequestFinalizeBlock { + txs: Uint8Array[]; + decidedLastCommit: CommitInfo; + misbehavior: Misbehavior[]; + /** hash is the merkle root hash of the fields of the decided block. */ + hash: Uint8Array; + height: bigint; + time: Date; + nextValidatorsHash: Uint8Array; + /** proposer_address is the address of the public key of the original proposer of the block. */ + proposerAddress: Uint8Array; +} +export interface RequestFinalizeBlockProtoMsg { + typeUrl: "/tendermint.abci.RequestFinalizeBlock"; + value: Uint8Array; +} +export interface RequestFinalizeBlockAmino { + txs: string[]; + decided_last_commit: CommitInfoAmino; + misbehavior: MisbehaviorAmino[]; + /** hash is the merkle root hash of the fields of the decided block. */ + hash: string; + height: string; + time: string; + next_validators_hash: string; + /** proposer_address is the address of the public key of the original proposer of the block. */ + proposer_address: string; +} +export interface RequestFinalizeBlockAminoMsg { + type: "/tendermint.abci.RequestFinalizeBlock"; + value: RequestFinalizeBlockAmino; +} +export interface Response { + exception?: ResponseException; + echo?: ResponseEcho; + flush?: ResponseFlush; + info?: ResponseInfo; + initChain?: ResponseInitChain; + query?: ResponseQuery; + checkTx?: ResponseCheckTx; + commit?: ResponseCommit; + listSnapshots?: ResponseListSnapshots; + offerSnapshot?: ResponseOfferSnapshot; + loadSnapshotChunk?: ResponseLoadSnapshotChunk; + applySnapshotChunk?: ResponseApplySnapshotChunk; + prepareProposal?: ResponsePrepareProposal; + processProposal?: ResponseProcessProposal; + extendVote?: ResponseExtendVote; + verifyVoteExtension?: ResponseVerifyVoteExtension; + finalizeBlock?: ResponseFinalizeBlock; +} +export interface ResponseProtoMsg { + typeUrl: "/tendermint.abci.Response"; + value: Uint8Array; +} +export interface ResponseAmino { + exception?: ResponseExceptionAmino; + echo?: ResponseEchoAmino; + flush?: ResponseFlushAmino; + info?: ResponseInfoAmino; + init_chain?: ResponseInitChainAmino; + query?: ResponseQueryAmino; + check_tx?: ResponseCheckTxAmino; + commit?: ResponseCommitAmino; + list_snapshots?: ResponseListSnapshotsAmino; + offer_snapshot?: ResponseOfferSnapshotAmino; + load_snapshot_chunk?: ResponseLoadSnapshotChunkAmino; + apply_snapshot_chunk?: ResponseApplySnapshotChunkAmino; + prepare_proposal?: ResponsePrepareProposalAmino; + process_proposal?: ResponseProcessProposalAmino; + extend_vote?: ResponseExtendVoteAmino; + verify_vote_extension?: ResponseVerifyVoteExtensionAmino; + finalize_block?: ResponseFinalizeBlockAmino; +} +export interface ResponseAminoMsg { + type: "/tendermint.abci.Response"; + value: ResponseAmino; +} +/** nondeterministic */ +export interface ResponseException { + error: string; +} +export interface ResponseExceptionProtoMsg { + typeUrl: "/tendermint.abci.ResponseException"; + value: Uint8Array; +} +/** nondeterministic */ +export interface ResponseExceptionAmino { + error: string; +} +export interface ResponseExceptionAminoMsg { + type: "/tendermint.abci.ResponseException"; + value: ResponseExceptionAmino; +} +export interface ResponseEcho { + message: string; +} +export interface ResponseEchoProtoMsg { + typeUrl: "/tendermint.abci.ResponseEcho"; + value: Uint8Array; +} +export interface ResponseEchoAmino { + message: string; +} +export interface ResponseEchoAminoMsg { + type: "/tendermint.abci.ResponseEcho"; + value: ResponseEchoAmino; +} +export interface ResponseFlush {} +export interface ResponseFlushProtoMsg { + typeUrl: "/tendermint.abci.ResponseFlush"; + value: Uint8Array; +} +export interface ResponseFlushAmino {} +export interface ResponseFlushAminoMsg { + type: "/tendermint.abci.ResponseFlush"; + value: ResponseFlushAmino; +} +export interface ResponseInfo { + data: string; + version: string; + appVersion: bigint; + lastBlockHeight: bigint; + lastBlockAppHash: Uint8Array; +} +export interface ResponseInfoProtoMsg { + typeUrl: "/tendermint.abci.ResponseInfo"; + value: Uint8Array; +} +export interface ResponseInfoAmino { + data: string; + version: string; + app_version: string; + last_block_height: string; + last_block_app_hash: string; +} +export interface ResponseInfoAminoMsg { + type: "/tendermint.abci.ResponseInfo"; + value: ResponseInfoAmino; +} +export interface ResponseInitChain { + consensusParams?: ConsensusParams; + validators: ValidatorUpdate[]; + appHash: Uint8Array; +} +export interface ResponseInitChainProtoMsg { + typeUrl: "/tendermint.abci.ResponseInitChain"; + value: Uint8Array; +} +export interface ResponseInitChainAmino { + consensus_params?: ConsensusParamsAmino; + validators: ValidatorUpdateAmino[]; + app_hash: string; +} +export interface ResponseInitChainAminoMsg { + type: "/tendermint.abci.ResponseInitChain"; + value: ResponseInitChainAmino; +} +export interface ResponseQuery { + code: number; + /** bytes data = 2; // use "value" instead. */ + log: string; + /** nondeterministic */ + info: string; + index: bigint; + key: Uint8Array; + value: Uint8Array; + proofOps?: ProofOps; + height: bigint; + codespace: string; +} +export interface ResponseQueryProtoMsg { + typeUrl: "/tendermint.abci.ResponseQuery"; + value: Uint8Array; +} +export interface ResponseQueryAmino { + code: number; + /** bytes data = 2; // use "value" instead. */ + log: string; + /** nondeterministic */ + info: string; + index: string; + key: string; + value: string; + proof_ops?: ProofOpsAmino; + height: string; + codespace: string; +} +export interface ResponseQueryAminoMsg { + type: "/tendermint.abci.ResponseQuery"; + value: ResponseQueryAmino; +} +export interface ResponseCheckTx { + code: number; + data: Uint8Array; + /** nondeterministic */ + log: string; + /** nondeterministic */ + info: string; + gasWanted: bigint; + gasUsed: bigint; + events: Event[]; + codespace: string; +} +export interface ResponseCheckTxProtoMsg { + typeUrl: "/tendermint.abci.ResponseCheckTx"; + value: Uint8Array; +} +export interface ResponseCheckTxAmino { + code: number; + data: string; + /** nondeterministic */ + log: string; + /** nondeterministic */ + info: string; + gas_wanted: string; + gas_used: string; + events: EventAmino[]; + codespace: string; +} +export interface ResponseCheckTxAminoMsg { + type: "/tendermint.abci.ResponseCheckTx"; + value: ResponseCheckTxAmino; +} +export interface ResponseCommit { + retainHeight: bigint; +} +export interface ResponseCommitProtoMsg { + typeUrl: "/tendermint.abci.ResponseCommit"; + value: Uint8Array; +} +export interface ResponseCommitAmino { + retain_height: string; +} +export interface ResponseCommitAminoMsg { + type: "/tendermint.abci.ResponseCommit"; + value: ResponseCommitAmino; +} +export interface ResponseListSnapshots { + snapshots: Snapshot[]; +} +export interface ResponseListSnapshotsProtoMsg { + typeUrl: "/tendermint.abci.ResponseListSnapshots"; + value: Uint8Array; +} +export interface ResponseListSnapshotsAmino { + snapshots: SnapshotAmino[]; +} +export interface ResponseListSnapshotsAminoMsg { + type: "/tendermint.abci.ResponseListSnapshots"; + value: ResponseListSnapshotsAmino; +} +export interface ResponseOfferSnapshot { + result: ResponseOfferSnapshot_Result; +} +export interface ResponseOfferSnapshotProtoMsg { + typeUrl: "/tendermint.abci.ResponseOfferSnapshot"; + value: Uint8Array; +} +export interface ResponseOfferSnapshotAmino { + result: ResponseOfferSnapshot_Result; +} +export interface ResponseOfferSnapshotAminoMsg { + type: "/tendermint.abci.ResponseOfferSnapshot"; + value: ResponseOfferSnapshotAmino; +} +export interface ResponseLoadSnapshotChunk { + chunk: Uint8Array; +} +export interface ResponseLoadSnapshotChunkProtoMsg { + typeUrl: "/tendermint.abci.ResponseLoadSnapshotChunk"; + value: Uint8Array; +} +export interface ResponseLoadSnapshotChunkAmino { + chunk: string; +} +export interface ResponseLoadSnapshotChunkAminoMsg { + type: "/tendermint.abci.ResponseLoadSnapshotChunk"; + value: ResponseLoadSnapshotChunkAmino; +} +export interface ResponseApplySnapshotChunk { + result: ResponseApplySnapshotChunk_Result; + /** Chunks to refetch and reapply */ + refetchChunks: number[]; + /** Chunk senders to reject and ban */ + rejectSenders: string[]; +} +export interface ResponseApplySnapshotChunkProtoMsg { + typeUrl: "/tendermint.abci.ResponseApplySnapshotChunk"; + value: Uint8Array; +} +export interface ResponseApplySnapshotChunkAmino { + result: ResponseApplySnapshotChunk_Result; + /** Chunks to refetch and reapply */ + refetch_chunks: number[]; + /** Chunk senders to reject and ban */ + reject_senders: string[]; +} +export interface ResponseApplySnapshotChunkAminoMsg { + type: "/tendermint.abci.ResponseApplySnapshotChunk"; + value: ResponseApplySnapshotChunkAmino; +} +export interface ResponsePrepareProposal { + txs: Uint8Array[]; +} +export interface ResponsePrepareProposalProtoMsg { + typeUrl: "/tendermint.abci.ResponsePrepareProposal"; + value: Uint8Array; +} +export interface ResponsePrepareProposalAmino { + txs: string[]; +} +export interface ResponsePrepareProposalAminoMsg { + type: "/tendermint.abci.ResponsePrepareProposal"; + value: ResponsePrepareProposalAmino; +} +export interface ResponseProcessProposal { + status: ResponseProcessProposal_ProposalStatus; +} +export interface ResponseProcessProposalProtoMsg { + typeUrl: "/tendermint.abci.ResponseProcessProposal"; + value: Uint8Array; +} +export interface ResponseProcessProposalAmino { + status: ResponseProcessProposal_ProposalStatus; +} +export interface ResponseProcessProposalAminoMsg { + type: "/tendermint.abci.ResponseProcessProposal"; + value: ResponseProcessProposalAmino; +} +export interface ResponseExtendVote { + voteExtension: Uint8Array; +} +export interface ResponseExtendVoteProtoMsg { + typeUrl: "/tendermint.abci.ResponseExtendVote"; + value: Uint8Array; +} +export interface ResponseExtendVoteAmino { + vote_extension: string; +} +export interface ResponseExtendVoteAminoMsg { + type: "/tendermint.abci.ResponseExtendVote"; + value: ResponseExtendVoteAmino; +} +export interface ResponseVerifyVoteExtension { + status: ResponseVerifyVoteExtension_VerifyStatus; +} +export interface ResponseVerifyVoteExtensionProtoMsg { + typeUrl: "/tendermint.abci.ResponseVerifyVoteExtension"; + value: Uint8Array; +} +export interface ResponseVerifyVoteExtensionAmino { + status: ResponseVerifyVoteExtension_VerifyStatus; +} +export interface ResponseVerifyVoteExtensionAminoMsg { + type: "/tendermint.abci.ResponseVerifyVoteExtension"; + value: ResponseVerifyVoteExtensionAmino; +} +export interface ResponseFinalizeBlock { + /** set of block events emmitted as part of executing the block */ + events: Event[]; + /** + * the result of executing each transaction including the events + * the particular transction emitted. This should match the order + * of the transactions delivered in the block itself + */ + txResults: ExecTxResult[]; + /** a list of updates to the validator set. These will reflect the validator set at current height + 2. */ + validatorUpdates: ValidatorUpdate[]; + /** updates to the consensus params, if any. */ + consensusParamUpdates?: ConsensusParams; + /** + * app_hash is the hash of the applications' state which is used to confirm that execution of the transactions was + * deterministic. It is up to the application to decide which algorithm to use. + */ + appHash: Uint8Array; +} +export interface ResponseFinalizeBlockProtoMsg { + typeUrl: "/tendermint.abci.ResponseFinalizeBlock"; + value: Uint8Array; +} +export interface ResponseFinalizeBlockAmino { + /** set of block events emmitted as part of executing the block */ + events: EventAmino[]; + /** + * the result of executing each transaction including the events + * the particular transction emitted. This should match the order + * of the transactions delivered in the block itself + */ + tx_results: ExecTxResultAmino[]; + /** a list of updates to the validator set. These will reflect the validator set at current height + 2. */ + validator_updates: ValidatorUpdateAmino[]; + /** updates to the consensus params, if any. */ + consensus_param_updates?: ConsensusParamsAmino; + /** + * app_hash is the hash of the applications' state which is used to confirm that execution of the transactions was + * deterministic. It is up to the application to decide which algorithm to use. + */ + app_hash: string; +} +export interface ResponseFinalizeBlockAminoMsg { + type: "/tendermint.abci.ResponseFinalizeBlock"; + value: ResponseFinalizeBlockAmino; +} +export interface CommitInfo { + round: number; + votes: VoteInfo[]; +} +export interface CommitInfoProtoMsg { + typeUrl: "/tendermint.abci.CommitInfo"; + value: Uint8Array; +} +export interface CommitInfoAmino { + round: number; + votes: VoteInfoAmino[]; +} +export interface CommitInfoAminoMsg { + type: "/tendermint.abci.CommitInfo"; + value: CommitInfoAmino; +} +/** + * ExtendedCommitInfo is similar to CommitInfo except that it is only used in + * the PrepareProposal request such that CometBFT can provide vote extensions + * to the application. + */ +export interface ExtendedCommitInfo { + /** The round at which the block proposer decided in the previous height. */ + round: number; + /** + * List of validators' addresses in the last validator set with their voting + * information, including vote extensions. + */ + votes: ExtendedVoteInfo[]; +} +export interface ExtendedCommitInfoProtoMsg { + typeUrl: "/tendermint.abci.ExtendedCommitInfo"; + value: Uint8Array; +} +/** + * ExtendedCommitInfo is similar to CommitInfo except that it is only used in + * the PrepareProposal request such that CometBFT can provide vote extensions + * to the application. + */ +export interface ExtendedCommitInfoAmino { + /** The round at which the block proposer decided in the previous height. */ + round: number; + /** + * List of validators' addresses in the last validator set with their voting + * information, including vote extensions. + */ + votes: ExtendedVoteInfoAmino[]; +} +export interface ExtendedCommitInfoAminoMsg { + type: "/tendermint.abci.ExtendedCommitInfo"; + value: ExtendedCommitInfoAmino; +} +/** + * Event allows application developers to attach additional information to + * ResponseFinalizeBlock and ResponseCheckTx. + * Later, transactions may be queried using these events. + */ +export interface Event { + type: string; + attributes: EventAttribute[]; +} +export interface EventProtoMsg { + typeUrl: "/tendermint.abci.Event"; + value: Uint8Array; +} +/** + * Event allows application developers to attach additional information to + * ResponseFinalizeBlock and ResponseCheckTx. + * Later, transactions may be queried using these events. + */ +export interface EventAmino { + type: string; + attributes: EventAttributeAmino[]; +} +export interface EventAminoMsg { + type: "/tendermint.abci.Event"; + value: EventAmino; +} +/** EventAttribute is a single key-value pair, associated with an event. */ +export interface EventAttribute { + key: string; + value: string; + /** nondeterministic */ + index: boolean; +} +export interface EventAttributeProtoMsg { + typeUrl: "/tendermint.abci.EventAttribute"; + value: Uint8Array; +} +/** EventAttribute is a single key-value pair, associated with an event. */ +export interface EventAttributeAmino { + key: string; + value: string; + /** nondeterministic */ + index: boolean; +} +export interface EventAttributeAminoMsg { + type: "/tendermint.abci.EventAttribute"; + value: EventAttributeAmino; +} +/** + * ExecTxResult contains results of executing one individual transaction. + * + * * Its structure is equivalent to #ResponseDeliverTx which will be deprecated/deleted + */ +export interface ExecTxResult { + code: number; + data: Uint8Array; + /** nondeterministic */ + log: string; + /** nondeterministic */ + info: string; + gasWanted: bigint; + gasUsed: bigint; + events: Event[]; + codespace: string; +} +export interface ExecTxResultProtoMsg { + typeUrl: "/tendermint.abci.ExecTxResult"; + value: Uint8Array; +} +/** + * ExecTxResult contains results of executing one individual transaction. + * + * * Its structure is equivalent to #ResponseDeliverTx which will be deprecated/deleted + */ +export interface ExecTxResultAmino { + code: number; + data: string; + /** nondeterministic */ + log: string; + /** nondeterministic */ + info: string; + gas_wanted: string; + gas_used: string; + events: EventAmino[]; + codespace: string; +} +export interface ExecTxResultAminoMsg { + type: "/tendermint.abci.ExecTxResult"; + value: ExecTxResultAmino; +} +/** + * TxResult contains results of executing the transaction. + * + * One usage is indexing transaction results. + */ +export interface TxResult { + height: bigint; + index: number; + tx: Uint8Array; + result: ExecTxResult; +} +export interface TxResultProtoMsg { + typeUrl: "/tendermint.abci.TxResult"; + value: Uint8Array; +} +/** + * TxResult contains results of executing the transaction. + * + * One usage is indexing transaction results. + */ +export interface TxResultAmino { + height: string; + index: number; + tx: string; + result: ExecTxResultAmino; +} +export interface TxResultAminoMsg { + type: "/tendermint.abci.TxResult"; + value: TxResultAmino; +} +export interface Validator { + /** The first 20 bytes of SHA256(public key) */ + address: Uint8Array; + /** PubKey pub_key = 2 [(gogoproto.nullable)=false]; */ + power: bigint; +} +export interface ValidatorProtoMsg { + typeUrl: "/tendermint.abci.Validator"; + value: Uint8Array; +} +export interface ValidatorAmino { + /** The first 20 bytes of SHA256(public key) */ + address: string; + /** PubKey pub_key = 2 [(gogoproto.nullable)=false]; */ + power: string; +} +export interface ValidatorAminoMsg { + type: "/tendermint.abci.Validator"; + value: ValidatorAmino; +} +export interface ValidatorUpdate { + pubKey: PublicKey; + power: bigint; +} +export interface ValidatorUpdateProtoMsg { + typeUrl: "/tendermint.abci.ValidatorUpdate"; + value: Uint8Array; +} +export interface ValidatorUpdateAmino { + pub_key: PublicKeyAmino; + power: string; +} +export interface ValidatorUpdateAminoMsg { + type: "/tendermint.abci.ValidatorUpdate"; + value: ValidatorUpdateAmino; +} +export interface VoteInfo { + validator: Validator; + blockIdFlag: BlockIDFlag; +} +export interface VoteInfoProtoMsg { + typeUrl: "/tendermint.abci.VoteInfo"; + value: Uint8Array; +} +export interface VoteInfoAmino { + validator: ValidatorAmino; + block_id_flag: BlockIDFlag; +} +export interface VoteInfoAminoMsg { + type: "/tendermint.abci.VoteInfo"; + value: VoteInfoAmino; +} +export interface ExtendedVoteInfo { + /** The validator that sent the vote. */ + validator: Validator; + /** Non-deterministic extension provided by the sending validator's application. */ + voteExtension: Uint8Array; + /** Vote extension signature created by CometBFT */ + extensionSignature: Uint8Array; + /** block_id_flag indicates whether the validator voted for a block, nil, or did not vote at all */ + blockIdFlag: BlockIDFlag; +} +export interface ExtendedVoteInfoProtoMsg { + typeUrl: "/tendermint.abci.ExtendedVoteInfo"; + value: Uint8Array; +} +export interface ExtendedVoteInfoAmino { + /** The validator that sent the vote. */ + validator: ValidatorAmino; + /** Non-deterministic extension provided by the sending validator's application. */ + vote_extension: string; + /** Vote extension signature created by CometBFT */ + extension_signature: string; + /** block_id_flag indicates whether the validator voted for a block, nil, or did not vote at all */ + block_id_flag: BlockIDFlag; +} +export interface ExtendedVoteInfoAminoMsg { + type: "/tendermint.abci.ExtendedVoteInfo"; + value: ExtendedVoteInfoAmino; +} +export interface Misbehavior { + type: MisbehaviorType; + /** The offending validator */ + validator: Validator; + /** The height when the offense occurred */ + height: bigint; + /** The corresponding time where the offense occurred */ + time: Date; + /** + * Total voting power of the validator set in case the ABCI application does + * not store historical validators. + * https://github.com/tendermint/tendermint/issues/4581 + */ + totalVotingPower: bigint; +} +export interface MisbehaviorProtoMsg { + typeUrl: "/tendermint.abci.Misbehavior"; + value: Uint8Array; +} +export interface MisbehaviorAmino { + type: MisbehaviorType; + /** The offending validator */ + validator: ValidatorAmino; + /** The height when the offense occurred */ + height: string; + /** The corresponding time where the offense occurred */ + time: string; + /** + * Total voting power of the validator set in case the ABCI application does + * not store historical validators. + * https://github.com/tendermint/tendermint/issues/4581 + */ + total_voting_power: string; +} +export interface MisbehaviorAminoMsg { + type: "/tendermint.abci.Misbehavior"; + value: MisbehaviorAmino; +} +export interface Snapshot { + /** The height at which the snapshot was taken */ + height: bigint; + /** The application-specific snapshot format */ + format: number; + /** Number of chunks in the snapshot */ + chunks: number; + /** Arbitrary snapshot hash, equal only if identical */ + hash: Uint8Array; + /** Arbitrary application metadata */ + metadata: Uint8Array; +} +export interface SnapshotProtoMsg { + typeUrl: "/tendermint.abci.Snapshot"; + value: Uint8Array; +} +export interface SnapshotAmino { + /** The height at which the snapshot was taken */ + height: string; + /** The application-specific snapshot format */ + format: number; + /** Number of chunks in the snapshot */ + chunks: number; + /** Arbitrary snapshot hash, equal only if identical */ + hash: string; + /** Arbitrary application metadata */ + metadata: string; +} +export interface SnapshotAminoMsg { + type: "/tendermint.abci.Snapshot"; + value: SnapshotAmino; +} +function createBaseRequest(): Request { + return { + echo: undefined, + flush: undefined, + info: undefined, + initChain: undefined, + query: undefined, + checkTx: undefined, + commit: undefined, + listSnapshots: undefined, + offerSnapshot: undefined, + loadSnapshotChunk: undefined, + applySnapshotChunk: undefined, + prepareProposal: undefined, + processProposal: undefined, + extendVote: undefined, + verifyVoteExtension: undefined, + finalizeBlock: undefined + }; +} +export const Request = { + typeUrl: "/tendermint.abci.Request", + is(o: any): o is Request { + return o && o.$typeUrl === Request.typeUrl; + }, + isAmino(o: any): o is RequestAmino { + return o && o.$typeUrl === Request.typeUrl; + }, + encode(message: Request, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.echo !== undefined) { + RequestEcho.encode(message.echo, writer.uint32(10).fork()).ldelim(); + } + if (message.flush !== undefined) { + RequestFlush.encode(message.flush, writer.uint32(18).fork()).ldelim(); + } + if (message.info !== undefined) { + RequestInfo.encode(message.info, writer.uint32(26).fork()).ldelim(); + } + if (message.initChain !== undefined) { + RequestInitChain.encode(message.initChain, writer.uint32(42).fork()).ldelim(); + } + if (message.query !== undefined) { + RequestQuery.encode(message.query, writer.uint32(50).fork()).ldelim(); + } + if (message.checkTx !== undefined) { + RequestCheckTx.encode(message.checkTx, writer.uint32(66).fork()).ldelim(); + } + if (message.commit !== undefined) { + RequestCommit.encode(message.commit, writer.uint32(90).fork()).ldelim(); + } + if (message.listSnapshots !== undefined) { + RequestListSnapshots.encode(message.listSnapshots, writer.uint32(98).fork()).ldelim(); + } + if (message.offerSnapshot !== undefined) { + RequestOfferSnapshot.encode(message.offerSnapshot, writer.uint32(106).fork()).ldelim(); + } + if (message.loadSnapshotChunk !== undefined) { + RequestLoadSnapshotChunk.encode(message.loadSnapshotChunk, writer.uint32(114).fork()).ldelim(); + } + if (message.applySnapshotChunk !== undefined) { + RequestApplySnapshotChunk.encode(message.applySnapshotChunk, writer.uint32(122).fork()).ldelim(); + } + if (message.prepareProposal !== undefined) { + RequestPrepareProposal.encode(message.prepareProposal, writer.uint32(130).fork()).ldelim(); + } + if (message.processProposal !== undefined) { + RequestProcessProposal.encode(message.processProposal, writer.uint32(138).fork()).ldelim(); + } + if (message.extendVote !== undefined) { + RequestExtendVote.encode(message.extendVote, writer.uint32(146).fork()).ldelim(); + } + if (message.verifyVoteExtension !== undefined) { + RequestVerifyVoteExtension.encode(message.verifyVoteExtension, writer.uint32(154).fork()).ldelim(); + } + if (message.finalizeBlock !== undefined) { + RequestFinalizeBlock.encode(message.finalizeBlock, writer.uint32(162).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Request { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.echo = RequestEcho.decode(reader, reader.uint32()); + break; + case 2: + message.flush = RequestFlush.decode(reader, reader.uint32()); + break; + case 3: + message.info = RequestInfo.decode(reader, reader.uint32()); + break; + case 5: + message.initChain = RequestInitChain.decode(reader, reader.uint32()); + break; + case 6: + message.query = RequestQuery.decode(reader, reader.uint32()); + break; + case 8: + message.checkTx = RequestCheckTx.decode(reader, reader.uint32()); + break; + case 11: + message.commit = RequestCommit.decode(reader, reader.uint32()); + break; + case 12: + message.listSnapshots = RequestListSnapshots.decode(reader, reader.uint32()); + break; + case 13: + message.offerSnapshot = RequestOfferSnapshot.decode(reader, reader.uint32()); + break; + case 14: + message.loadSnapshotChunk = RequestLoadSnapshotChunk.decode(reader, reader.uint32()); + break; + case 15: + message.applySnapshotChunk = RequestApplySnapshotChunk.decode(reader, reader.uint32()); + break; + case 16: + message.prepareProposal = RequestPrepareProposal.decode(reader, reader.uint32()); + break; + case 17: + message.processProposal = RequestProcessProposal.decode(reader, reader.uint32()); + break; + case 18: + message.extendVote = RequestExtendVote.decode(reader, reader.uint32()); + break; + case 19: + message.verifyVoteExtension = RequestVerifyVoteExtension.decode(reader, reader.uint32()); + break; + case 20: + message.finalizeBlock = RequestFinalizeBlock.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Request { + const message = createBaseRequest(); + message.echo = object.echo !== undefined && object.echo !== null ? RequestEcho.fromPartial(object.echo) : undefined; + message.flush = object.flush !== undefined && object.flush !== null ? RequestFlush.fromPartial(object.flush) : undefined; + message.info = object.info !== undefined && object.info !== null ? RequestInfo.fromPartial(object.info) : undefined; + message.initChain = object.initChain !== undefined && object.initChain !== null ? RequestInitChain.fromPartial(object.initChain) : undefined; + message.query = object.query !== undefined && object.query !== null ? RequestQuery.fromPartial(object.query) : undefined; + message.checkTx = object.checkTx !== undefined && object.checkTx !== null ? RequestCheckTx.fromPartial(object.checkTx) : undefined; + message.commit = object.commit !== undefined && object.commit !== null ? RequestCommit.fromPartial(object.commit) : undefined; + message.listSnapshots = object.listSnapshots !== undefined && object.listSnapshots !== null ? RequestListSnapshots.fromPartial(object.listSnapshots) : undefined; + message.offerSnapshot = object.offerSnapshot !== undefined && object.offerSnapshot !== null ? RequestOfferSnapshot.fromPartial(object.offerSnapshot) : undefined; + message.loadSnapshotChunk = object.loadSnapshotChunk !== undefined && object.loadSnapshotChunk !== null ? RequestLoadSnapshotChunk.fromPartial(object.loadSnapshotChunk) : undefined; + message.applySnapshotChunk = object.applySnapshotChunk !== undefined && object.applySnapshotChunk !== null ? RequestApplySnapshotChunk.fromPartial(object.applySnapshotChunk) : undefined; + message.prepareProposal = object.prepareProposal !== undefined && object.prepareProposal !== null ? RequestPrepareProposal.fromPartial(object.prepareProposal) : undefined; + message.processProposal = object.processProposal !== undefined && object.processProposal !== null ? RequestProcessProposal.fromPartial(object.processProposal) : undefined; + message.extendVote = object.extendVote !== undefined && object.extendVote !== null ? RequestExtendVote.fromPartial(object.extendVote) : undefined; + message.verifyVoteExtension = object.verifyVoteExtension !== undefined && object.verifyVoteExtension !== null ? RequestVerifyVoteExtension.fromPartial(object.verifyVoteExtension) : undefined; + message.finalizeBlock = object.finalizeBlock !== undefined && object.finalizeBlock !== null ? RequestFinalizeBlock.fromPartial(object.finalizeBlock) : undefined; + return message; + }, + fromAmino(object: RequestAmino): Request { + const message = createBaseRequest(); + if (object.echo !== undefined && object.echo !== null) { + message.echo = RequestEcho.fromAmino(object.echo); + } + if (object.flush !== undefined && object.flush !== null) { + message.flush = RequestFlush.fromAmino(object.flush); + } + if (object.info !== undefined && object.info !== null) { + message.info = RequestInfo.fromAmino(object.info); + } + if (object.init_chain !== undefined && object.init_chain !== null) { + message.initChain = RequestInitChain.fromAmino(object.init_chain); + } + if (object.query !== undefined && object.query !== null) { + message.query = RequestQuery.fromAmino(object.query); + } + if (object.check_tx !== undefined && object.check_tx !== null) { + message.checkTx = RequestCheckTx.fromAmino(object.check_tx); + } + if (object.commit !== undefined && object.commit !== null) { + message.commit = RequestCommit.fromAmino(object.commit); + } + if (object.list_snapshots !== undefined && object.list_snapshots !== null) { + message.listSnapshots = RequestListSnapshots.fromAmino(object.list_snapshots); + } + if (object.offer_snapshot !== undefined && object.offer_snapshot !== null) { + message.offerSnapshot = RequestOfferSnapshot.fromAmino(object.offer_snapshot); + } + if (object.load_snapshot_chunk !== undefined && object.load_snapshot_chunk !== null) { + message.loadSnapshotChunk = RequestLoadSnapshotChunk.fromAmino(object.load_snapshot_chunk); + } + if (object.apply_snapshot_chunk !== undefined && object.apply_snapshot_chunk !== null) { + message.applySnapshotChunk = RequestApplySnapshotChunk.fromAmino(object.apply_snapshot_chunk); + } + if (object.prepare_proposal !== undefined && object.prepare_proposal !== null) { + message.prepareProposal = RequestPrepareProposal.fromAmino(object.prepare_proposal); + } + if (object.process_proposal !== undefined && object.process_proposal !== null) { + message.processProposal = RequestProcessProposal.fromAmino(object.process_proposal); + } + if (object.extend_vote !== undefined && object.extend_vote !== null) { + message.extendVote = RequestExtendVote.fromAmino(object.extend_vote); + } + if (object.verify_vote_extension !== undefined && object.verify_vote_extension !== null) { + message.verifyVoteExtension = RequestVerifyVoteExtension.fromAmino(object.verify_vote_extension); + } + if (object.finalize_block !== undefined && object.finalize_block !== null) { + message.finalizeBlock = RequestFinalizeBlock.fromAmino(object.finalize_block); + } + return message; + }, + toAmino(message: Request): RequestAmino { + const obj: any = {}; + obj.echo = message.echo ? RequestEcho.toAmino(message.echo) : undefined; + obj.flush = message.flush ? RequestFlush.toAmino(message.flush) : undefined; + obj.info = message.info ? RequestInfo.toAmino(message.info) : undefined; + obj.init_chain = message.initChain ? RequestInitChain.toAmino(message.initChain) : undefined; + obj.query = message.query ? RequestQuery.toAmino(message.query) : undefined; + obj.check_tx = message.checkTx ? RequestCheckTx.toAmino(message.checkTx) : undefined; + obj.commit = message.commit ? RequestCommit.toAmino(message.commit) : undefined; + obj.list_snapshots = message.listSnapshots ? RequestListSnapshots.toAmino(message.listSnapshots) : undefined; + obj.offer_snapshot = message.offerSnapshot ? RequestOfferSnapshot.toAmino(message.offerSnapshot) : undefined; + obj.load_snapshot_chunk = message.loadSnapshotChunk ? RequestLoadSnapshotChunk.toAmino(message.loadSnapshotChunk) : undefined; + obj.apply_snapshot_chunk = message.applySnapshotChunk ? RequestApplySnapshotChunk.toAmino(message.applySnapshotChunk) : undefined; + obj.prepare_proposal = message.prepareProposal ? RequestPrepareProposal.toAmino(message.prepareProposal) : undefined; + obj.process_proposal = message.processProposal ? RequestProcessProposal.toAmino(message.processProposal) : undefined; + obj.extend_vote = message.extendVote ? RequestExtendVote.toAmino(message.extendVote) : undefined; + obj.verify_vote_extension = message.verifyVoteExtension ? RequestVerifyVoteExtension.toAmino(message.verifyVoteExtension) : undefined; + obj.finalize_block = message.finalizeBlock ? RequestFinalizeBlock.toAmino(message.finalizeBlock) : undefined; + return obj; + }, + fromAminoMsg(object: RequestAminoMsg): Request { + return Request.fromAmino(object.value); + }, + fromProtoMsg(message: RequestProtoMsg): Request { + return Request.decode(message.value); + }, + toProto(message: Request): Uint8Array { + return Request.encode(message).finish(); + }, + toProtoMsg(message: Request): RequestProtoMsg { + return { + typeUrl: "/tendermint.abci.Request", + value: Request.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Request.typeUrl, Request); +function createBaseRequestEcho(): RequestEcho { + return { + message: "" + }; +} +export const RequestEcho = { + typeUrl: "/tendermint.abci.RequestEcho", + is(o: any): o is RequestEcho { + return o && (o.$typeUrl === RequestEcho.typeUrl || typeof o.message === "string"); + }, + isAmino(o: any): o is RequestEchoAmino { + return o && (o.$typeUrl === RequestEcho.typeUrl || typeof o.message === "string"); + }, + encode(message: RequestEcho, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.message !== "") { + writer.uint32(10).string(message.message); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RequestEcho { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestEcho(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.message = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): RequestEcho { + const message = createBaseRequestEcho(); + message.message = object.message ?? ""; + return message; + }, + fromAmino(object: RequestEchoAmino): RequestEcho { + const message = createBaseRequestEcho(); + if (object.message !== undefined && object.message !== null) { + message.message = object.message; + } + return message; + }, + toAmino(message: RequestEcho): RequestEchoAmino { + const obj: any = {}; + obj.message = message.message === "" ? undefined : message.message; + return obj; + }, + fromAminoMsg(object: RequestEchoAminoMsg): RequestEcho { + return RequestEcho.fromAmino(object.value); + }, + fromProtoMsg(message: RequestEchoProtoMsg): RequestEcho { + return RequestEcho.decode(message.value); + }, + toProto(message: RequestEcho): Uint8Array { + return RequestEcho.encode(message).finish(); + }, + toProtoMsg(message: RequestEcho): RequestEchoProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestEcho", + value: RequestEcho.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(RequestEcho.typeUrl, RequestEcho); +function createBaseRequestFlush(): RequestFlush { + return {}; +} +export const RequestFlush = { + typeUrl: "/tendermint.abci.RequestFlush", + is(o: any): o is RequestFlush { + return o && o.$typeUrl === RequestFlush.typeUrl; + }, + isAmino(o: any): o is RequestFlushAmino { + return o && o.$typeUrl === RequestFlush.typeUrl; + }, + encode(_: RequestFlush, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RequestFlush { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestFlush(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): RequestFlush { + const message = createBaseRequestFlush(); + return message; + }, + fromAmino(_: RequestFlushAmino): RequestFlush { + const message = createBaseRequestFlush(); + return message; + }, + toAmino(_: RequestFlush): RequestFlushAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: RequestFlushAminoMsg): RequestFlush { + return RequestFlush.fromAmino(object.value); + }, + fromProtoMsg(message: RequestFlushProtoMsg): RequestFlush { + return RequestFlush.decode(message.value); + }, + toProto(message: RequestFlush): Uint8Array { + return RequestFlush.encode(message).finish(); + }, + toProtoMsg(message: RequestFlush): RequestFlushProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestFlush", + value: RequestFlush.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(RequestFlush.typeUrl, RequestFlush); +function createBaseRequestInfo(): RequestInfo { + return { + version: "", + blockVersion: BigInt(0), + p2pVersion: BigInt(0), + abciVersion: "" + }; +} +export const RequestInfo = { + typeUrl: "/tendermint.abci.RequestInfo", + is(o: any): o is RequestInfo { + return o && (o.$typeUrl === RequestInfo.typeUrl || typeof o.version === "string" && typeof o.blockVersion === "bigint" && typeof o.p2pVersion === "bigint" && typeof o.abciVersion === "string"); + }, + isAmino(o: any): o is RequestInfoAmino { + return o && (o.$typeUrl === RequestInfo.typeUrl || typeof o.version === "string" && typeof o.block_version === "bigint" && typeof o.p2p_version === "bigint" && typeof o.abci_version === "string"); + }, + encode(message: RequestInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.version !== "") { + writer.uint32(10).string(message.version); + } + if (message.blockVersion !== BigInt(0)) { + writer.uint32(16).uint64(message.blockVersion); + } + if (message.p2pVersion !== BigInt(0)) { + writer.uint32(24).uint64(message.p2pVersion); + } + if (message.abciVersion !== "") { + writer.uint32(34).string(message.abciVersion); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RequestInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.version = reader.string(); + break; + case 2: + message.blockVersion = reader.uint64(); + break; + case 3: + message.p2pVersion = reader.uint64(); + break; + case 4: + message.abciVersion = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): RequestInfo { + const message = createBaseRequestInfo(); + message.version = object.version ?? ""; + message.blockVersion = object.blockVersion !== undefined && object.blockVersion !== null ? BigInt(object.blockVersion.toString()) : BigInt(0); + message.p2pVersion = object.p2pVersion !== undefined && object.p2pVersion !== null ? BigInt(object.p2pVersion.toString()) : BigInt(0); + message.abciVersion = object.abciVersion ?? ""; + return message; + }, + fromAmino(object: RequestInfoAmino): RequestInfo { + const message = createBaseRequestInfo(); + if (object.version !== undefined && object.version !== null) { + message.version = object.version; + } + if (object.block_version !== undefined && object.block_version !== null) { + message.blockVersion = BigInt(object.block_version); + } + if (object.p2p_version !== undefined && object.p2p_version !== null) { + message.p2pVersion = BigInt(object.p2p_version); + } + if (object.abci_version !== undefined && object.abci_version !== null) { + message.abciVersion = object.abci_version; + } + return message; + }, + toAmino(message: RequestInfo): RequestInfoAmino { + const obj: any = {}; + obj.version = message.version === "" ? undefined : message.version; + obj.block_version = message.blockVersion !== BigInt(0) ? message.blockVersion?.toString() : undefined; + obj.p2p_version = message.p2pVersion !== BigInt(0) ? message.p2pVersion?.toString() : undefined; + obj.abci_version = message.abciVersion === "" ? undefined : message.abciVersion; + return obj; + }, + fromAminoMsg(object: RequestInfoAminoMsg): RequestInfo { + return RequestInfo.fromAmino(object.value); + }, + fromProtoMsg(message: RequestInfoProtoMsg): RequestInfo { + return RequestInfo.decode(message.value); + }, + toProto(message: RequestInfo): Uint8Array { + return RequestInfo.encode(message).finish(); + }, + toProtoMsg(message: RequestInfo): RequestInfoProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestInfo", + value: RequestInfo.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(RequestInfo.typeUrl, RequestInfo); +function createBaseRequestInitChain(): RequestInitChain { + return { + time: new Date(), + chainId: "", + consensusParams: undefined, + validators: [], + appStateBytes: new Uint8Array(), + initialHeight: BigInt(0) + }; +} +export const RequestInitChain = { + typeUrl: "/tendermint.abci.RequestInitChain", + is(o: any): o is RequestInitChain { + return o && (o.$typeUrl === RequestInitChain.typeUrl || Timestamp.is(o.time) && typeof o.chainId === "string" && Array.isArray(o.validators) && (!o.validators.length || ValidatorUpdate.is(o.validators[0])) && (o.appStateBytes instanceof Uint8Array || typeof o.appStateBytes === "string") && typeof o.initialHeight === "bigint"); + }, + isAmino(o: any): o is RequestInitChainAmino { + return o && (o.$typeUrl === RequestInitChain.typeUrl || Timestamp.isAmino(o.time) && typeof o.chain_id === "string" && Array.isArray(o.validators) && (!o.validators.length || ValidatorUpdate.isAmino(o.validators[0])) && (o.app_state_bytes instanceof Uint8Array || typeof o.app_state_bytes === "string") && typeof o.initial_height === "bigint"); + }, + encode(message: RequestInitChain, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(10).fork()).ldelim(); + } + if (message.chainId !== "") { + writer.uint32(18).string(message.chainId); + } + if (message.consensusParams !== undefined) { + ConsensusParams.encode(message.consensusParams, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.validators) { + ValidatorUpdate.encode(v!, writer.uint32(34).fork()).ldelim(); + } + if (message.appStateBytes.length !== 0) { + writer.uint32(42).bytes(message.appStateBytes); + } + if (message.initialHeight !== BigInt(0)) { + writer.uint32(48).int64(message.initialHeight); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RequestInitChain { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestInitChain(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 2: + message.chainId = reader.string(); + break; + case 3: + message.consensusParams = ConsensusParams.decode(reader, reader.uint32()); + break; + case 4: + message.validators.push(ValidatorUpdate.decode(reader, reader.uint32())); + break; + case 5: + message.appStateBytes = reader.bytes(); + break; + case 6: + message.initialHeight = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): RequestInitChain { + const message = createBaseRequestInitChain(); + message.time = object.time ?? undefined; + message.chainId = object.chainId ?? ""; + message.consensusParams = object.consensusParams !== undefined && object.consensusParams !== null ? ConsensusParams.fromPartial(object.consensusParams) : undefined; + message.validators = object.validators?.map(e => ValidatorUpdate.fromPartial(e)) || []; + message.appStateBytes = object.appStateBytes ?? new Uint8Array(); + message.initialHeight = object.initialHeight !== undefined && object.initialHeight !== null ? BigInt(object.initialHeight.toString()) : BigInt(0); + return message; + }, + fromAmino(object: RequestInitChainAmino): RequestInitChain { + const message = createBaseRequestInitChain(); + if (object.time !== undefined && object.time !== null) { + message.time = fromTimestamp(Timestamp.fromAmino(object.time)); + } + if (object.chain_id !== undefined && object.chain_id !== null) { + message.chainId = object.chain_id; + } + if (object.consensus_params !== undefined && object.consensus_params !== null) { + message.consensusParams = ConsensusParams.fromAmino(object.consensus_params); + } + message.validators = object.validators?.map(e => ValidatorUpdate.fromAmino(e)) || []; + if (object.app_state_bytes !== undefined && object.app_state_bytes !== null) { + message.appStateBytes = bytesFromBase64(object.app_state_bytes); + } + if (object.initial_height !== undefined && object.initial_height !== null) { + message.initialHeight = BigInt(object.initial_height); + } + return message; + }, + toAmino(message: RequestInitChain): RequestInitChainAmino { + const obj: any = {}; + obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; + obj.consensus_params = message.consensusParams ? ConsensusParams.toAmino(message.consensusParams) : undefined; + if (message.validators) { + obj.validators = message.validators.map(e => e ? ValidatorUpdate.toAmino(e) : undefined); + } else { + obj.validators = message.validators; + } + obj.app_state_bytes = message.appStateBytes ? base64FromBytes(message.appStateBytes) : undefined; + obj.initial_height = message.initialHeight !== BigInt(0) ? message.initialHeight?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: RequestInitChainAminoMsg): RequestInitChain { + return RequestInitChain.fromAmino(object.value); + }, + fromProtoMsg(message: RequestInitChainProtoMsg): RequestInitChain { + return RequestInitChain.decode(message.value); + }, + toProto(message: RequestInitChain): Uint8Array { + return RequestInitChain.encode(message).finish(); + }, + toProtoMsg(message: RequestInitChain): RequestInitChainProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestInitChain", + value: RequestInitChain.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(RequestInitChain.typeUrl, RequestInitChain); +function createBaseRequestQuery(): RequestQuery { + return { + data: new Uint8Array(), + path: "", + height: BigInt(0), + prove: false + }; +} +export const RequestQuery = { + typeUrl: "/tendermint.abci.RequestQuery", + is(o: any): o is RequestQuery { + return o && (o.$typeUrl === RequestQuery.typeUrl || (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.path === "string" && typeof o.height === "bigint" && typeof o.prove === "boolean"); + }, + isAmino(o: any): o is RequestQueryAmino { + return o && (o.$typeUrl === RequestQuery.typeUrl || (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.path === "string" && typeof o.height === "bigint" && typeof o.prove === "boolean"); + }, + encode(message: RequestQuery, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.data.length !== 0) { + writer.uint32(10).bytes(message.data); + } + if (message.path !== "") { + writer.uint32(18).string(message.path); + } + if (message.height !== BigInt(0)) { + writer.uint32(24).int64(message.height); + } + if (message.prove === true) { + writer.uint32(32).bool(message.prove); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RequestQuery { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestQuery(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.data = reader.bytes(); + break; + case 2: + message.path = reader.string(); + break; + case 3: + message.height = reader.int64(); + break; + case 4: + message.prove = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): RequestQuery { + const message = createBaseRequestQuery(); + message.data = object.data ?? new Uint8Array(); + message.path = object.path ?? ""; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.prove = object.prove ?? false; + return message; + }, + fromAmino(object: RequestQueryAmino): RequestQuery { + const message = createBaseRequestQuery(); + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + if (object.path !== undefined && object.path !== null) { + message.path = object.path; + } + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.prove !== undefined && object.prove !== null) { + message.prove = object.prove; + } + return message; + }, + toAmino(message: RequestQuery): RequestQueryAmino { + const obj: any = {}; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + obj.path = message.path === "" ? undefined : message.path; + obj.height = message.height !== BigInt(0) ? message.height?.toString() : undefined; + obj.prove = message.prove === false ? undefined : message.prove; + return obj; + }, + fromAminoMsg(object: RequestQueryAminoMsg): RequestQuery { + return RequestQuery.fromAmino(object.value); + }, + fromProtoMsg(message: RequestQueryProtoMsg): RequestQuery { + return RequestQuery.decode(message.value); + }, + toProto(message: RequestQuery): Uint8Array { + return RequestQuery.encode(message).finish(); + }, + toProtoMsg(message: RequestQuery): RequestQueryProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestQuery", + value: RequestQuery.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(RequestQuery.typeUrl, RequestQuery); +function createBaseRequestCheckTx(): RequestCheckTx { + return { + tx: new Uint8Array(), + type: 0 + }; +} +export const RequestCheckTx = { + typeUrl: "/tendermint.abci.RequestCheckTx", + is(o: any): o is RequestCheckTx { + return o && (o.$typeUrl === RequestCheckTx.typeUrl || (o.tx instanceof Uint8Array || typeof o.tx === "string") && isSet(o.type)); + }, + isAmino(o: any): o is RequestCheckTxAmino { + return o && (o.$typeUrl === RequestCheckTx.typeUrl || (o.tx instanceof Uint8Array || typeof o.tx === "string") && isSet(o.type)); + }, + encode(message: RequestCheckTx, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.tx.length !== 0) { + writer.uint32(10).bytes(message.tx); + } + if (message.type !== 0) { + writer.uint32(16).int32(message.type); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RequestCheckTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestCheckTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.tx = reader.bytes(); + break; + case 2: + message.type = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): RequestCheckTx { + const message = createBaseRequestCheckTx(); + message.tx = object.tx ?? new Uint8Array(); + message.type = object.type ?? 0; + return message; + }, + fromAmino(object: RequestCheckTxAmino): RequestCheckTx { + const message = createBaseRequestCheckTx(); + if (object.tx !== undefined && object.tx !== null) { + message.tx = bytesFromBase64(object.tx); + } + if (object.type !== undefined && object.type !== null) { + message.type = object.type; + } + return message; + }, + toAmino(message: RequestCheckTx): RequestCheckTxAmino { + const obj: any = {}; + obj.tx = message.tx ? base64FromBytes(message.tx) : undefined; + obj.type = message.type === 0 ? undefined : message.type; + return obj; + }, + fromAminoMsg(object: RequestCheckTxAminoMsg): RequestCheckTx { + return RequestCheckTx.fromAmino(object.value); + }, + fromProtoMsg(message: RequestCheckTxProtoMsg): RequestCheckTx { + return RequestCheckTx.decode(message.value); + }, + toProto(message: RequestCheckTx): Uint8Array { + return RequestCheckTx.encode(message).finish(); + }, + toProtoMsg(message: RequestCheckTx): RequestCheckTxProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestCheckTx", + value: RequestCheckTx.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(RequestCheckTx.typeUrl, RequestCheckTx); +function createBaseRequestCommit(): RequestCommit { + return {}; +} +export const RequestCommit = { + typeUrl: "/tendermint.abci.RequestCommit", + is(o: any): o is RequestCommit { + return o && o.$typeUrl === RequestCommit.typeUrl; + }, + isAmino(o: any): o is RequestCommitAmino { + return o && o.$typeUrl === RequestCommit.typeUrl; + }, + encode(_: RequestCommit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RequestCommit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestCommit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): RequestCommit { + const message = createBaseRequestCommit(); + return message; + }, + fromAmino(_: RequestCommitAmino): RequestCommit { + const message = createBaseRequestCommit(); + return message; + }, + toAmino(_: RequestCommit): RequestCommitAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: RequestCommitAminoMsg): RequestCommit { + return RequestCommit.fromAmino(object.value); + }, + fromProtoMsg(message: RequestCommitProtoMsg): RequestCommit { + return RequestCommit.decode(message.value); + }, + toProto(message: RequestCommit): Uint8Array { + return RequestCommit.encode(message).finish(); + }, + toProtoMsg(message: RequestCommit): RequestCommitProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestCommit", + value: RequestCommit.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(RequestCommit.typeUrl, RequestCommit); +function createBaseRequestListSnapshots(): RequestListSnapshots { + return {}; +} +export const RequestListSnapshots = { + typeUrl: "/tendermint.abci.RequestListSnapshots", + is(o: any): o is RequestListSnapshots { + return o && o.$typeUrl === RequestListSnapshots.typeUrl; + }, + isAmino(o: any): o is RequestListSnapshotsAmino { + return o && o.$typeUrl === RequestListSnapshots.typeUrl; + }, + encode(_: RequestListSnapshots, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RequestListSnapshots { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestListSnapshots(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): RequestListSnapshots { + const message = createBaseRequestListSnapshots(); + return message; + }, + fromAmino(_: RequestListSnapshotsAmino): RequestListSnapshots { + const message = createBaseRequestListSnapshots(); + return message; + }, + toAmino(_: RequestListSnapshots): RequestListSnapshotsAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: RequestListSnapshotsAminoMsg): RequestListSnapshots { + return RequestListSnapshots.fromAmino(object.value); + }, + fromProtoMsg(message: RequestListSnapshotsProtoMsg): RequestListSnapshots { + return RequestListSnapshots.decode(message.value); + }, + toProto(message: RequestListSnapshots): Uint8Array { + return RequestListSnapshots.encode(message).finish(); + }, + toProtoMsg(message: RequestListSnapshots): RequestListSnapshotsProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestListSnapshots", + value: RequestListSnapshots.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(RequestListSnapshots.typeUrl, RequestListSnapshots); +function createBaseRequestOfferSnapshot(): RequestOfferSnapshot { + return { + snapshot: undefined, + appHash: new Uint8Array() + }; +} +export const RequestOfferSnapshot = { + typeUrl: "/tendermint.abci.RequestOfferSnapshot", + is(o: any): o is RequestOfferSnapshot { + return o && (o.$typeUrl === RequestOfferSnapshot.typeUrl || o.appHash instanceof Uint8Array || typeof o.appHash === "string"); + }, + isAmino(o: any): o is RequestOfferSnapshotAmino { + return o && (o.$typeUrl === RequestOfferSnapshot.typeUrl || o.app_hash instanceof Uint8Array || typeof o.app_hash === "string"); + }, + encode(message: RequestOfferSnapshot, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.snapshot !== undefined) { + Snapshot.encode(message.snapshot, writer.uint32(10).fork()).ldelim(); + } + if (message.appHash.length !== 0) { + writer.uint32(18).bytes(message.appHash); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RequestOfferSnapshot { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestOfferSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.snapshot = Snapshot.decode(reader, reader.uint32()); + break; + case 2: + message.appHash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): RequestOfferSnapshot { + const message = createBaseRequestOfferSnapshot(); + message.snapshot = object.snapshot !== undefined && object.snapshot !== null ? Snapshot.fromPartial(object.snapshot) : undefined; + message.appHash = object.appHash ?? new Uint8Array(); + return message; + }, + fromAmino(object: RequestOfferSnapshotAmino): RequestOfferSnapshot { + const message = createBaseRequestOfferSnapshot(); + if (object.snapshot !== undefined && object.snapshot !== null) { + message.snapshot = Snapshot.fromAmino(object.snapshot); + } + if (object.app_hash !== undefined && object.app_hash !== null) { + message.appHash = bytesFromBase64(object.app_hash); + } + return message; + }, + toAmino(message: RequestOfferSnapshot): RequestOfferSnapshotAmino { + const obj: any = {}; + obj.snapshot = message.snapshot ? Snapshot.toAmino(message.snapshot) : undefined; + obj.app_hash = message.appHash ? base64FromBytes(message.appHash) : undefined; + return obj; + }, + fromAminoMsg(object: RequestOfferSnapshotAminoMsg): RequestOfferSnapshot { + return RequestOfferSnapshot.fromAmino(object.value); + }, + fromProtoMsg(message: RequestOfferSnapshotProtoMsg): RequestOfferSnapshot { + return RequestOfferSnapshot.decode(message.value); + }, + toProto(message: RequestOfferSnapshot): Uint8Array { + return RequestOfferSnapshot.encode(message).finish(); + }, + toProtoMsg(message: RequestOfferSnapshot): RequestOfferSnapshotProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestOfferSnapshot", + value: RequestOfferSnapshot.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(RequestOfferSnapshot.typeUrl, RequestOfferSnapshot); +function createBaseRequestLoadSnapshotChunk(): RequestLoadSnapshotChunk { + return { + height: BigInt(0), + format: 0, + chunk: 0 + }; +} +export const RequestLoadSnapshotChunk = { + typeUrl: "/tendermint.abci.RequestLoadSnapshotChunk", + is(o: any): o is RequestLoadSnapshotChunk { + return o && (o.$typeUrl === RequestLoadSnapshotChunk.typeUrl || typeof o.height === "bigint" && typeof o.format === "number" && typeof o.chunk === "number"); + }, + isAmino(o: any): o is RequestLoadSnapshotChunkAmino { + return o && (o.$typeUrl === RequestLoadSnapshotChunk.typeUrl || typeof o.height === "bigint" && typeof o.format === "number" && typeof o.chunk === "number"); + }, + encode(message: RequestLoadSnapshotChunk, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { + writer.uint32(8).uint64(message.height); + } + if (message.format !== 0) { + writer.uint32(16).uint32(message.format); + } + if (message.chunk !== 0) { + writer.uint32(24).uint32(message.chunk); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RequestLoadSnapshotChunk { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestLoadSnapshotChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.uint64(); + break; + case 2: + message.format = reader.uint32(); + break; + case 3: + message.chunk = reader.uint32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): RequestLoadSnapshotChunk { + const message = createBaseRequestLoadSnapshotChunk(); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.format = object.format ?? 0; + message.chunk = object.chunk ?? 0; + return message; + }, + fromAmino(object: RequestLoadSnapshotChunkAmino): RequestLoadSnapshotChunk { + const message = createBaseRequestLoadSnapshotChunk(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.format !== undefined && object.format !== null) { + message.format = object.format; + } + if (object.chunk !== undefined && object.chunk !== null) { + message.chunk = object.chunk; + } + return message; + }, + toAmino(message: RequestLoadSnapshotChunk): RequestLoadSnapshotChunkAmino { + const obj: any = {}; + obj.height = message.height !== BigInt(0) ? message.height?.toString() : undefined; + obj.format = message.format === 0 ? undefined : message.format; + obj.chunk = message.chunk === 0 ? undefined : message.chunk; + return obj; + }, + fromAminoMsg(object: RequestLoadSnapshotChunkAminoMsg): RequestLoadSnapshotChunk { + return RequestLoadSnapshotChunk.fromAmino(object.value); + }, + fromProtoMsg(message: RequestLoadSnapshotChunkProtoMsg): RequestLoadSnapshotChunk { + return RequestLoadSnapshotChunk.decode(message.value); + }, + toProto(message: RequestLoadSnapshotChunk): Uint8Array { + return RequestLoadSnapshotChunk.encode(message).finish(); + }, + toProtoMsg(message: RequestLoadSnapshotChunk): RequestLoadSnapshotChunkProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestLoadSnapshotChunk", + value: RequestLoadSnapshotChunk.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(RequestLoadSnapshotChunk.typeUrl, RequestLoadSnapshotChunk); +function createBaseRequestApplySnapshotChunk(): RequestApplySnapshotChunk { + return { + index: 0, + chunk: new Uint8Array(), + sender: "" + }; +} +export const RequestApplySnapshotChunk = { + typeUrl: "/tendermint.abci.RequestApplySnapshotChunk", + is(o: any): o is RequestApplySnapshotChunk { + return o && (o.$typeUrl === RequestApplySnapshotChunk.typeUrl || typeof o.index === "number" && (o.chunk instanceof Uint8Array || typeof o.chunk === "string") && typeof o.sender === "string"); + }, + isAmino(o: any): o is RequestApplySnapshotChunkAmino { + return o && (o.$typeUrl === RequestApplySnapshotChunk.typeUrl || typeof o.index === "number" && (o.chunk instanceof Uint8Array || typeof o.chunk === "string") && typeof o.sender === "string"); + }, + encode(message: RequestApplySnapshotChunk, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.index !== 0) { + writer.uint32(8).uint32(message.index); + } + if (message.chunk.length !== 0) { + writer.uint32(18).bytes(message.chunk); + } + if (message.sender !== "") { + writer.uint32(26).string(message.sender); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RequestApplySnapshotChunk { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestApplySnapshotChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.index = reader.uint32(); + break; + case 2: + message.chunk = reader.bytes(); + break; + case 3: + message.sender = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): RequestApplySnapshotChunk { + const message = createBaseRequestApplySnapshotChunk(); + message.index = object.index ?? 0; + message.chunk = object.chunk ?? new Uint8Array(); + message.sender = object.sender ?? ""; + return message; + }, + fromAmino(object: RequestApplySnapshotChunkAmino): RequestApplySnapshotChunk { + const message = createBaseRequestApplySnapshotChunk(); + if (object.index !== undefined && object.index !== null) { + message.index = object.index; + } + if (object.chunk !== undefined && object.chunk !== null) { + message.chunk = bytesFromBase64(object.chunk); + } + if (object.sender !== undefined && object.sender !== null) { + message.sender = object.sender; + } + return message; + }, + toAmino(message: RequestApplySnapshotChunk): RequestApplySnapshotChunkAmino { + const obj: any = {}; + obj.index = message.index === 0 ? undefined : message.index; + obj.chunk = message.chunk ? base64FromBytes(message.chunk) : undefined; + obj.sender = message.sender === "" ? undefined : message.sender; + return obj; + }, + fromAminoMsg(object: RequestApplySnapshotChunkAminoMsg): RequestApplySnapshotChunk { + return RequestApplySnapshotChunk.fromAmino(object.value); + }, + fromProtoMsg(message: RequestApplySnapshotChunkProtoMsg): RequestApplySnapshotChunk { + return RequestApplySnapshotChunk.decode(message.value); + }, + toProto(message: RequestApplySnapshotChunk): Uint8Array { + return RequestApplySnapshotChunk.encode(message).finish(); + }, + toProtoMsg(message: RequestApplySnapshotChunk): RequestApplySnapshotChunkProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestApplySnapshotChunk", + value: RequestApplySnapshotChunk.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(RequestApplySnapshotChunk.typeUrl, RequestApplySnapshotChunk); +function createBaseRequestPrepareProposal(): RequestPrepareProposal { + return { + maxTxBytes: BigInt(0), + txs: [], + localLastCommit: ExtendedCommitInfo.fromPartial({}), + misbehavior: [], + height: BigInt(0), + time: new Date(), + nextValidatorsHash: new Uint8Array(), + proposerAddress: new Uint8Array() + }; +} +export const RequestPrepareProposal = { + typeUrl: "/tendermint.abci.RequestPrepareProposal", + is(o: any): o is RequestPrepareProposal { + return o && (o.$typeUrl === RequestPrepareProposal.typeUrl || typeof o.maxTxBytes === "bigint" && Array.isArray(o.txs) && (!o.txs.length || o.txs[0] instanceof Uint8Array || typeof o.txs[0] === "string") && ExtendedCommitInfo.is(o.localLastCommit) && Array.isArray(o.misbehavior) && (!o.misbehavior.length || Misbehavior.is(o.misbehavior[0])) && typeof o.height === "bigint" && Timestamp.is(o.time) && (o.nextValidatorsHash instanceof Uint8Array || typeof o.nextValidatorsHash === "string") && (o.proposerAddress instanceof Uint8Array || typeof o.proposerAddress === "string")); + }, + isAmino(o: any): o is RequestPrepareProposalAmino { + return o && (o.$typeUrl === RequestPrepareProposal.typeUrl || typeof o.max_tx_bytes === "bigint" && Array.isArray(o.txs) && (!o.txs.length || o.txs[0] instanceof Uint8Array || typeof o.txs[0] === "string") && ExtendedCommitInfo.isAmino(o.local_last_commit) && Array.isArray(o.misbehavior) && (!o.misbehavior.length || Misbehavior.isAmino(o.misbehavior[0])) && typeof o.height === "bigint" && Timestamp.isAmino(o.time) && (o.next_validators_hash instanceof Uint8Array || typeof o.next_validators_hash === "string") && (o.proposer_address instanceof Uint8Array || typeof o.proposer_address === "string")); + }, + encode(message: RequestPrepareProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.maxTxBytes !== BigInt(0)) { + writer.uint32(8).int64(message.maxTxBytes); + } + for (const v of message.txs) { + writer.uint32(18).bytes(v!); + } + if (message.localLastCommit !== undefined) { + ExtendedCommitInfo.encode(message.localLastCommit, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.misbehavior) { + Misbehavior.encode(v!, writer.uint32(34).fork()).ldelim(); + } + if (message.height !== BigInt(0)) { + writer.uint32(40).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(50).fork()).ldelim(); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(58).bytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(66).bytes(message.proposerAddress); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RequestPrepareProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestPrepareProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.maxTxBytes = reader.int64(); + break; + case 2: + message.txs.push(reader.bytes()); + break; + case 3: + message.localLastCommit = ExtendedCommitInfo.decode(reader, reader.uint32()); + break; + case 4: + message.misbehavior.push(Misbehavior.decode(reader, reader.uint32())); + break; + case 5: + message.height = reader.int64(); + break; + case 6: + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 7: + message.nextValidatorsHash = reader.bytes(); + break; + case 8: + message.proposerAddress = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): RequestPrepareProposal { + const message = createBaseRequestPrepareProposal(); + message.maxTxBytes = object.maxTxBytes !== undefined && object.maxTxBytes !== null ? BigInt(object.maxTxBytes.toString()) : BigInt(0); + message.txs = object.txs?.map(e => e) || []; + message.localLastCommit = object.localLastCommit !== undefined && object.localLastCommit !== null ? ExtendedCommitInfo.fromPartial(object.localLastCommit) : undefined; + message.misbehavior = object.misbehavior?.map(e => Misbehavior.fromPartial(e)) || []; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.time = object.time ?? undefined; + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(); + message.proposerAddress = object.proposerAddress ?? new Uint8Array(); + return message; + }, + fromAmino(object: RequestPrepareProposalAmino): RequestPrepareProposal { + const message = createBaseRequestPrepareProposal(); + if (object.max_tx_bytes !== undefined && object.max_tx_bytes !== null) { + message.maxTxBytes = BigInt(object.max_tx_bytes); + } + message.txs = object.txs?.map(e => bytesFromBase64(e)) || []; + if (object.local_last_commit !== undefined && object.local_last_commit !== null) { + message.localLastCommit = ExtendedCommitInfo.fromAmino(object.local_last_commit); + } + message.misbehavior = object.misbehavior?.map(e => Misbehavior.fromAmino(e)) || []; + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.time !== undefined && object.time !== null) { + message.time = fromTimestamp(Timestamp.fromAmino(object.time)); + } + if (object.next_validators_hash !== undefined && object.next_validators_hash !== null) { + message.nextValidatorsHash = bytesFromBase64(object.next_validators_hash); + } + if (object.proposer_address !== undefined && object.proposer_address !== null) { + message.proposerAddress = bytesFromBase64(object.proposer_address); + } + return message; + }, + toAmino(message: RequestPrepareProposal): RequestPrepareProposalAmino { + const obj: any = {}; + obj.max_tx_bytes = message.maxTxBytes !== BigInt(0) ? message.maxTxBytes?.toString() : undefined; + if (message.txs) { + obj.txs = message.txs.map(e => base64FromBytes(e)); + } else { + obj.txs = message.txs; + } + obj.local_last_commit = message.localLastCommit ? ExtendedCommitInfo.toAmino(message.localLastCommit) : undefined; + if (message.misbehavior) { + obj.misbehavior = message.misbehavior.map(e => e ? Misbehavior.toAmino(e) : undefined); + } else { + obj.misbehavior = message.misbehavior; + } + obj.height = message.height !== BigInt(0) ? message.height?.toString() : undefined; + obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; + obj.next_validators_hash = message.nextValidatorsHash ? base64FromBytes(message.nextValidatorsHash) : undefined; + obj.proposer_address = message.proposerAddress ? base64FromBytes(message.proposerAddress) : undefined; + return obj; + }, + fromAminoMsg(object: RequestPrepareProposalAminoMsg): RequestPrepareProposal { + return RequestPrepareProposal.fromAmino(object.value); + }, + fromProtoMsg(message: RequestPrepareProposalProtoMsg): RequestPrepareProposal { + return RequestPrepareProposal.decode(message.value); + }, + toProto(message: RequestPrepareProposal): Uint8Array { + return RequestPrepareProposal.encode(message).finish(); + }, + toProtoMsg(message: RequestPrepareProposal): RequestPrepareProposalProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestPrepareProposal", + value: RequestPrepareProposal.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(RequestPrepareProposal.typeUrl, RequestPrepareProposal); +function createBaseRequestProcessProposal(): RequestProcessProposal { + return { + txs: [], + proposedLastCommit: CommitInfo.fromPartial({}), + misbehavior: [], + hash: new Uint8Array(), + height: BigInt(0), + time: new Date(), + nextValidatorsHash: new Uint8Array(), + proposerAddress: new Uint8Array() + }; +} +export const RequestProcessProposal = { + typeUrl: "/tendermint.abci.RequestProcessProposal", + is(o: any): o is RequestProcessProposal { + return o && (o.$typeUrl === RequestProcessProposal.typeUrl || Array.isArray(o.txs) && (!o.txs.length || o.txs[0] instanceof Uint8Array || typeof o.txs[0] === "string") && CommitInfo.is(o.proposedLastCommit) && Array.isArray(o.misbehavior) && (!o.misbehavior.length || Misbehavior.is(o.misbehavior[0])) && (o.hash instanceof Uint8Array || typeof o.hash === "string") && typeof o.height === "bigint" && Timestamp.is(o.time) && (o.nextValidatorsHash instanceof Uint8Array || typeof o.nextValidatorsHash === "string") && (o.proposerAddress instanceof Uint8Array || typeof o.proposerAddress === "string")); + }, + isAmino(o: any): o is RequestProcessProposalAmino { + return o && (o.$typeUrl === RequestProcessProposal.typeUrl || Array.isArray(o.txs) && (!o.txs.length || o.txs[0] instanceof Uint8Array || typeof o.txs[0] === "string") && CommitInfo.isAmino(o.proposed_last_commit) && Array.isArray(o.misbehavior) && (!o.misbehavior.length || Misbehavior.isAmino(o.misbehavior[0])) && (o.hash instanceof Uint8Array || typeof o.hash === "string") && typeof o.height === "bigint" && Timestamp.isAmino(o.time) && (o.next_validators_hash instanceof Uint8Array || typeof o.next_validators_hash === "string") && (o.proposer_address instanceof Uint8Array || typeof o.proposer_address === "string")); + }, + encode(message: RequestProcessProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.txs) { + writer.uint32(10).bytes(v!); + } + if (message.proposedLastCommit !== undefined) { + CommitInfo.encode(message.proposedLastCommit, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.misbehavior) { + Misbehavior.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.hash.length !== 0) { + writer.uint32(34).bytes(message.hash); + } + if (message.height !== BigInt(0)) { + writer.uint32(40).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(50).fork()).ldelim(); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(58).bytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(66).bytes(message.proposerAddress); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RequestProcessProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestProcessProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.txs.push(reader.bytes()); + break; + case 2: + message.proposedLastCommit = CommitInfo.decode(reader, reader.uint32()); + break; + case 3: + message.misbehavior.push(Misbehavior.decode(reader, reader.uint32())); + break; + case 4: + message.hash = reader.bytes(); + break; + case 5: + message.height = reader.int64(); + break; + case 6: + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 7: + message.nextValidatorsHash = reader.bytes(); + break; + case 8: + message.proposerAddress = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): RequestProcessProposal { + const message = createBaseRequestProcessProposal(); + message.txs = object.txs?.map(e => e) || []; + message.proposedLastCommit = object.proposedLastCommit !== undefined && object.proposedLastCommit !== null ? CommitInfo.fromPartial(object.proposedLastCommit) : undefined; + message.misbehavior = object.misbehavior?.map(e => Misbehavior.fromPartial(e)) || []; + message.hash = object.hash ?? new Uint8Array(); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.time = object.time ?? undefined; + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(); + message.proposerAddress = object.proposerAddress ?? new Uint8Array(); + return message; + }, + fromAmino(object: RequestProcessProposalAmino): RequestProcessProposal { + const message = createBaseRequestProcessProposal(); + message.txs = object.txs?.map(e => bytesFromBase64(e)) || []; + if (object.proposed_last_commit !== undefined && object.proposed_last_commit !== null) { + message.proposedLastCommit = CommitInfo.fromAmino(object.proposed_last_commit); + } + message.misbehavior = object.misbehavior?.map(e => Misbehavior.fromAmino(e)) || []; + if (object.hash !== undefined && object.hash !== null) { + message.hash = bytesFromBase64(object.hash); + } + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.time !== undefined && object.time !== null) { + message.time = fromTimestamp(Timestamp.fromAmino(object.time)); + } + if (object.next_validators_hash !== undefined && object.next_validators_hash !== null) { + message.nextValidatorsHash = bytesFromBase64(object.next_validators_hash); + } + if (object.proposer_address !== undefined && object.proposer_address !== null) { + message.proposerAddress = bytesFromBase64(object.proposer_address); + } + return message; + }, + toAmino(message: RequestProcessProposal): RequestProcessProposalAmino { + const obj: any = {}; + if (message.txs) { + obj.txs = message.txs.map(e => base64FromBytes(e)); + } else { + obj.txs = message.txs; + } + obj.proposed_last_commit = message.proposedLastCommit ? CommitInfo.toAmino(message.proposedLastCommit) : undefined; + if (message.misbehavior) { + obj.misbehavior = message.misbehavior.map(e => e ? Misbehavior.toAmino(e) : undefined); + } else { + obj.misbehavior = message.misbehavior; + } + obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; + obj.height = message.height !== BigInt(0) ? message.height?.toString() : undefined; + obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; + obj.next_validators_hash = message.nextValidatorsHash ? base64FromBytes(message.nextValidatorsHash) : undefined; + obj.proposer_address = message.proposerAddress ? base64FromBytes(message.proposerAddress) : undefined; + return obj; + }, + fromAminoMsg(object: RequestProcessProposalAminoMsg): RequestProcessProposal { + return RequestProcessProposal.fromAmino(object.value); + }, + fromProtoMsg(message: RequestProcessProposalProtoMsg): RequestProcessProposal { + return RequestProcessProposal.decode(message.value); + }, + toProto(message: RequestProcessProposal): Uint8Array { + return RequestProcessProposal.encode(message).finish(); + }, + toProtoMsg(message: RequestProcessProposal): RequestProcessProposalProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestProcessProposal", + value: RequestProcessProposal.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(RequestProcessProposal.typeUrl, RequestProcessProposal); +function createBaseRequestExtendVote(): RequestExtendVote { + return { + hash: new Uint8Array(), + height: BigInt(0), + time: new Date(), + txs: [], + proposedLastCommit: CommitInfo.fromPartial({}), + misbehavior: [], + nextValidatorsHash: new Uint8Array(), + proposerAddress: new Uint8Array() + }; +} +export const RequestExtendVote = { + typeUrl: "/tendermint.abci.RequestExtendVote", + is(o: any): o is RequestExtendVote { + return o && (o.$typeUrl === RequestExtendVote.typeUrl || (o.hash instanceof Uint8Array || typeof o.hash === "string") && typeof o.height === "bigint" && Timestamp.is(o.time) && Array.isArray(o.txs) && (!o.txs.length || o.txs[0] instanceof Uint8Array || typeof o.txs[0] === "string") && CommitInfo.is(o.proposedLastCommit) && Array.isArray(o.misbehavior) && (!o.misbehavior.length || Misbehavior.is(o.misbehavior[0])) && (o.nextValidatorsHash instanceof Uint8Array || typeof o.nextValidatorsHash === "string") && (o.proposerAddress instanceof Uint8Array || typeof o.proposerAddress === "string")); + }, + isAmino(o: any): o is RequestExtendVoteAmino { + return o && (o.$typeUrl === RequestExtendVote.typeUrl || (o.hash instanceof Uint8Array || typeof o.hash === "string") && typeof o.height === "bigint" && Timestamp.isAmino(o.time) && Array.isArray(o.txs) && (!o.txs.length || o.txs[0] instanceof Uint8Array || typeof o.txs[0] === "string") && CommitInfo.isAmino(o.proposed_last_commit) && Array.isArray(o.misbehavior) && (!o.misbehavior.length || Misbehavior.isAmino(o.misbehavior[0])) && (o.next_validators_hash instanceof Uint8Array || typeof o.next_validators_hash === "string") && (o.proposer_address instanceof Uint8Array || typeof o.proposer_address === "string")); + }, + encode(message: RequestExtendVote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.hash.length !== 0) { + writer.uint32(10).bytes(message.hash); + } + if (message.height !== BigInt(0)) { + writer.uint32(16).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(26).fork()).ldelim(); + } + for (const v of message.txs) { + writer.uint32(34).bytes(v!); + } + if (message.proposedLastCommit !== undefined) { + CommitInfo.encode(message.proposedLastCommit, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.misbehavior) { + Misbehavior.encode(v!, writer.uint32(50).fork()).ldelim(); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(58).bytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(66).bytes(message.proposerAddress); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RequestExtendVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestExtendVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hash = reader.bytes(); + break; + case 2: + message.height = reader.int64(); + break; + case 3: + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 4: + message.txs.push(reader.bytes()); + break; + case 5: + message.proposedLastCommit = CommitInfo.decode(reader, reader.uint32()); + break; + case 6: + message.misbehavior.push(Misbehavior.decode(reader, reader.uint32())); + break; + case 7: + message.nextValidatorsHash = reader.bytes(); + break; + case 8: + message.proposerAddress = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): RequestExtendVote { + const message = createBaseRequestExtendVote(); + message.hash = object.hash ?? new Uint8Array(); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.time = object.time ?? undefined; + message.txs = object.txs?.map(e => e) || []; + message.proposedLastCommit = object.proposedLastCommit !== undefined && object.proposedLastCommit !== null ? CommitInfo.fromPartial(object.proposedLastCommit) : undefined; + message.misbehavior = object.misbehavior?.map(e => Misbehavior.fromPartial(e)) || []; + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(); + message.proposerAddress = object.proposerAddress ?? new Uint8Array(); + return message; + }, + fromAmino(object: RequestExtendVoteAmino): RequestExtendVote { + const message = createBaseRequestExtendVote(); + if (object.hash !== undefined && object.hash !== null) { + message.hash = bytesFromBase64(object.hash); + } + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.time !== undefined && object.time !== null) { + message.time = fromTimestamp(Timestamp.fromAmino(object.time)); + } + message.txs = object.txs?.map(e => bytesFromBase64(e)) || []; + if (object.proposed_last_commit !== undefined && object.proposed_last_commit !== null) { + message.proposedLastCommit = CommitInfo.fromAmino(object.proposed_last_commit); + } + message.misbehavior = object.misbehavior?.map(e => Misbehavior.fromAmino(e)) || []; + if (object.next_validators_hash !== undefined && object.next_validators_hash !== null) { + message.nextValidatorsHash = bytesFromBase64(object.next_validators_hash); + } + if (object.proposer_address !== undefined && object.proposer_address !== null) { + message.proposerAddress = bytesFromBase64(object.proposer_address); + } + return message; + }, + toAmino(message: RequestExtendVote): RequestExtendVoteAmino { + const obj: any = {}; + obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; + obj.height = message.height !== BigInt(0) ? message.height?.toString() : undefined; + obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; + if (message.txs) { + obj.txs = message.txs.map(e => base64FromBytes(e)); + } else { + obj.txs = message.txs; + } + obj.proposed_last_commit = message.proposedLastCommit ? CommitInfo.toAmino(message.proposedLastCommit) : undefined; + if (message.misbehavior) { + obj.misbehavior = message.misbehavior.map(e => e ? Misbehavior.toAmino(e) : undefined); + } else { + obj.misbehavior = message.misbehavior; + } + obj.next_validators_hash = message.nextValidatorsHash ? base64FromBytes(message.nextValidatorsHash) : undefined; + obj.proposer_address = message.proposerAddress ? base64FromBytes(message.proposerAddress) : undefined; + return obj; + }, + fromAminoMsg(object: RequestExtendVoteAminoMsg): RequestExtendVote { + return RequestExtendVote.fromAmino(object.value); + }, + fromProtoMsg(message: RequestExtendVoteProtoMsg): RequestExtendVote { + return RequestExtendVote.decode(message.value); + }, + toProto(message: RequestExtendVote): Uint8Array { + return RequestExtendVote.encode(message).finish(); + }, + toProtoMsg(message: RequestExtendVote): RequestExtendVoteProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestExtendVote", + value: RequestExtendVote.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(RequestExtendVote.typeUrl, RequestExtendVote); +function createBaseRequestVerifyVoteExtension(): RequestVerifyVoteExtension { + return { + hash: new Uint8Array(), + validatorAddress: new Uint8Array(), + height: BigInt(0), + voteExtension: new Uint8Array() + }; +} +export const RequestVerifyVoteExtension = { + typeUrl: "/tendermint.abci.RequestVerifyVoteExtension", + is(o: any): o is RequestVerifyVoteExtension { + return o && (o.$typeUrl === RequestVerifyVoteExtension.typeUrl || (o.hash instanceof Uint8Array || typeof o.hash === "string") && (o.validatorAddress instanceof Uint8Array || typeof o.validatorAddress === "string") && typeof o.height === "bigint" && (o.voteExtension instanceof Uint8Array || typeof o.voteExtension === "string")); + }, + isAmino(o: any): o is RequestVerifyVoteExtensionAmino { + return o && (o.$typeUrl === RequestVerifyVoteExtension.typeUrl || (o.hash instanceof Uint8Array || typeof o.hash === "string") && (o.validator_address instanceof Uint8Array || typeof o.validator_address === "string") && typeof o.height === "bigint" && (o.vote_extension instanceof Uint8Array || typeof o.vote_extension === "string")); + }, + encode(message: RequestVerifyVoteExtension, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.hash.length !== 0) { + writer.uint32(10).bytes(message.hash); + } + if (message.validatorAddress.length !== 0) { + writer.uint32(18).bytes(message.validatorAddress); + } + if (message.height !== BigInt(0)) { + writer.uint32(24).int64(message.height); + } + if (message.voteExtension.length !== 0) { + writer.uint32(34).bytes(message.voteExtension); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RequestVerifyVoteExtension { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestVerifyVoteExtension(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hash = reader.bytes(); + break; + case 2: + message.validatorAddress = reader.bytes(); + break; + case 3: + message.height = reader.int64(); + break; + case 4: + message.voteExtension = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): RequestVerifyVoteExtension { + const message = createBaseRequestVerifyVoteExtension(); + message.hash = object.hash ?? new Uint8Array(); + message.validatorAddress = object.validatorAddress ?? new Uint8Array(); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.voteExtension = object.voteExtension ?? new Uint8Array(); + return message; + }, + fromAmino(object: RequestVerifyVoteExtensionAmino): RequestVerifyVoteExtension { + const message = createBaseRequestVerifyVoteExtension(); + if (object.hash !== undefined && object.hash !== null) { + message.hash = bytesFromBase64(object.hash); + } + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = bytesFromBase64(object.validator_address); + } + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.vote_extension !== undefined && object.vote_extension !== null) { + message.voteExtension = bytesFromBase64(object.vote_extension); + } + return message; + }, + toAmino(message: RequestVerifyVoteExtension): RequestVerifyVoteExtensionAmino { + const obj: any = {}; + obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; + obj.validator_address = message.validatorAddress ? base64FromBytes(message.validatorAddress) : undefined; + obj.height = message.height !== BigInt(0) ? message.height?.toString() : undefined; + obj.vote_extension = message.voteExtension ? base64FromBytes(message.voteExtension) : undefined; + return obj; + }, + fromAminoMsg(object: RequestVerifyVoteExtensionAminoMsg): RequestVerifyVoteExtension { + return RequestVerifyVoteExtension.fromAmino(object.value); + }, + fromProtoMsg(message: RequestVerifyVoteExtensionProtoMsg): RequestVerifyVoteExtension { + return RequestVerifyVoteExtension.decode(message.value); + }, + toProto(message: RequestVerifyVoteExtension): Uint8Array { + return RequestVerifyVoteExtension.encode(message).finish(); + }, + toProtoMsg(message: RequestVerifyVoteExtension): RequestVerifyVoteExtensionProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestVerifyVoteExtension", + value: RequestVerifyVoteExtension.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(RequestVerifyVoteExtension.typeUrl, RequestVerifyVoteExtension); +function createBaseRequestFinalizeBlock(): RequestFinalizeBlock { + return { + txs: [], + decidedLastCommit: CommitInfo.fromPartial({}), + misbehavior: [], + hash: new Uint8Array(), + height: BigInt(0), + time: new Date(), + nextValidatorsHash: new Uint8Array(), + proposerAddress: new Uint8Array() + }; +} +export const RequestFinalizeBlock = { + typeUrl: "/tendermint.abci.RequestFinalizeBlock", + is(o: any): o is RequestFinalizeBlock { + return o && (o.$typeUrl === RequestFinalizeBlock.typeUrl || Array.isArray(o.txs) && (!o.txs.length || o.txs[0] instanceof Uint8Array || typeof o.txs[0] === "string") && CommitInfo.is(o.decidedLastCommit) && Array.isArray(o.misbehavior) && (!o.misbehavior.length || Misbehavior.is(o.misbehavior[0])) && (o.hash instanceof Uint8Array || typeof o.hash === "string") && typeof o.height === "bigint" && Timestamp.is(o.time) && (o.nextValidatorsHash instanceof Uint8Array || typeof o.nextValidatorsHash === "string") && (o.proposerAddress instanceof Uint8Array || typeof o.proposerAddress === "string")); + }, + isAmino(o: any): o is RequestFinalizeBlockAmino { + return o && (o.$typeUrl === RequestFinalizeBlock.typeUrl || Array.isArray(o.txs) && (!o.txs.length || o.txs[0] instanceof Uint8Array || typeof o.txs[0] === "string") && CommitInfo.isAmino(o.decided_last_commit) && Array.isArray(o.misbehavior) && (!o.misbehavior.length || Misbehavior.isAmino(o.misbehavior[0])) && (o.hash instanceof Uint8Array || typeof o.hash === "string") && typeof o.height === "bigint" && Timestamp.isAmino(o.time) && (o.next_validators_hash instanceof Uint8Array || typeof o.next_validators_hash === "string") && (o.proposer_address instanceof Uint8Array || typeof o.proposer_address === "string")); + }, + encode(message: RequestFinalizeBlock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.txs) { + writer.uint32(10).bytes(v!); + } + if (message.decidedLastCommit !== undefined) { + CommitInfo.encode(message.decidedLastCommit, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.misbehavior) { + Misbehavior.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.hash.length !== 0) { + writer.uint32(34).bytes(message.hash); + } + if (message.height !== BigInt(0)) { + writer.uint32(40).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(50).fork()).ldelim(); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(58).bytes(message.nextValidatorsHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(66).bytes(message.proposerAddress); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): RequestFinalizeBlock { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseRequestFinalizeBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.txs.push(reader.bytes()); + break; + case 2: + message.decidedLastCommit = CommitInfo.decode(reader, reader.uint32()); + break; + case 3: + message.misbehavior.push(Misbehavior.decode(reader, reader.uint32())); + break; + case 4: + message.hash = reader.bytes(); + break; + case 5: + message.height = reader.int64(); + break; + case 6: + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 7: + message.nextValidatorsHash = reader.bytes(); + break; + case 8: + message.proposerAddress = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): RequestFinalizeBlock { + const message = createBaseRequestFinalizeBlock(); + message.txs = object.txs?.map(e => e) || []; + message.decidedLastCommit = object.decidedLastCommit !== undefined && object.decidedLastCommit !== null ? CommitInfo.fromPartial(object.decidedLastCommit) : undefined; + message.misbehavior = object.misbehavior?.map(e => Misbehavior.fromPartial(e)) || []; + message.hash = object.hash ?? new Uint8Array(); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.time = object.time ?? undefined; + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(); + message.proposerAddress = object.proposerAddress ?? new Uint8Array(); + return message; + }, + fromAmino(object: RequestFinalizeBlockAmino): RequestFinalizeBlock { + const message = createBaseRequestFinalizeBlock(); + message.txs = object.txs?.map(e => bytesFromBase64(e)) || []; + if (object.decided_last_commit !== undefined && object.decided_last_commit !== null) { + message.decidedLastCommit = CommitInfo.fromAmino(object.decided_last_commit); + } + message.misbehavior = object.misbehavior?.map(e => Misbehavior.fromAmino(e)) || []; + if (object.hash !== undefined && object.hash !== null) { + message.hash = bytesFromBase64(object.hash); + } + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.time !== undefined && object.time !== null) { + message.time = fromTimestamp(Timestamp.fromAmino(object.time)); + } + if (object.next_validators_hash !== undefined && object.next_validators_hash !== null) { + message.nextValidatorsHash = bytesFromBase64(object.next_validators_hash); + } + if (object.proposer_address !== undefined && object.proposer_address !== null) { + message.proposerAddress = bytesFromBase64(object.proposer_address); + } + return message; + }, + toAmino(message: RequestFinalizeBlock): RequestFinalizeBlockAmino { + const obj: any = {}; + if (message.txs) { + obj.txs = message.txs.map(e => base64FromBytes(e)); + } else { + obj.txs = message.txs; + } + obj.decided_last_commit = message.decidedLastCommit ? CommitInfo.toAmino(message.decidedLastCommit) : undefined; + if (message.misbehavior) { + obj.misbehavior = message.misbehavior.map(e => e ? Misbehavior.toAmino(e) : undefined); + } else { + obj.misbehavior = message.misbehavior; + } + obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; + obj.height = message.height !== BigInt(0) ? message.height?.toString() : undefined; + obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; + obj.next_validators_hash = message.nextValidatorsHash ? base64FromBytes(message.nextValidatorsHash) : undefined; + obj.proposer_address = message.proposerAddress ? base64FromBytes(message.proposerAddress) : undefined; + return obj; + }, + fromAminoMsg(object: RequestFinalizeBlockAminoMsg): RequestFinalizeBlock { + return RequestFinalizeBlock.fromAmino(object.value); + }, + fromProtoMsg(message: RequestFinalizeBlockProtoMsg): RequestFinalizeBlock { + return RequestFinalizeBlock.decode(message.value); + }, + toProto(message: RequestFinalizeBlock): Uint8Array { + return RequestFinalizeBlock.encode(message).finish(); + }, + toProtoMsg(message: RequestFinalizeBlock): RequestFinalizeBlockProtoMsg { + return { + typeUrl: "/tendermint.abci.RequestFinalizeBlock", + value: RequestFinalizeBlock.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(RequestFinalizeBlock.typeUrl, RequestFinalizeBlock); +function createBaseResponse(): Response { + return { + exception: undefined, + echo: undefined, + flush: undefined, + info: undefined, + initChain: undefined, + query: undefined, + checkTx: undefined, + commit: undefined, + listSnapshots: undefined, + offerSnapshot: undefined, + loadSnapshotChunk: undefined, + applySnapshotChunk: undefined, + prepareProposal: undefined, + processProposal: undefined, + extendVote: undefined, + verifyVoteExtension: undefined, + finalizeBlock: undefined + }; +} +export const Response = { + typeUrl: "/tendermint.abci.Response", + is(o: any): o is Response { + return o && o.$typeUrl === Response.typeUrl; + }, + isAmino(o: any): o is ResponseAmino { + return o && o.$typeUrl === Response.typeUrl; + }, + encode(message: Response, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.exception !== undefined) { + ResponseException.encode(message.exception, writer.uint32(10).fork()).ldelim(); + } + if (message.echo !== undefined) { + ResponseEcho.encode(message.echo, writer.uint32(18).fork()).ldelim(); + } + if (message.flush !== undefined) { + ResponseFlush.encode(message.flush, writer.uint32(26).fork()).ldelim(); + } + if (message.info !== undefined) { + ResponseInfo.encode(message.info, writer.uint32(34).fork()).ldelim(); + } + if (message.initChain !== undefined) { + ResponseInitChain.encode(message.initChain, writer.uint32(50).fork()).ldelim(); + } + if (message.query !== undefined) { + ResponseQuery.encode(message.query, writer.uint32(58).fork()).ldelim(); + } + if (message.checkTx !== undefined) { + ResponseCheckTx.encode(message.checkTx, writer.uint32(74).fork()).ldelim(); + } + if (message.commit !== undefined) { + ResponseCommit.encode(message.commit, writer.uint32(98).fork()).ldelim(); + } + if (message.listSnapshots !== undefined) { + ResponseListSnapshots.encode(message.listSnapshots, writer.uint32(106).fork()).ldelim(); + } + if (message.offerSnapshot !== undefined) { + ResponseOfferSnapshot.encode(message.offerSnapshot, writer.uint32(114).fork()).ldelim(); + } + if (message.loadSnapshotChunk !== undefined) { + ResponseLoadSnapshotChunk.encode(message.loadSnapshotChunk, writer.uint32(122).fork()).ldelim(); + } + if (message.applySnapshotChunk !== undefined) { + ResponseApplySnapshotChunk.encode(message.applySnapshotChunk, writer.uint32(130).fork()).ldelim(); + } + if (message.prepareProposal !== undefined) { + ResponsePrepareProposal.encode(message.prepareProposal, writer.uint32(138).fork()).ldelim(); + } + if (message.processProposal !== undefined) { + ResponseProcessProposal.encode(message.processProposal, writer.uint32(146).fork()).ldelim(); + } + if (message.extendVote !== undefined) { + ResponseExtendVote.encode(message.extendVote, writer.uint32(154).fork()).ldelim(); + } + if (message.verifyVoteExtension !== undefined) { + ResponseVerifyVoteExtension.encode(message.verifyVoteExtension, writer.uint32(162).fork()).ldelim(); + } + if (message.finalizeBlock !== undefined) { + ResponseFinalizeBlock.encode(message.finalizeBlock, writer.uint32(170).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Response { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.exception = ResponseException.decode(reader, reader.uint32()); + break; + case 2: + message.echo = ResponseEcho.decode(reader, reader.uint32()); + break; + case 3: + message.flush = ResponseFlush.decode(reader, reader.uint32()); + break; + case 4: + message.info = ResponseInfo.decode(reader, reader.uint32()); + break; + case 6: + message.initChain = ResponseInitChain.decode(reader, reader.uint32()); + break; + case 7: + message.query = ResponseQuery.decode(reader, reader.uint32()); + break; + case 9: + message.checkTx = ResponseCheckTx.decode(reader, reader.uint32()); + break; + case 12: + message.commit = ResponseCommit.decode(reader, reader.uint32()); + break; + case 13: + message.listSnapshots = ResponseListSnapshots.decode(reader, reader.uint32()); + break; + case 14: + message.offerSnapshot = ResponseOfferSnapshot.decode(reader, reader.uint32()); + break; + case 15: + message.loadSnapshotChunk = ResponseLoadSnapshotChunk.decode(reader, reader.uint32()); + break; + case 16: + message.applySnapshotChunk = ResponseApplySnapshotChunk.decode(reader, reader.uint32()); + break; + case 17: + message.prepareProposal = ResponsePrepareProposal.decode(reader, reader.uint32()); + break; + case 18: + message.processProposal = ResponseProcessProposal.decode(reader, reader.uint32()); + break; + case 19: + message.extendVote = ResponseExtendVote.decode(reader, reader.uint32()); + break; + case 20: + message.verifyVoteExtension = ResponseVerifyVoteExtension.decode(reader, reader.uint32()); + break; + case 21: + message.finalizeBlock = ResponseFinalizeBlock.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Response { + const message = createBaseResponse(); + message.exception = object.exception !== undefined && object.exception !== null ? ResponseException.fromPartial(object.exception) : undefined; + message.echo = object.echo !== undefined && object.echo !== null ? ResponseEcho.fromPartial(object.echo) : undefined; + message.flush = object.flush !== undefined && object.flush !== null ? ResponseFlush.fromPartial(object.flush) : undefined; + message.info = object.info !== undefined && object.info !== null ? ResponseInfo.fromPartial(object.info) : undefined; + message.initChain = object.initChain !== undefined && object.initChain !== null ? ResponseInitChain.fromPartial(object.initChain) : undefined; + message.query = object.query !== undefined && object.query !== null ? ResponseQuery.fromPartial(object.query) : undefined; + message.checkTx = object.checkTx !== undefined && object.checkTx !== null ? ResponseCheckTx.fromPartial(object.checkTx) : undefined; + message.commit = object.commit !== undefined && object.commit !== null ? ResponseCommit.fromPartial(object.commit) : undefined; + message.listSnapshots = object.listSnapshots !== undefined && object.listSnapshots !== null ? ResponseListSnapshots.fromPartial(object.listSnapshots) : undefined; + message.offerSnapshot = object.offerSnapshot !== undefined && object.offerSnapshot !== null ? ResponseOfferSnapshot.fromPartial(object.offerSnapshot) : undefined; + message.loadSnapshotChunk = object.loadSnapshotChunk !== undefined && object.loadSnapshotChunk !== null ? ResponseLoadSnapshotChunk.fromPartial(object.loadSnapshotChunk) : undefined; + message.applySnapshotChunk = object.applySnapshotChunk !== undefined && object.applySnapshotChunk !== null ? ResponseApplySnapshotChunk.fromPartial(object.applySnapshotChunk) : undefined; + message.prepareProposal = object.prepareProposal !== undefined && object.prepareProposal !== null ? ResponsePrepareProposal.fromPartial(object.prepareProposal) : undefined; + message.processProposal = object.processProposal !== undefined && object.processProposal !== null ? ResponseProcessProposal.fromPartial(object.processProposal) : undefined; + message.extendVote = object.extendVote !== undefined && object.extendVote !== null ? ResponseExtendVote.fromPartial(object.extendVote) : undefined; + message.verifyVoteExtension = object.verifyVoteExtension !== undefined && object.verifyVoteExtension !== null ? ResponseVerifyVoteExtension.fromPartial(object.verifyVoteExtension) : undefined; + message.finalizeBlock = object.finalizeBlock !== undefined && object.finalizeBlock !== null ? ResponseFinalizeBlock.fromPartial(object.finalizeBlock) : undefined; + return message; + }, + fromAmino(object: ResponseAmino): Response { + const message = createBaseResponse(); + if (object.exception !== undefined && object.exception !== null) { + message.exception = ResponseException.fromAmino(object.exception); + } + if (object.echo !== undefined && object.echo !== null) { + message.echo = ResponseEcho.fromAmino(object.echo); + } + if (object.flush !== undefined && object.flush !== null) { + message.flush = ResponseFlush.fromAmino(object.flush); + } + if (object.info !== undefined && object.info !== null) { + message.info = ResponseInfo.fromAmino(object.info); + } + if (object.init_chain !== undefined && object.init_chain !== null) { + message.initChain = ResponseInitChain.fromAmino(object.init_chain); + } + if (object.query !== undefined && object.query !== null) { + message.query = ResponseQuery.fromAmino(object.query); + } + if (object.check_tx !== undefined && object.check_tx !== null) { + message.checkTx = ResponseCheckTx.fromAmino(object.check_tx); + } + if (object.commit !== undefined && object.commit !== null) { + message.commit = ResponseCommit.fromAmino(object.commit); + } + if (object.list_snapshots !== undefined && object.list_snapshots !== null) { + message.listSnapshots = ResponseListSnapshots.fromAmino(object.list_snapshots); + } + if (object.offer_snapshot !== undefined && object.offer_snapshot !== null) { + message.offerSnapshot = ResponseOfferSnapshot.fromAmino(object.offer_snapshot); + } + if (object.load_snapshot_chunk !== undefined && object.load_snapshot_chunk !== null) { + message.loadSnapshotChunk = ResponseLoadSnapshotChunk.fromAmino(object.load_snapshot_chunk); + } + if (object.apply_snapshot_chunk !== undefined && object.apply_snapshot_chunk !== null) { + message.applySnapshotChunk = ResponseApplySnapshotChunk.fromAmino(object.apply_snapshot_chunk); + } + if (object.prepare_proposal !== undefined && object.prepare_proposal !== null) { + message.prepareProposal = ResponsePrepareProposal.fromAmino(object.prepare_proposal); + } + if (object.process_proposal !== undefined && object.process_proposal !== null) { + message.processProposal = ResponseProcessProposal.fromAmino(object.process_proposal); + } + if (object.extend_vote !== undefined && object.extend_vote !== null) { + message.extendVote = ResponseExtendVote.fromAmino(object.extend_vote); + } + if (object.verify_vote_extension !== undefined && object.verify_vote_extension !== null) { + message.verifyVoteExtension = ResponseVerifyVoteExtension.fromAmino(object.verify_vote_extension); + } + if (object.finalize_block !== undefined && object.finalize_block !== null) { + message.finalizeBlock = ResponseFinalizeBlock.fromAmino(object.finalize_block); + } + return message; + }, + toAmino(message: Response): ResponseAmino { + const obj: any = {}; + obj.exception = message.exception ? ResponseException.toAmino(message.exception) : undefined; + obj.echo = message.echo ? ResponseEcho.toAmino(message.echo) : undefined; + obj.flush = message.flush ? ResponseFlush.toAmino(message.flush) : undefined; + obj.info = message.info ? ResponseInfo.toAmino(message.info) : undefined; + obj.init_chain = message.initChain ? ResponseInitChain.toAmino(message.initChain) : undefined; + obj.query = message.query ? ResponseQuery.toAmino(message.query) : undefined; + obj.check_tx = message.checkTx ? ResponseCheckTx.toAmino(message.checkTx) : undefined; + obj.commit = message.commit ? ResponseCommit.toAmino(message.commit) : undefined; + obj.list_snapshots = message.listSnapshots ? ResponseListSnapshots.toAmino(message.listSnapshots) : undefined; + obj.offer_snapshot = message.offerSnapshot ? ResponseOfferSnapshot.toAmino(message.offerSnapshot) : undefined; + obj.load_snapshot_chunk = message.loadSnapshotChunk ? ResponseLoadSnapshotChunk.toAmino(message.loadSnapshotChunk) : undefined; + obj.apply_snapshot_chunk = message.applySnapshotChunk ? ResponseApplySnapshotChunk.toAmino(message.applySnapshotChunk) : undefined; + obj.prepare_proposal = message.prepareProposal ? ResponsePrepareProposal.toAmino(message.prepareProposal) : undefined; + obj.process_proposal = message.processProposal ? ResponseProcessProposal.toAmino(message.processProposal) : undefined; + obj.extend_vote = message.extendVote ? ResponseExtendVote.toAmino(message.extendVote) : undefined; + obj.verify_vote_extension = message.verifyVoteExtension ? ResponseVerifyVoteExtension.toAmino(message.verifyVoteExtension) : undefined; + obj.finalize_block = message.finalizeBlock ? ResponseFinalizeBlock.toAmino(message.finalizeBlock) : undefined; + return obj; + }, + fromAminoMsg(object: ResponseAminoMsg): Response { + return Response.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseProtoMsg): Response { + return Response.decode(message.value); + }, + toProto(message: Response): Uint8Array { + return Response.encode(message).finish(); + }, + toProtoMsg(message: Response): ResponseProtoMsg { + return { + typeUrl: "/tendermint.abci.Response", + value: Response.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Response.typeUrl, Response); +function createBaseResponseException(): ResponseException { + return { + error: "" + }; +} +export const ResponseException = { + typeUrl: "/tendermint.abci.ResponseException", + is(o: any): o is ResponseException { + return o && (o.$typeUrl === ResponseException.typeUrl || typeof o.error === "string"); + }, + isAmino(o: any): o is ResponseExceptionAmino { + return o && (o.$typeUrl === ResponseException.typeUrl || typeof o.error === "string"); + }, + encode(message: ResponseException, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.error !== "") { + writer.uint32(10).string(message.error); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ResponseException { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseException(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.error = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ResponseException { + const message = createBaseResponseException(); + message.error = object.error ?? ""; + return message; + }, + fromAmino(object: ResponseExceptionAmino): ResponseException { + const message = createBaseResponseException(); + if (object.error !== undefined && object.error !== null) { + message.error = object.error; + } + return message; + }, + toAmino(message: ResponseException): ResponseExceptionAmino { + const obj: any = {}; + obj.error = message.error === "" ? undefined : message.error; + return obj; + }, + fromAminoMsg(object: ResponseExceptionAminoMsg): ResponseException { + return ResponseException.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseExceptionProtoMsg): ResponseException { + return ResponseException.decode(message.value); + }, + toProto(message: ResponseException): Uint8Array { + return ResponseException.encode(message).finish(); + }, + toProtoMsg(message: ResponseException): ResponseExceptionProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseException", + value: ResponseException.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ResponseException.typeUrl, ResponseException); +function createBaseResponseEcho(): ResponseEcho { + return { + message: "" + }; +} +export const ResponseEcho = { + typeUrl: "/tendermint.abci.ResponseEcho", + is(o: any): o is ResponseEcho { + return o && (o.$typeUrl === ResponseEcho.typeUrl || typeof o.message === "string"); + }, + isAmino(o: any): o is ResponseEchoAmino { + return o && (o.$typeUrl === ResponseEcho.typeUrl || typeof o.message === "string"); + }, + encode(message: ResponseEcho, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.message !== "") { + writer.uint32(10).string(message.message); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ResponseEcho { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseEcho(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.message = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ResponseEcho { + const message = createBaseResponseEcho(); + message.message = object.message ?? ""; + return message; + }, + fromAmino(object: ResponseEchoAmino): ResponseEcho { + const message = createBaseResponseEcho(); + if (object.message !== undefined && object.message !== null) { + message.message = object.message; + } + return message; + }, + toAmino(message: ResponseEcho): ResponseEchoAmino { + const obj: any = {}; + obj.message = message.message === "" ? undefined : message.message; + return obj; + }, + fromAminoMsg(object: ResponseEchoAminoMsg): ResponseEcho { + return ResponseEcho.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseEchoProtoMsg): ResponseEcho { + return ResponseEcho.decode(message.value); + }, + toProto(message: ResponseEcho): Uint8Array { + return ResponseEcho.encode(message).finish(); + }, + toProtoMsg(message: ResponseEcho): ResponseEchoProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseEcho", + value: ResponseEcho.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ResponseEcho.typeUrl, ResponseEcho); +function createBaseResponseFlush(): ResponseFlush { + return {}; +} +export const ResponseFlush = { + typeUrl: "/tendermint.abci.ResponseFlush", + is(o: any): o is ResponseFlush { + return o && o.$typeUrl === ResponseFlush.typeUrl; + }, + isAmino(o: any): o is ResponseFlushAmino { + return o && o.$typeUrl === ResponseFlush.typeUrl; + }, + encode(_: ResponseFlush, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ResponseFlush { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseFlush(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(_: DeepPartial): ResponseFlush { + const message = createBaseResponseFlush(); + return message; + }, + fromAmino(_: ResponseFlushAmino): ResponseFlush { + const message = createBaseResponseFlush(); + return message; + }, + toAmino(_: ResponseFlush): ResponseFlushAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: ResponseFlushAminoMsg): ResponseFlush { + return ResponseFlush.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseFlushProtoMsg): ResponseFlush { + return ResponseFlush.decode(message.value); + }, + toProto(message: ResponseFlush): Uint8Array { + return ResponseFlush.encode(message).finish(); + }, + toProtoMsg(message: ResponseFlush): ResponseFlushProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseFlush", + value: ResponseFlush.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ResponseFlush.typeUrl, ResponseFlush); +function createBaseResponseInfo(): ResponseInfo { + return { + data: "", + version: "", + appVersion: BigInt(0), + lastBlockHeight: BigInt(0), + lastBlockAppHash: new Uint8Array() + }; +} +export const ResponseInfo = { + typeUrl: "/tendermint.abci.ResponseInfo", + is(o: any): o is ResponseInfo { + return o && (o.$typeUrl === ResponseInfo.typeUrl || typeof o.data === "string" && typeof o.version === "string" && typeof o.appVersion === "bigint" && typeof o.lastBlockHeight === "bigint" && (o.lastBlockAppHash instanceof Uint8Array || typeof o.lastBlockAppHash === "string")); + }, + isAmino(o: any): o is ResponseInfoAmino { + return o && (o.$typeUrl === ResponseInfo.typeUrl || typeof o.data === "string" && typeof o.version === "string" && typeof o.app_version === "bigint" && typeof o.last_block_height === "bigint" && (o.last_block_app_hash instanceof Uint8Array || typeof o.last_block_app_hash === "string")); + }, + encode(message: ResponseInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.data !== "") { + writer.uint32(10).string(message.data); + } + if (message.version !== "") { + writer.uint32(18).string(message.version); + } + if (message.appVersion !== BigInt(0)) { + writer.uint32(24).uint64(message.appVersion); + } + if (message.lastBlockHeight !== BigInt(0)) { + writer.uint32(32).int64(message.lastBlockHeight); + } + if (message.lastBlockAppHash.length !== 0) { + writer.uint32(42).bytes(message.lastBlockAppHash); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ResponseInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.data = reader.string(); + break; + case 2: + message.version = reader.string(); + break; + case 3: + message.appVersion = reader.uint64(); + break; + case 4: + message.lastBlockHeight = reader.int64(); + break; + case 5: + message.lastBlockAppHash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ResponseInfo { + const message = createBaseResponseInfo(); + message.data = object.data ?? ""; + message.version = object.version ?? ""; + message.appVersion = object.appVersion !== undefined && object.appVersion !== null ? BigInt(object.appVersion.toString()) : BigInt(0); + message.lastBlockHeight = object.lastBlockHeight !== undefined && object.lastBlockHeight !== null ? BigInt(object.lastBlockHeight.toString()) : BigInt(0); + message.lastBlockAppHash = object.lastBlockAppHash ?? new Uint8Array(); + return message; + }, + fromAmino(object: ResponseInfoAmino): ResponseInfo { + const message = createBaseResponseInfo(); + if (object.data !== undefined && object.data !== null) { + message.data = object.data; + } + if (object.version !== undefined && object.version !== null) { + message.version = object.version; + } + if (object.app_version !== undefined && object.app_version !== null) { + message.appVersion = BigInt(object.app_version); + } + if (object.last_block_height !== undefined && object.last_block_height !== null) { + message.lastBlockHeight = BigInt(object.last_block_height); + } + if (object.last_block_app_hash !== undefined && object.last_block_app_hash !== null) { + message.lastBlockAppHash = bytesFromBase64(object.last_block_app_hash); + } + return message; + }, + toAmino(message: ResponseInfo): ResponseInfoAmino { + const obj: any = {}; + obj.data = message.data === "" ? undefined : message.data; + obj.version = message.version === "" ? undefined : message.version; + obj.app_version = message.appVersion !== BigInt(0) ? message.appVersion?.toString() : undefined; + obj.last_block_height = message.lastBlockHeight !== BigInt(0) ? message.lastBlockHeight?.toString() : undefined; + obj.last_block_app_hash = message.lastBlockAppHash ? base64FromBytes(message.lastBlockAppHash) : undefined; + return obj; + }, + fromAminoMsg(object: ResponseInfoAminoMsg): ResponseInfo { + return ResponseInfo.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseInfoProtoMsg): ResponseInfo { + return ResponseInfo.decode(message.value); + }, + toProto(message: ResponseInfo): Uint8Array { + return ResponseInfo.encode(message).finish(); + }, + toProtoMsg(message: ResponseInfo): ResponseInfoProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseInfo", + value: ResponseInfo.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ResponseInfo.typeUrl, ResponseInfo); +function createBaseResponseInitChain(): ResponseInitChain { + return { + consensusParams: undefined, + validators: [], + appHash: new Uint8Array() + }; +} +export const ResponseInitChain = { + typeUrl: "/tendermint.abci.ResponseInitChain", + is(o: any): o is ResponseInitChain { + return o && (o.$typeUrl === ResponseInitChain.typeUrl || Array.isArray(o.validators) && (!o.validators.length || ValidatorUpdate.is(o.validators[0])) && (o.appHash instanceof Uint8Array || typeof o.appHash === "string")); + }, + isAmino(o: any): o is ResponseInitChainAmino { + return o && (o.$typeUrl === ResponseInitChain.typeUrl || Array.isArray(o.validators) && (!o.validators.length || ValidatorUpdate.isAmino(o.validators[0])) && (o.app_hash instanceof Uint8Array || typeof o.app_hash === "string")); + }, + encode(message: ResponseInitChain, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.consensusParams !== undefined) { + ConsensusParams.encode(message.consensusParams, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.validators) { + ValidatorUpdate.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.appHash.length !== 0) { + writer.uint32(26).bytes(message.appHash); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ResponseInitChain { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseInitChain(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.consensusParams = ConsensusParams.decode(reader, reader.uint32()); + break; + case 2: + message.validators.push(ValidatorUpdate.decode(reader, reader.uint32())); + break; + case 3: + message.appHash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ResponseInitChain { + const message = createBaseResponseInitChain(); + message.consensusParams = object.consensusParams !== undefined && object.consensusParams !== null ? ConsensusParams.fromPartial(object.consensusParams) : undefined; + message.validators = object.validators?.map(e => ValidatorUpdate.fromPartial(e)) || []; + message.appHash = object.appHash ?? new Uint8Array(); + return message; + }, + fromAmino(object: ResponseInitChainAmino): ResponseInitChain { + const message = createBaseResponseInitChain(); + if (object.consensus_params !== undefined && object.consensus_params !== null) { + message.consensusParams = ConsensusParams.fromAmino(object.consensus_params); + } + message.validators = object.validators?.map(e => ValidatorUpdate.fromAmino(e)) || []; + if (object.app_hash !== undefined && object.app_hash !== null) { + message.appHash = bytesFromBase64(object.app_hash); + } + return message; + }, + toAmino(message: ResponseInitChain): ResponseInitChainAmino { + const obj: any = {}; + obj.consensus_params = message.consensusParams ? ConsensusParams.toAmino(message.consensusParams) : undefined; + if (message.validators) { + obj.validators = message.validators.map(e => e ? ValidatorUpdate.toAmino(e) : undefined); + } else { + obj.validators = message.validators; + } + obj.app_hash = message.appHash ? base64FromBytes(message.appHash) : undefined; + return obj; + }, + fromAminoMsg(object: ResponseInitChainAminoMsg): ResponseInitChain { + return ResponseInitChain.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseInitChainProtoMsg): ResponseInitChain { + return ResponseInitChain.decode(message.value); + }, + toProto(message: ResponseInitChain): Uint8Array { + return ResponseInitChain.encode(message).finish(); + }, + toProtoMsg(message: ResponseInitChain): ResponseInitChainProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseInitChain", + value: ResponseInitChain.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ResponseInitChain.typeUrl, ResponseInitChain); +function createBaseResponseQuery(): ResponseQuery { + return { + code: 0, + log: "", + info: "", + index: BigInt(0), + key: new Uint8Array(), + value: new Uint8Array(), + proofOps: undefined, + height: BigInt(0), + codespace: "" + }; +} +export const ResponseQuery = { + typeUrl: "/tendermint.abci.ResponseQuery", + is(o: any): o is ResponseQuery { + return o && (o.$typeUrl === ResponseQuery.typeUrl || typeof o.code === "number" && typeof o.log === "string" && typeof o.info === "string" && typeof o.index === "bigint" && (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string") && typeof o.height === "bigint" && typeof o.codespace === "string"); + }, + isAmino(o: any): o is ResponseQueryAmino { + return o && (o.$typeUrl === ResponseQuery.typeUrl || typeof o.code === "number" && typeof o.log === "string" && typeof o.info === "string" && typeof o.index === "bigint" && (o.key instanceof Uint8Array || typeof o.key === "string") && (o.value instanceof Uint8Array || typeof o.value === "string") && typeof o.height === "bigint" && typeof o.codespace === "string"); + }, + encode(message: ResponseQuery, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.code !== 0) { + writer.uint32(8).uint32(message.code); + } + if (message.log !== "") { + writer.uint32(26).string(message.log); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.index !== BigInt(0)) { + writer.uint32(40).int64(message.index); + } + if (message.key.length !== 0) { + writer.uint32(50).bytes(message.key); + } + if (message.value.length !== 0) { + writer.uint32(58).bytes(message.value); + } + if (message.proofOps !== undefined) { + ProofOps.encode(message.proofOps, writer.uint32(66).fork()).ldelim(); + } + if (message.height !== BigInt(0)) { + writer.uint32(72).int64(message.height); + } + if (message.codespace !== "") { + writer.uint32(82).string(message.codespace); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ResponseQuery { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseQuery(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.code = reader.uint32(); + break; + case 3: + message.log = reader.string(); + break; + case 4: + message.info = reader.string(); + break; + case 5: + message.index = reader.int64(); + break; + case 6: + message.key = reader.bytes(); + break; + case 7: + message.value = reader.bytes(); + break; + case 8: + message.proofOps = ProofOps.decode(reader, reader.uint32()); + break; + case 9: + message.height = reader.int64(); + break; + case 10: + message.codespace = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ResponseQuery { + const message = createBaseResponseQuery(); + message.code = object.code ?? 0; + message.log = object.log ?? ""; + message.info = object.info ?? ""; + message.index = object.index !== undefined && object.index !== null ? BigInt(object.index.toString()) : BigInt(0); + message.key = object.key ?? new Uint8Array(); + message.value = object.value ?? new Uint8Array(); + message.proofOps = object.proofOps !== undefined && object.proofOps !== null ? ProofOps.fromPartial(object.proofOps) : undefined; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.codespace = object.codespace ?? ""; + return message; + }, + fromAmino(object: ResponseQueryAmino): ResponseQuery { + const message = createBaseResponseQuery(); + if (object.code !== undefined && object.code !== null) { + message.code = object.code; + } + if (object.log !== undefined && object.log !== null) { + message.log = object.log; + } + if (object.info !== undefined && object.info !== null) { + message.info = object.info; + } + if (object.index !== undefined && object.index !== null) { + message.index = BigInt(object.index); + } + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + if (object.value !== undefined && object.value !== null) { + message.value = bytesFromBase64(object.value); + } + if (object.proof_ops !== undefined && object.proof_ops !== null) { + message.proofOps = ProofOps.fromAmino(object.proof_ops); + } + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.codespace !== undefined && object.codespace !== null) { + message.codespace = object.codespace; + } + return message; + }, + toAmino(message: ResponseQuery): ResponseQueryAmino { + const obj: any = {}; + obj.code = message.code === 0 ? undefined : message.code; + obj.log = message.log === "" ? undefined : message.log; + obj.info = message.info === "" ? undefined : message.info; + obj.index = message.index !== BigInt(0) ? message.index?.toString() : undefined; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + obj.value = message.value ? base64FromBytes(message.value) : undefined; + obj.proof_ops = message.proofOps ? ProofOps.toAmino(message.proofOps) : undefined; + obj.height = message.height !== BigInt(0) ? message.height?.toString() : undefined; + obj.codespace = message.codespace === "" ? undefined : message.codespace; + return obj; + }, + fromAminoMsg(object: ResponseQueryAminoMsg): ResponseQuery { + return ResponseQuery.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseQueryProtoMsg): ResponseQuery { + return ResponseQuery.decode(message.value); + }, + toProto(message: ResponseQuery): Uint8Array { + return ResponseQuery.encode(message).finish(); + }, + toProtoMsg(message: ResponseQuery): ResponseQueryProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseQuery", + value: ResponseQuery.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ResponseQuery.typeUrl, ResponseQuery); +function createBaseResponseCheckTx(): ResponseCheckTx { + return { + code: 0, + data: new Uint8Array(), + log: "", + info: "", + gasWanted: BigInt(0), + gasUsed: BigInt(0), + events: [], + codespace: "" + }; +} +export const ResponseCheckTx = { + typeUrl: "/tendermint.abci.ResponseCheckTx", + is(o: any): o is ResponseCheckTx { + return o && (o.$typeUrl === ResponseCheckTx.typeUrl || typeof o.code === "number" && (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.log === "string" && typeof o.info === "string" && typeof o.gasWanted === "bigint" && typeof o.gasUsed === "bigint" && Array.isArray(o.events) && (!o.events.length || Event.is(o.events[0])) && typeof o.codespace === "string"); + }, + isAmino(o: any): o is ResponseCheckTxAmino { + return o && (o.$typeUrl === ResponseCheckTx.typeUrl || typeof o.code === "number" && (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.log === "string" && typeof o.info === "string" && typeof o.gas_wanted === "bigint" && typeof o.gas_used === "bigint" && Array.isArray(o.events) && (!o.events.length || Event.isAmino(o.events[0])) && typeof o.codespace === "string"); + }, + encode(message: ResponseCheckTx, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.code !== 0) { + writer.uint32(8).uint32(message.code); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.log !== "") { + writer.uint32(26).string(message.log); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.gasWanted !== BigInt(0)) { + writer.uint32(40).int64(message.gasWanted); + } + if (message.gasUsed !== BigInt(0)) { + writer.uint32(48).int64(message.gasUsed); + } + for (const v of message.events) { + Event.encode(v!, writer.uint32(58).fork()).ldelim(); + } + if (message.codespace !== "") { + writer.uint32(66).string(message.codespace); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ResponseCheckTx { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseCheckTx(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.code = reader.uint32(); + break; + case 2: + message.data = reader.bytes(); + break; + case 3: + message.log = reader.string(); + break; + case 4: + message.info = reader.string(); + break; + case 5: + message.gasWanted = reader.int64(); + break; + case 6: + message.gasUsed = reader.int64(); + break; + case 7: + message.events.push(Event.decode(reader, reader.uint32())); + break; + case 8: + message.codespace = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ResponseCheckTx { + const message = createBaseResponseCheckTx(); + message.code = object.code ?? 0; + message.data = object.data ?? new Uint8Array(); + message.log = object.log ?? ""; + message.info = object.info ?? ""; + message.gasWanted = object.gasWanted !== undefined && object.gasWanted !== null ? BigInt(object.gasWanted.toString()) : BigInt(0); + message.gasUsed = object.gasUsed !== undefined && object.gasUsed !== null ? BigInt(object.gasUsed.toString()) : BigInt(0); + message.events = object.events?.map(e => Event.fromPartial(e)) || []; + message.codespace = object.codespace ?? ""; + return message; + }, + fromAmino(object: ResponseCheckTxAmino): ResponseCheckTx { + const message = createBaseResponseCheckTx(); + if (object.code !== undefined && object.code !== null) { + message.code = object.code; + } + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + if (object.log !== undefined && object.log !== null) { + message.log = object.log; + } + if (object.info !== undefined && object.info !== null) { + message.info = object.info; + } + if (object.gas_wanted !== undefined && object.gas_wanted !== null) { + message.gasWanted = BigInt(object.gas_wanted); + } + if (object.gas_used !== undefined && object.gas_used !== null) { + message.gasUsed = BigInt(object.gas_used); + } + message.events = object.events?.map(e => Event.fromAmino(e)) || []; + if (object.codespace !== undefined && object.codespace !== null) { + message.codespace = object.codespace; + } + return message; + }, + toAmino(message: ResponseCheckTx): ResponseCheckTxAmino { + const obj: any = {}; + obj.code = message.code === 0 ? undefined : message.code; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + obj.log = message.log === "" ? undefined : message.log; + obj.info = message.info === "" ? undefined : message.info; + obj.gas_wanted = message.gasWanted !== BigInt(0) ? message.gasWanted?.toString() : undefined; + obj.gas_used = message.gasUsed !== BigInt(0) ? message.gasUsed?.toString() : undefined; + if (message.events) { + obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); + } else { + obj.events = message.events; + } + obj.codespace = message.codespace === "" ? undefined : message.codespace; + return obj; + }, + fromAminoMsg(object: ResponseCheckTxAminoMsg): ResponseCheckTx { + return ResponseCheckTx.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseCheckTxProtoMsg): ResponseCheckTx { + return ResponseCheckTx.decode(message.value); + }, + toProto(message: ResponseCheckTx): Uint8Array { + return ResponseCheckTx.encode(message).finish(); + }, + toProtoMsg(message: ResponseCheckTx): ResponseCheckTxProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseCheckTx", + value: ResponseCheckTx.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ResponseCheckTx.typeUrl, ResponseCheckTx); +function createBaseResponseCommit(): ResponseCommit { + return { + retainHeight: BigInt(0) + }; +} +export const ResponseCommit = { + typeUrl: "/tendermint.abci.ResponseCommit", + is(o: any): o is ResponseCommit { + return o && (o.$typeUrl === ResponseCommit.typeUrl || typeof o.retainHeight === "bigint"); + }, + isAmino(o: any): o is ResponseCommitAmino { + return o && (o.$typeUrl === ResponseCommit.typeUrl || typeof o.retain_height === "bigint"); + }, + encode(message: ResponseCommit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.retainHeight !== BigInt(0)) { + writer.uint32(24).int64(message.retainHeight); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ResponseCommit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseCommit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 3: + message.retainHeight = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ResponseCommit { + const message = createBaseResponseCommit(); + message.retainHeight = object.retainHeight !== undefined && object.retainHeight !== null ? BigInt(object.retainHeight.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ResponseCommitAmino): ResponseCommit { + const message = createBaseResponseCommit(); + if (object.retain_height !== undefined && object.retain_height !== null) { + message.retainHeight = BigInt(object.retain_height); + } + return message; + }, + toAmino(message: ResponseCommit): ResponseCommitAmino { + const obj: any = {}; + obj.retain_height = message.retainHeight !== BigInt(0) ? message.retainHeight?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ResponseCommitAminoMsg): ResponseCommit { + return ResponseCommit.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseCommitProtoMsg): ResponseCommit { + return ResponseCommit.decode(message.value); + }, + toProto(message: ResponseCommit): Uint8Array { + return ResponseCommit.encode(message).finish(); + }, + toProtoMsg(message: ResponseCommit): ResponseCommitProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseCommit", + value: ResponseCommit.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ResponseCommit.typeUrl, ResponseCommit); +function createBaseResponseListSnapshots(): ResponseListSnapshots { + return { + snapshots: [] + }; +} +export const ResponseListSnapshots = { + typeUrl: "/tendermint.abci.ResponseListSnapshots", + is(o: any): o is ResponseListSnapshots { + return o && (o.$typeUrl === ResponseListSnapshots.typeUrl || Array.isArray(o.snapshots) && (!o.snapshots.length || Snapshot.is(o.snapshots[0]))); + }, + isAmino(o: any): o is ResponseListSnapshotsAmino { + return o && (o.$typeUrl === ResponseListSnapshots.typeUrl || Array.isArray(o.snapshots) && (!o.snapshots.length || Snapshot.isAmino(o.snapshots[0]))); + }, + encode(message: ResponseListSnapshots, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.snapshots) { + Snapshot.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ResponseListSnapshots { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseListSnapshots(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.snapshots.push(Snapshot.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ResponseListSnapshots { + const message = createBaseResponseListSnapshots(); + message.snapshots = object.snapshots?.map(e => Snapshot.fromPartial(e)) || []; + return message; + }, + fromAmino(object: ResponseListSnapshotsAmino): ResponseListSnapshots { + const message = createBaseResponseListSnapshots(); + message.snapshots = object.snapshots?.map(e => Snapshot.fromAmino(e)) || []; + return message; + }, + toAmino(message: ResponseListSnapshots): ResponseListSnapshotsAmino { + const obj: any = {}; + if (message.snapshots) { + obj.snapshots = message.snapshots.map(e => e ? Snapshot.toAmino(e) : undefined); + } else { + obj.snapshots = message.snapshots; + } + return obj; + }, + fromAminoMsg(object: ResponseListSnapshotsAminoMsg): ResponseListSnapshots { + return ResponseListSnapshots.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseListSnapshotsProtoMsg): ResponseListSnapshots { + return ResponseListSnapshots.decode(message.value); + }, + toProto(message: ResponseListSnapshots): Uint8Array { + return ResponseListSnapshots.encode(message).finish(); + }, + toProtoMsg(message: ResponseListSnapshots): ResponseListSnapshotsProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseListSnapshots", + value: ResponseListSnapshots.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ResponseListSnapshots.typeUrl, ResponseListSnapshots); +function createBaseResponseOfferSnapshot(): ResponseOfferSnapshot { + return { + result: 0 + }; +} +export const ResponseOfferSnapshot = { + typeUrl: "/tendermint.abci.ResponseOfferSnapshot", + is(o: any): o is ResponseOfferSnapshot { + return o && (o.$typeUrl === ResponseOfferSnapshot.typeUrl || isSet(o.result)); + }, + isAmino(o: any): o is ResponseOfferSnapshotAmino { + return o && (o.$typeUrl === ResponseOfferSnapshot.typeUrl || isSet(o.result)); + }, + encode(message: ResponseOfferSnapshot, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.result !== 0) { + writer.uint32(8).int32(message.result); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ResponseOfferSnapshot { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseOfferSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.result = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ResponseOfferSnapshot { + const message = createBaseResponseOfferSnapshot(); + message.result = object.result ?? 0; + return message; + }, + fromAmino(object: ResponseOfferSnapshotAmino): ResponseOfferSnapshot { + const message = createBaseResponseOfferSnapshot(); + if (object.result !== undefined && object.result !== null) { + message.result = object.result; + } + return message; + }, + toAmino(message: ResponseOfferSnapshot): ResponseOfferSnapshotAmino { + const obj: any = {}; + obj.result = message.result === 0 ? undefined : message.result; + return obj; + }, + fromAminoMsg(object: ResponseOfferSnapshotAminoMsg): ResponseOfferSnapshot { + return ResponseOfferSnapshot.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseOfferSnapshotProtoMsg): ResponseOfferSnapshot { + return ResponseOfferSnapshot.decode(message.value); + }, + toProto(message: ResponseOfferSnapshot): Uint8Array { + return ResponseOfferSnapshot.encode(message).finish(); + }, + toProtoMsg(message: ResponseOfferSnapshot): ResponseOfferSnapshotProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseOfferSnapshot", + value: ResponseOfferSnapshot.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ResponseOfferSnapshot.typeUrl, ResponseOfferSnapshot); +function createBaseResponseLoadSnapshotChunk(): ResponseLoadSnapshotChunk { + return { + chunk: new Uint8Array() + }; +} +export const ResponseLoadSnapshotChunk = { + typeUrl: "/tendermint.abci.ResponseLoadSnapshotChunk", + is(o: any): o is ResponseLoadSnapshotChunk { + return o && (o.$typeUrl === ResponseLoadSnapshotChunk.typeUrl || o.chunk instanceof Uint8Array || typeof o.chunk === "string"); + }, + isAmino(o: any): o is ResponseLoadSnapshotChunkAmino { + return o && (o.$typeUrl === ResponseLoadSnapshotChunk.typeUrl || o.chunk instanceof Uint8Array || typeof o.chunk === "string"); + }, + encode(message: ResponseLoadSnapshotChunk, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.chunk.length !== 0) { + writer.uint32(10).bytes(message.chunk); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ResponseLoadSnapshotChunk { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseLoadSnapshotChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.chunk = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ResponseLoadSnapshotChunk { + const message = createBaseResponseLoadSnapshotChunk(); + message.chunk = object.chunk ?? new Uint8Array(); + return message; + }, + fromAmino(object: ResponseLoadSnapshotChunkAmino): ResponseLoadSnapshotChunk { + const message = createBaseResponseLoadSnapshotChunk(); + if (object.chunk !== undefined && object.chunk !== null) { + message.chunk = bytesFromBase64(object.chunk); + } + return message; + }, + toAmino(message: ResponseLoadSnapshotChunk): ResponseLoadSnapshotChunkAmino { + const obj: any = {}; + obj.chunk = message.chunk ? base64FromBytes(message.chunk) : undefined; + return obj; + }, + fromAminoMsg(object: ResponseLoadSnapshotChunkAminoMsg): ResponseLoadSnapshotChunk { + return ResponseLoadSnapshotChunk.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseLoadSnapshotChunkProtoMsg): ResponseLoadSnapshotChunk { + return ResponseLoadSnapshotChunk.decode(message.value); + }, + toProto(message: ResponseLoadSnapshotChunk): Uint8Array { + return ResponseLoadSnapshotChunk.encode(message).finish(); + }, + toProtoMsg(message: ResponseLoadSnapshotChunk): ResponseLoadSnapshotChunkProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseLoadSnapshotChunk", + value: ResponseLoadSnapshotChunk.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ResponseLoadSnapshotChunk.typeUrl, ResponseLoadSnapshotChunk); +function createBaseResponseApplySnapshotChunk(): ResponseApplySnapshotChunk { + return { + result: 0, + refetchChunks: [], + rejectSenders: [] + }; +} +export const ResponseApplySnapshotChunk = { + typeUrl: "/tendermint.abci.ResponseApplySnapshotChunk", + is(o: any): o is ResponseApplySnapshotChunk { + return o && (o.$typeUrl === ResponseApplySnapshotChunk.typeUrl || isSet(o.result) && Array.isArray(o.refetchChunks) && (!o.refetchChunks.length || typeof o.refetchChunks[0] === "number") && Array.isArray(o.rejectSenders) && (!o.rejectSenders.length || typeof o.rejectSenders[0] === "string")); + }, + isAmino(o: any): o is ResponseApplySnapshotChunkAmino { + return o && (o.$typeUrl === ResponseApplySnapshotChunk.typeUrl || isSet(o.result) && Array.isArray(o.refetch_chunks) && (!o.refetch_chunks.length || typeof o.refetch_chunks[0] === "number") && Array.isArray(o.reject_senders) && (!o.reject_senders.length || typeof o.reject_senders[0] === "string")); + }, + encode(message: ResponseApplySnapshotChunk, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.result !== 0) { + writer.uint32(8).int32(message.result); + } + writer.uint32(18).fork(); + for (const v of message.refetchChunks) { + writer.uint32(v); + } + writer.ldelim(); + for (const v of message.rejectSenders) { + writer.uint32(26).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ResponseApplySnapshotChunk { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseApplySnapshotChunk(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.result = (reader.int32() as any); + break; + case 2: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.refetchChunks.push(reader.uint32()); + } + } else { + message.refetchChunks.push(reader.uint32()); + } + break; + case 3: + message.rejectSenders.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ResponseApplySnapshotChunk { + const message = createBaseResponseApplySnapshotChunk(); + message.result = object.result ?? 0; + message.refetchChunks = object.refetchChunks?.map(e => e) || []; + message.rejectSenders = object.rejectSenders?.map(e => e) || []; + return message; + }, + fromAmino(object: ResponseApplySnapshotChunkAmino): ResponseApplySnapshotChunk { + const message = createBaseResponseApplySnapshotChunk(); + if (object.result !== undefined && object.result !== null) { + message.result = object.result; + } + message.refetchChunks = object.refetch_chunks?.map(e => e) || []; + message.rejectSenders = object.reject_senders?.map(e => e) || []; + return message; + }, + toAmino(message: ResponseApplySnapshotChunk): ResponseApplySnapshotChunkAmino { + const obj: any = {}; + obj.result = message.result === 0 ? undefined : message.result; + if (message.refetchChunks) { + obj.refetch_chunks = message.refetchChunks.map(e => e); + } else { + obj.refetch_chunks = message.refetchChunks; + } + if (message.rejectSenders) { + obj.reject_senders = message.rejectSenders.map(e => e); + } else { + obj.reject_senders = message.rejectSenders; + } + return obj; + }, + fromAminoMsg(object: ResponseApplySnapshotChunkAminoMsg): ResponseApplySnapshotChunk { + return ResponseApplySnapshotChunk.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseApplySnapshotChunkProtoMsg): ResponseApplySnapshotChunk { + return ResponseApplySnapshotChunk.decode(message.value); + }, + toProto(message: ResponseApplySnapshotChunk): Uint8Array { + return ResponseApplySnapshotChunk.encode(message).finish(); + }, + toProtoMsg(message: ResponseApplySnapshotChunk): ResponseApplySnapshotChunkProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseApplySnapshotChunk", + value: ResponseApplySnapshotChunk.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ResponseApplySnapshotChunk.typeUrl, ResponseApplySnapshotChunk); +function createBaseResponsePrepareProposal(): ResponsePrepareProposal { + return { + txs: [] + }; +} +export const ResponsePrepareProposal = { + typeUrl: "/tendermint.abci.ResponsePrepareProposal", + is(o: any): o is ResponsePrepareProposal { + return o && (o.$typeUrl === ResponsePrepareProposal.typeUrl || Array.isArray(o.txs) && (!o.txs.length || o.txs[0] instanceof Uint8Array || typeof o.txs[0] === "string")); + }, + isAmino(o: any): o is ResponsePrepareProposalAmino { + return o && (o.$typeUrl === ResponsePrepareProposal.typeUrl || Array.isArray(o.txs) && (!o.txs.length || o.txs[0] instanceof Uint8Array || typeof o.txs[0] === "string")); + }, + encode(message: ResponsePrepareProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.txs) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ResponsePrepareProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponsePrepareProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.txs.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ResponsePrepareProposal { + const message = createBaseResponsePrepareProposal(); + message.txs = object.txs?.map(e => e) || []; + return message; + }, + fromAmino(object: ResponsePrepareProposalAmino): ResponsePrepareProposal { + const message = createBaseResponsePrepareProposal(); + message.txs = object.txs?.map(e => bytesFromBase64(e)) || []; + return message; + }, + toAmino(message: ResponsePrepareProposal): ResponsePrepareProposalAmino { + const obj: any = {}; + if (message.txs) { + obj.txs = message.txs.map(e => base64FromBytes(e)); + } else { + obj.txs = message.txs; + } + return obj; + }, + fromAminoMsg(object: ResponsePrepareProposalAminoMsg): ResponsePrepareProposal { + return ResponsePrepareProposal.fromAmino(object.value); + }, + fromProtoMsg(message: ResponsePrepareProposalProtoMsg): ResponsePrepareProposal { + return ResponsePrepareProposal.decode(message.value); + }, + toProto(message: ResponsePrepareProposal): Uint8Array { + return ResponsePrepareProposal.encode(message).finish(); + }, + toProtoMsg(message: ResponsePrepareProposal): ResponsePrepareProposalProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponsePrepareProposal", + value: ResponsePrepareProposal.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ResponsePrepareProposal.typeUrl, ResponsePrepareProposal); +function createBaseResponseProcessProposal(): ResponseProcessProposal { + return { + status: 0 + }; +} +export const ResponseProcessProposal = { + typeUrl: "/tendermint.abci.ResponseProcessProposal", + is(o: any): o is ResponseProcessProposal { + return o && (o.$typeUrl === ResponseProcessProposal.typeUrl || isSet(o.status)); + }, + isAmino(o: any): o is ResponseProcessProposalAmino { + return o && (o.$typeUrl === ResponseProcessProposal.typeUrl || isSet(o.status)); + }, + encode(message: ResponseProcessProposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.status !== 0) { + writer.uint32(8).int32(message.status); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ResponseProcessProposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseProcessProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.status = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ResponseProcessProposal { + const message = createBaseResponseProcessProposal(); + message.status = object.status ?? 0; + return message; + }, + fromAmino(object: ResponseProcessProposalAmino): ResponseProcessProposal { + const message = createBaseResponseProcessProposal(); + if (object.status !== undefined && object.status !== null) { + message.status = object.status; + } + return message; + }, + toAmino(message: ResponseProcessProposal): ResponseProcessProposalAmino { + const obj: any = {}; + obj.status = message.status === 0 ? undefined : message.status; + return obj; + }, + fromAminoMsg(object: ResponseProcessProposalAminoMsg): ResponseProcessProposal { + return ResponseProcessProposal.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseProcessProposalProtoMsg): ResponseProcessProposal { + return ResponseProcessProposal.decode(message.value); + }, + toProto(message: ResponseProcessProposal): Uint8Array { + return ResponseProcessProposal.encode(message).finish(); + }, + toProtoMsg(message: ResponseProcessProposal): ResponseProcessProposalProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseProcessProposal", + value: ResponseProcessProposal.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ResponseProcessProposal.typeUrl, ResponseProcessProposal); +function createBaseResponseExtendVote(): ResponseExtendVote { + return { + voteExtension: new Uint8Array() + }; +} +export const ResponseExtendVote = { + typeUrl: "/tendermint.abci.ResponseExtendVote", + is(o: any): o is ResponseExtendVote { + return o && (o.$typeUrl === ResponseExtendVote.typeUrl || o.voteExtension instanceof Uint8Array || typeof o.voteExtension === "string"); + }, + isAmino(o: any): o is ResponseExtendVoteAmino { + return o && (o.$typeUrl === ResponseExtendVote.typeUrl || o.vote_extension instanceof Uint8Array || typeof o.vote_extension === "string"); + }, + encode(message: ResponseExtendVote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.voteExtension.length !== 0) { + writer.uint32(10).bytes(message.voteExtension); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ResponseExtendVote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseExtendVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.voteExtension = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ResponseExtendVote { + const message = createBaseResponseExtendVote(); + message.voteExtension = object.voteExtension ?? new Uint8Array(); + return message; + }, + fromAmino(object: ResponseExtendVoteAmino): ResponseExtendVote { + const message = createBaseResponseExtendVote(); + if (object.vote_extension !== undefined && object.vote_extension !== null) { + message.voteExtension = bytesFromBase64(object.vote_extension); + } + return message; + }, + toAmino(message: ResponseExtendVote): ResponseExtendVoteAmino { + const obj: any = {}; + obj.vote_extension = message.voteExtension ? base64FromBytes(message.voteExtension) : undefined; + return obj; + }, + fromAminoMsg(object: ResponseExtendVoteAminoMsg): ResponseExtendVote { + return ResponseExtendVote.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseExtendVoteProtoMsg): ResponseExtendVote { + return ResponseExtendVote.decode(message.value); + }, + toProto(message: ResponseExtendVote): Uint8Array { + return ResponseExtendVote.encode(message).finish(); + }, + toProtoMsg(message: ResponseExtendVote): ResponseExtendVoteProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseExtendVote", + value: ResponseExtendVote.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ResponseExtendVote.typeUrl, ResponseExtendVote); +function createBaseResponseVerifyVoteExtension(): ResponseVerifyVoteExtension { + return { + status: 0 + }; +} +export const ResponseVerifyVoteExtension = { + typeUrl: "/tendermint.abci.ResponseVerifyVoteExtension", + is(o: any): o is ResponseVerifyVoteExtension { + return o && (o.$typeUrl === ResponseVerifyVoteExtension.typeUrl || isSet(o.status)); + }, + isAmino(o: any): o is ResponseVerifyVoteExtensionAmino { + return o && (o.$typeUrl === ResponseVerifyVoteExtension.typeUrl || isSet(o.status)); + }, + encode(message: ResponseVerifyVoteExtension, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.status !== 0) { + writer.uint32(8).int32(message.status); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ResponseVerifyVoteExtension { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseVerifyVoteExtension(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.status = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ResponseVerifyVoteExtension { + const message = createBaseResponseVerifyVoteExtension(); + message.status = object.status ?? 0; + return message; + }, + fromAmino(object: ResponseVerifyVoteExtensionAmino): ResponseVerifyVoteExtension { + const message = createBaseResponseVerifyVoteExtension(); + if (object.status !== undefined && object.status !== null) { + message.status = object.status; + } + return message; + }, + toAmino(message: ResponseVerifyVoteExtension): ResponseVerifyVoteExtensionAmino { + const obj: any = {}; + obj.status = message.status === 0 ? undefined : message.status; + return obj; + }, + fromAminoMsg(object: ResponseVerifyVoteExtensionAminoMsg): ResponseVerifyVoteExtension { + return ResponseVerifyVoteExtension.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseVerifyVoteExtensionProtoMsg): ResponseVerifyVoteExtension { + return ResponseVerifyVoteExtension.decode(message.value); + }, + toProto(message: ResponseVerifyVoteExtension): Uint8Array { + return ResponseVerifyVoteExtension.encode(message).finish(); + }, + toProtoMsg(message: ResponseVerifyVoteExtension): ResponseVerifyVoteExtensionProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseVerifyVoteExtension", + value: ResponseVerifyVoteExtension.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ResponseVerifyVoteExtension.typeUrl, ResponseVerifyVoteExtension); +function createBaseResponseFinalizeBlock(): ResponseFinalizeBlock { + return { + events: [], + txResults: [], + validatorUpdates: [], + consensusParamUpdates: undefined, + appHash: new Uint8Array() + }; +} +export const ResponseFinalizeBlock = { + typeUrl: "/tendermint.abci.ResponseFinalizeBlock", + is(o: any): o is ResponseFinalizeBlock { + return o && (o.$typeUrl === ResponseFinalizeBlock.typeUrl || Array.isArray(o.events) && (!o.events.length || Event.is(o.events[0])) && Array.isArray(o.txResults) && (!o.txResults.length || ExecTxResult.is(o.txResults[0])) && Array.isArray(o.validatorUpdates) && (!o.validatorUpdates.length || ValidatorUpdate.is(o.validatorUpdates[0])) && (o.appHash instanceof Uint8Array || typeof o.appHash === "string")); + }, + isAmino(o: any): o is ResponseFinalizeBlockAmino { + return o && (o.$typeUrl === ResponseFinalizeBlock.typeUrl || Array.isArray(o.events) && (!o.events.length || Event.isAmino(o.events[0])) && Array.isArray(o.tx_results) && (!o.tx_results.length || ExecTxResult.isAmino(o.tx_results[0])) && Array.isArray(o.validator_updates) && (!o.validator_updates.length || ValidatorUpdate.isAmino(o.validator_updates[0])) && (o.app_hash instanceof Uint8Array || typeof o.app_hash === "string")); + }, + encode(message: ResponseFinalizeBlock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.events) { + Event.encode(v!, writer.uint32(10).fork()).ldelim(); + } + for (const v of message.txResults) { + ExecTxResult.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.validatorUpdates) { + ValidatorUpdate.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.consensusParamUpdates !== undefined) { + ConsensusParams.encode(message.consensusParamUpdates, writer.uint32(34).fork()).ldelim(); + } + if (message.appHash.length !== 0) { + writer.uint32(42).bytes(message.appHash); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ResponseFinalizeBlock { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseResponseFinalizeBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.events.push(Event.decode(reader, reader.uint32())); + break; + case 2: + message.txResults.push(ExecTxResult.decode(reader, reader.uint32())); + break; + case 3: + message.validatorUpdates.push(ValidatorUpdate.decode(reader, reader.uint32())); + break; + case 4: + message.consensusParamUpdates = ConsensusParams.decode(reader, reader.uint32()); + break; + case 5: + message.appHash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ResponseFinalizeBlock { + const message = createBaseResponseFinalizeBlock(); + message.events = object.events?.map(e => Event.fromPartial(e)) || []; + message.txResults = object.txResults?.map(e => ExecTxResult.fromPartial(e)) || []; + message.validatorUpdates = object.validatorUpdates?.map(e => ValidatorUpdate.fromPartial(e)) || []; + message.consensusParamUpdates = object.consensusParamUpdates !== undefined && object.consensusParamUpdates !== null ? ConsensusParams.fromPartial(object.consensusParamUpdates) : undefined; + message.appHash = object.appHash ?? new Uint8Array(); + return message; + }, + fromAmino(object: ResponseFinalizeBlockAmino): ResponseFinalizeBlock { + const message = createBaseResponseFinalizeBlock(); + message.events = object.events?.map(e => Event.fromAmino(e)) || []; + message.txResults = object.tx_results?.map(e => ExecTxResult.fromAmino(e)) || []; + message.validatorUpdates = object.validator_updates?.map(e => ValidatorUpdate.fromAmino(e)) || []; + if (object.consensus_param_updates !== undefined && object.consensus_param_updates !== null) { + message.consensusParamUpdates = ConsensusParams.fromAmino(object.consensus_param_updates); + } + if (object.app_hash !== undefined && object.app_hash !== null) { + message.appHash = bytesFromBase64(object.app_hash); + } + return message; + }, + toAmino(message: ResponseFinalizeBlock): ResponseFinalizeBlockAmino { + const obj: any = {}; + if (message.events) { + obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); + } else { + obj.events = message.events; + } + if (message.txResults) { + obj.tx_results = message.txResults.map(e => e ? ExecTxResult.toAmino(e) : undefined); + } else { + obj.tx_results = message.txResults; + } + if (message.validatorUpdates) { + obj.validator_updates = message.validatorUpdates.map(e => e ? ValidatorUpdate.toAmino(e) : undefined); + } else { + obj.validator_updates = message.validatorUpdates; + } + obj.consensus_param_updates = message.consensusParamUpdates ? ConsensusParams.toAmino(message.consensusParamUpdates) : undefined; + obj.app_hash = message.appHash ? base64FromBytes(message.appHash) : undefined; + return obj; + }, + fromAminoMsg(object: ResponseFinalizeBlockAminoMsg): ResponseFinalizeBlock { + return ResponseFinalizeBlock.fromAmino(object.value); + }, + fromProtoMsg(message: ResponseFinalizeBlockProtoMsg): ResponseFinalizeBlock { + return ResponseFinalizeBlock.decode(message.value); + }, + toProto(message: ResponseFinalizeBlock): Uint8Array { + return ResponseFinalizeBlock.encode(message).finish(); + }, + toProtoMsg(message: ResponseFinalizeBlock): ResponseFinalizeBlockProtoMsg { + return { + typeUrl: "/tendermint.abci.ResponseFinalizeBlock", + value: ResponseFinalizeBlock.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ResponseFinalizeBlock.typeUrl, ResponseFinalizeBlock); +function createBaseCommitInfo(): CommitInfo { + return { + round: 0, + votes: [] + }; +} +export const CommitInfo = { + typeUrl: "/tendermint.abci.CommitInfo", + is(o: any): o is CommitInfo { + return o && (o.$typeUrl === CommitInfo.typeUrl || typeof o.round === "number" && Array.isArray(o.votes) && (!o.votes.length || VoteInfo.is(o.votes[0]))); + }, + isAmino(o: any): o is CommitInfoAmino { + return o && (o.$typeUrl === CommitInfo.typeUrl || typeof o.round === "number" && Array.isArray(o.votes) && (!o.votes.length || VoteInfo.isAmino(o.votes[0]))); + }, + encode(message: CommitInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.round !== 0) { + writer.uint32(8).int32(message.round); + } + for (const v of message.votes) { + VoteInfo.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): CommitInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.round = reader.int32(); + break; + case 2: + message.votes.push(VoteInfo.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): CommitInfo { + const message = createBaseCommitInfo(); + message.round = object.round ?? 0; + message.votes = object.votes?.map(e => VoteInfo.fromPartial(e)) || []; + return message; + }, + fromAmino(object: CommitInfoAmino): CommitInfo { + const message = createBaseCommitInfo(); + if (object.round !== undefined && object.round !== null) { + message.round = object.round; + } + message.votes = object.votes?.map(e => VoteInfo.fromAmino(e)) || []; + return message; + }, + toAmino(message: CommitInfo): CommitInfoAmino { + const obj: any = {}; + obj.round = message.round === 0 ? undefined : message.round; + if (message.votes) { + obj.votes = message.votes.map(e => e ? VoteInfo.toAmino(e) : undefined); + } else { + obj.votes = message.votes; + } + return obj; + }, + fromAminoMsg(object: CommitInfoAminoMsg): CommitInfo { + return CommitInfo.fromAmino(object.value); + }, + fromProtoMsg(message: CommitInfoProtoMsg): CommitInfo { + return CommitInfo.decode(message.value); + }, + toProto(message: CommitInfo): Uint8Array { + return CommitInfo.encode(message).finish(); + }, + toProtoMsg(message: CommitInfo): CommitInfoProtoMsg { + return { + typeUrl: "/tendermint.abci.CommitInfo", + value: CommitInfo.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(CommitInfo.typeUrl, CommitInfo); +function createBaseExtendedCommitInfo(): ExtendedCommitInfo { + return { + round: 0, + votes: [] + }; +} +export const ExtendedCommitInfo = { + typeUrl: "/tendermint.abci.ExtendedCommitInfo", + is(o: any): o is ExtendedCommitInfo { + return o && (o.$typeUrl === ExtendedCommitInfo.typeUrl || typeof o.round === "number" && Array.isArray(o.votes) && (!o.votes.length || ExtendedVoteInfo.is(o.votes[0]))); + }, + isAmino(o: any): o is ExtendedCommitInfoAmino { + return o && (o.$typeUrl === ExtendedCommitInfo.typeUrl || typeof o.round === "number" && Array.isArray(o.votes) && (!o.votes.length || ExtendedVoteInfo.isAmino(o.votes[0]))); + }, + encode(message: ExtendedCommitInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.round !== 0) { + writer.uint32(8).int32(message.round); + } + for (const v of message.votes) { + ExtendedVoteInfo.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ExtendedCommitInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtendedCommitInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.round = reader.int32(); + break; + case 2: + message.votes.push(ExtendedVoteInfo.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ExtendedCommitInfo { + const message = createBaseExtendedCommitInfo(); + message.round = object.round ?? 0; + message.votes = object.votes?.map(e => ExtendedVoteInfo.fromPartial(e)) || []; + return message; + }, + fromAmino(object: ExtendedCommitInfoAmino): ExtendedCommitInfo { + const message = createBaseExtendedCommitInfo(); + if (object.round !== undefined && object.round !== null) { + message.round = object.round; + } + message.votes = object.votes?.map(e => ExtendedVoteInfo.fromAmino(e)) || []; + return message; + }, + toAmino(message: ExtendedCommitInfo): ExtendedCommitInfoAmino { + const obj: any = {}; + obj.round = message.round === 0 ? undefined : message.round; + if (message.votes) { + obj.votes = message.votes.map(e => e ? ExtendedVoteInfo.toAmino(e) : undefined); + } else { + obj.votes = message.votes; + } + return obj; + }, + fromAminoMsg(object: ExtendedCommitInfoAminoMsg): ExtendedCommitInfo { + return ExtendedCommitInfo.fromAmino(object.value); + }, + fromProtoMsg(message: ExtendedCommitInfoProtoMsg): ExtendedCommitInfo { + return ExtendedCommitInfo.decode(message.value); + }, + toProto(message: ExtendedCommitInfo): Uint8Array { + return ExtendedCommitInfo.encode(message).finish(); + }, + toProtoMsg(message: ExtendedCommitInfo): ExtendedCommitInfoProtoMsg { + return { + typeUrl: "/tendermint.abci.ExtendedCommitInfo", + value: ExtendedCommitInfo.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ExtendedCommitInfo.typeUrl, ExtendedCommitInfo); +function createBaseEvent(): Event { + return { + type: "", + attributes: [] + }; +} +export const Event = { + typeUrl: "/tendermint.abci.Event", + is(o: any): o is Event { + return o && (o.$typeUrl === Event.typeUrl || typeof o.type === "string" && Array.isArray(o.attributes) && (!o.attributes.length || EventAttribute.is(o.attributes[0]))); + }, + isAmino(o: any): o is EventAmino { + return o && (o.$typeUrl === Event.typeUrl || typeof o.type === "string" && Array.isArray(o.attributes) && (!o.attributes.length || EventAttribute.isAmino(o.attributes[0]))); + }, + encode(message: Event, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.type !== "") { + writer.uint32(10).string(message.type); + } + for (const v of message.attributes) { + EventAttribute.encode(v!, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Event { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvent(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = reader.string(); + break; + case 2: + message.attributes.push(EventAttribute.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Event { + const message = createBaseEvent(); + message.type = object.type ?? ""; + message.attributes = object.attributes?.map(e => EventAttribute.fromPartial(e)) || []; + return message; + }, + fromAmino(object: EventAmino): Event { + const message = createBaseEvent(); + if (object.type !== undefined && object.type !== null) { + message.type = object.type; + } + message.attributes = object.attributes?.map(e => EventAttribute.fromAmino(e)) || []; + return message; + }, + toAmino(message: Event): EventAmino { + const obj: any = {}; + obj.type = message.type === "" ? undefined : message.type; + if (message.attributes) { + obj.attributes = message.attributes.map(e => e ? EventAttribute.toAmino(e) : undefined); + } else { + obj.attributes = message.attributes; + } + return obj; + }, + fromAminoMsg(object: EventAminoMsg): Event { + return Event.fromAmino(object.value); + }, + fromProtoMsg(message: EventProtoMsg): Event { + return Event.decode(message.value); + }, + toProto(message: Event): Uint8Array { + return Event.encode(message).finish(); + }, + toProtoMsg(message: Event): EventProtoMsg { + return { + typeUrl: "/tendermint.abci.Event", + value: Event.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Event.typeUrl, Event); +function createBaseEventAttribute(): EventAttribute { + return { + key: "", + value: "", + index: false + }; +} +export const EventAttribute = { + typeUrl: "/tendermint.abci.EventAttribute", + is(o: any): o is EventAttribute { + return o && (o.$typeUrl === EventAttribute.typeUrl || typeof o.key === "string" && typeof o.value === "string" && typeof o.index === "boolean"); + }, + isAmino(o: any): o is EventAttributeAmino { + return o && (o.$typeUrl === EventAttribute.typeUrl || typeof o.key === "string" && typeof o.value === "string" && typeof o.index === "boolean"); + }, + encode(message: EventAttribute, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== "") { + writer.uint32(18).string(message.value); + } + if (message.index === true) { + writer.uint32(24).bool(message.index); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EventAttribute { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEventAttribute(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.string(); + break; + case 2: + message.value = reader.string(); + break; + case 3: + message.index = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): EventAttribute { + const message = createBaseEventAttribute(); + message.key = object.key ?? ""; + message.value = object.value ?? ""; + message.index = object.index ?? false; + return message; + }, + fromAmino(object: EventAttributeAmino): EventAttribute { + const message = createBaseEventAttribute(); + if (object.key !== undefined && object.key !== null) { + message.key = object.key; + } + if (object.value !== undefined && object.value !== null) { + message.value = object.value; + } + if (object.index !== undefined && object.index !== null) { + message.index = object.index; + } + return message; + }, + toAmino(message: EventAttribute): EventAttributeAmino { + const obj: any = {}; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; + obj.index = message.index === false ? undefined : message.index; + return obj; + }, + fromAminoMsg(object: EventAttributeAminoMsg): EventAttribute { + return EventAttribute.fromAmino(object.value); + }, + fromProtoMsg(message: EventAttributeProtoMsg): EventAttribute { + return EventAttribute.decode(message.value); + }, + toProto(message: EventAttribute): Uint8Array { + return EventAttribute.encode(message).finish(); + }, + toProtoMsg(message: EventAttribute): EventAttributeProtoMsg { + return { + typeUrl: "/tendermint.abci.EventAttribute", + value: EventAttribute.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(EventAttribute.typeUrl, EventAttribute); +function createBaseExecTxResult(): ExecTxResult { + return { + code: 0, + data: new Uint8Array(), + log: "", + info: "", + gasWanted: BigInt(0), + gasUsed: BigInt(0), + events: [], + codespace: "" + }; +} +export const ExecTxResult = { + typeUrl: "/tendermint.abci.ExecTxResult", + is(o: any): o is ExecTxResult { + return o && (o.$typeUrl === ExecTxResult.typeUrl || typeof o.code === "number" && (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.log === "string" && typeof o.info === "string" && typeof o.gasWanted === "bigint" && typeof o.gasUsed === "bigint" && Array.isArray(o.events) && (!o.events.length || Event.is(o.events[0])) && typeof o.codespace === "string"); + }, + isAmino(o: any): o is ExecTxResultAmino { + return o && (o.$typeUrl === ExecTxResult.typeUrl || typeof o.code === "number" && (o.data instanceof Uint8Array || typeof o.data === "string") && typeof o.log === "string" && typeof o.info === "string" && typeof o.gas_wanted === "bigint" && typeof o.gas_used === "bigint" && Array.isArray(o.events) && (!o.events.length || Event.isAmino(o.events[0])) && typeof o.codespace === "string"); + }, + encode(message: ExecTxResult, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.code !== 0) { + writer.uint32(8).uint32(message.code); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.log !== "") { + writer.uint32(26).string(message.log); + } + if (message.info !== "") { + writer.uint32(34).string(message.info); + } + if (message.gasWanted !== BigInt(0)) { + writer.uint32(40).int64(message.gasWanted); + } + if (message.gasUsed !== BigInt(0)) { + writer.uint32(48).int64(message.gasUsed); + } + for (const v of message.events) { + Event.encode(v!, writer.uint32(58).fork()).ldelim(); + } + if (message.codespace !== "") { + writer.uint32(66).string(message.codespace); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ExecTxResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExecTxResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.code = reader.uint32(); + break; + case 2: + message.data = reader.bytes(); + break; + case 3: + message.log = reader.string(); + break; + case 4: + message.info = reader.string(); + break; + case 5: + message.gasWanted = reader.int64(); + break; + case 6: + message.gasUsed = reader.int64(); + break; + case 7: + message.events.push(Event.decode(reader, reader.uint32())); + break; + case 8: + message.codespace = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ExecTxResult { + const message = createBaseExecTxResult(); + message.code = object.code ?? 0; + message.data = object.data ?? new Uint8Array(); + message.log = object.log ?? ""; + message.info = object.info ?? ""; + message.gasWanted = object.gasWanted !== undefined && object.gasWanted !== null ? BigInt(object.gasWanted.toString()) : BigInt(0); + message.gasUsed = object.gasUsed !== undefined && object.gasUsed !== null ? BigInt(object.gasUsed.toString()) : BigInt(0); + message.events = object.events?.map(e => Event.fromPartial(e)) || []; + message.codespace = object.codespace ?? ""; + return message; + }, + fromAmino(object: ExecTxResultAmino): ExecTxResult { + const message = createBaseExecTxResult(); + if (object.code !== undefined && object.code !== null) { + message.code = object.code; + } + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + if (object.log !== undefined && object.log !== null) { + message.log = object.log; + } + if (object.info !== undefined && object.info !== null) { + message.info = object.info; + } + if (object.gas_wanted !== undefined && object.gas_wanted !== null) { + message.gasWanted = BigInt(object.gas_wanted); + } + if (object.gas_used !== undefined && object.gas_used !== null) { + message.gasUsed = BigInt(object.gas_used); + } + message.events = object.events?.map(e => Event.fromAmino(e)) || []; + if (object.codespace !== undefined && object.codespace !== null) { + message.codespace = object.codespace; + } + return message; + }, + toAmino(message: ExecTxResult): ExecTxResultAmino { + const obj: any = {}; + obj.code = message.code === 0 ? undefined : message.code; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + obj.log = message.log === "" ? undefined : message.log; + obj.info = message.info === "" ? undefined : message.info; + obj.gas_wanted = message.gasWanted !== BigInt(0) ? message.gasWanted?.toString() : undefined; + obj.gas_used = message.gasUsed !== BigInt(0) ? message.gasUsed?.toString() : undefined; + if (message.events) { + obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); + } else { + obj.events = message.events; + } + obj.codespace = message.codespace === "" ? undefined : message.codespace; + return obj; + }, + fromAminoMsg(object: ExecTxResultAminoMsg): ExecTxResult { + return ExecTxResult.fromAmino(object.value); + }, + fromProtoMsg(message: ExecTxResultProtoMsg): ExecTxResult { + return ExecTxResult.decode(message.value); + }, + toProto(message: ExecTxResult): Uint8Array { + return ExecTxResult.encode(message).finish(); + }, + toProtoMsg(message: ExecTxResult): ExecTxResultProtoMsg { + return { + typeUrl: "/tendermint.abci.ExecTxResult", + value: ExecTxResult.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ExecTxResult.typeUrl, ExecTxResult); +function createBaseTxResult(): TxResult { + return { + height: BigInt(0), + index: 0, + tx: new Uint8Array(), + result: ExecTxResult.fromPartial({}) + }; +} +export const TxResult = { + typeUrl: "/tendermint.abci.TxResult", + is(o: any): o is TxResult { + return o && (o.$typeUrl === TxResult.typeUrl || typeof o.height === "bigint" && typeof o.index === "number" && (o.tx instanceof Uint8Array || typeof o.tx === "string") && ExecTxResult.is(o.result)); + }, + isAmino(o: any): o is TxResultAmino { + return o && (o.$typeUrl === TxResult.typeUrl || typeof o.height === "bigint" && typeof o.index === "number" && (o.tx instanceof Uint8Array || typeof o.tx === "string") && ExecTxResult.isAmino(o.result)); + }, + encode(message: TxResult, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { + writer.uint32(8).int64(message.height); + } + if (message.index !== 0) { + writer.uint32(16).uint32(message.index); + } + if (message.tx.length !== 0) { + writer.uint32(26).bytes(message.tx); + } + if (message.result !== undefined) { + ExecTxResult.encode(message.result, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TxResult { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxResult(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.int64(); + break; + case 2: + message.index = reader.uint32(); + break; + case 3: + message.tx = reader.bytes(); + break; + case 4: + message.result = ExecTxResult.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): TxResult { + const message = createBaseTxResult(); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.index = object.index ?? 0; + message.tx = object.tx ?? new Uint8Array(); + message.result = object.result !== undefined && object.result !== null ? ExecTxResult.fromPartial(object.result) : undefined; + return message; + }, + fromAmino(object: TxResultAmino): TxResult { + const message = createBaseTxResult(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.index !== undefined && object.index !== null) { + message.index = object.index; + } + if (object.tx !== undefined && object.tx !== null) { + message.tx = bytesFromBase64(object.tx); + } + if (object.result !== undefined && object.result !== null) { + message.result = ExecTxResult.fromAmino(object.result); + } + return message; + }, + toAmino(message: TxResult): TxResultAmino { + const obj: any = {}; + obj.height = message.height !== BigInt(0) ? message.height?.toString() : undefined; + obj.index = message.index === 0 ? undefined : message.index; + obj.tx = message.tx ? base64FromBytes(message.tx) : undefined; + obj.result = message.result ? ExecTxResult.toAmino(message.result) : undefined; + return obj; + }, + fromAminoMsg(object: TxResultAminoMsg): TxResult { + return TxResult.fromAmino(object.value); + }, + fromProtoMsg(message: TxResultProtoMsg): TxResult { + return TxResult.decode(message.value); + }, + toProto(message: TxResult): Uint8Array { + return TxResult.encode(message).finish(); + }, + toProtoMsg(message: TxResult): TxResultProtoMsg { + return { + typeUrl: "/tendermint.abci.TxResult", + value: TxResult.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(TxResult.typeUrl, TxResult); +function createBaseValidator(): Validator { + return { + address: new Uint8Array(), + power: BigInt(0) + }; +} +export const Validator = { + typeUrl: "/tendermint.abci.Validator", + is(o: any): o is Validator { + return o && (o.$typeUrl === Validator.typeUrl || (o.address instanceof Uint8Array || typeof o.address === "string") && typeof o.power === "bigint"); + }, + isAmino(o: any): o is ValidatorAmino { + return o && (o.$typeUrl === Validator.typeUrl || (o.address instanceof Uint8Array || typeof o.address === "string") && typeof o.power === "bigint"); + }, + encode(message: Validator, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address.length !== 0) { + writer.uint32(10).bytes(message.address); + } + if (message.power !== BigInt(0)) { + writer.uint32(24).int64(message.power); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Validator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.bytes(); + break; + case 3: + message.power = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Validator { + const message = createBaseValidator(); + message.address = object.address ?? new Uint8Array(); + message.power = object.power !== undefined && object.power !== null ? BigInt(object.power.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ValidatorAmino): Validator { + const message = createBaseValidator(); + if (object.address !== undefined && object.address !== null) { + message.address = bytesFromBase64(object.address); + } + if (object.power !== undefined && object.power !== null) { + message.power = BigInt(object.power); + } + return message; + }, + toAmino(message: Validator): ValidatorAmino { + const obj: any = {}; + obj.address = message.address ? base64FromBytes(message.address) : undefined; + obj.power = message.power !== BigInt(0) ? message.power?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ValidatorAminoMsg): Validator { + return Validator.fromAmino(object.value); + }, + fromProtoMsg(message: ValidatorProtoMsg): Validator { + return Validator.decode(message.value); + }, + toProto(message: Validator): Uint8Array { + return Validator.encode(message).finish(); + }, + toProtoMsg(message: Validator): ValidatorProtoMsg { + return { + typeUrl: "/tendermint.abci.Validator", + value: Validator.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Validator.typeUrl, Validator); +function createBaseValidatorUpdate(): ValidatorUpdate { + return { + pubKey: PublicKey.fromPartial({}), + power: BigInt(0) + }; +} +export const ValidatorUpdate = { + typeUrl: "/tendermint.abci.ValidatorUpdate", + is(o: any): o is ValidatorUpdate { + return o && (o.$typeUrl === ValidatorUpdate.typeUrl || PublicKey.is(o.pubKey) && typeof o.power === "bigint"); + }, + isAmino(o: any): o is ValidatorUpdateAmino { + return o && (o.$typeUrl === ValidatorUpdate.typeUrl || PublicKey.isAmino(o.pub_key) && typeof o.power === "bigint"); + }, + encode(message: ValidatorUpdate, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.pubKey !== undefined) { + PublicKey.encode(message.pubKey, writer.uint32(10).fork()).ldelim(); + } + if (message.power !== BigInt(0)) { + writer.uint32(16).int64(message.power); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorUpdate { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorUpdate(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pubKey = PublicKey.decode(reader, reader.uint32()); + break; + case 2: + message.power = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ValidatorUpdate { + const message = createBaseValidatorUpdate(); + message.pubKey = object.pubKey !== undefined && object.pubKey !== null ? PublicKey.fromPartial(object.pubKey) : undefined; + message.power = object.power !== undefined && object.power !== null ? BigInt(object.power.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ValidatorUpdateAmino): ValidatorUpdate { + const message = createBaseValidatorUpdate(); + if (object.pub_key !== undefined && object.pub_key !== null) { + message.pubKey = PublicKey.fromAmino(object.pub_key); + } + if (object.power !== undefined && object.power !== null) { + message.power = BigInt(object.power); + } + return message; + }, + toAmino(message: ValidatorUpdate): ValidatorUpdateAmino { + const obj: any = {}; + obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey) : undefined; + obj.power = message.power !== BigInt(0) ? message.power?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ValidatorUpdateAminoMsg): ValidatorUpdate { + return ValidatorUpdate.fromAmino(object.value); + }, + fromProtoMsg(message: ValidatorUpdateProtoMsg): ValidatorUpdate { + return ValidatorUpdate.decode(message.value); + }, + toProto(message: ValidatorUpdate): Uint8Array { + return ValidatorUpdate.encode(message).finish(); + }, + toProtoMsg(message: ValidatorUpdate): ValidatorUpdateProtoMsg { + return { + typeUrl: "/tendermint.abci.ValidatorUpdate", + value: ValidatorUpdate.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ValidatorUpdate.typeUrl, ValidatorUpdate); +function createBaseVoteInfo(): VoteInfo { + return { + validator: Validator.fromPartial({}), + blockIdFlag: 0 + }; +} +export const VoteInfo = { + typeUrl: "/tendermint.abci.VoteInfo", + is(o: any): o is VoteInfo { + return o && (o.$typeUrl === VoteInfo.typeUrl || Validator.is(o.validator) && isSet(o.blockIdFlag)); + }, + isAmino(o: any): o is VoteInfoAmino { + return o && (o.$typeUrl === VoteInfo.typeUrl || Validator.isAmino(o.validator) && isSet(o.block_id_flag)); + }, + encode(message: VoteInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(10).fork()).ldelim(); + } + if (message.blockIdFlag !== 0) { + writer.uint32(24).int32(message.blockIdFlag); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): VoteInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVoteInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator = Validator.decode(reader, reader.uint32()); + break; + case 3: + message.blockIdFlag = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): VoteInfo { + const message = createBaseVoteInfo(); + message.validator = object.validator !== undefined && object.validator !== null ? Validator.fromPartial(object.validator) : undefined; + message.blockIdFlag = object.blockIdFlag ?? 0; + return message; + }, + fromAmino(object: VoteInfoAmino): VoteInfo { + const message = createBaseVoteInfo(); + if (object.validator !== undefined && object.validator !== null) { + message.validator = Validator.fromAmino(object.validator); + } + if (object.block_id_flag !== undefined && object.block_id_flag !== null) { + message.blockIdFlag = object.block_id_flag; + } + return message; + }, + toAmino(message: VoteInfo): VoteInfoAmino { + const obj: any = {}; + obj.validator = message.validator ? Validator.toAmino(message.validator) : undefined; + obj.block_id_flag = message.blockIdFlag === 0 ? undefined : message.blockIdFlag; + return obj; + }, + fromAminoMsg(object: VoteInfoAminoMsg): VoteInfo { + return VoteInfo.fromAmino(object.value); + }, + fromProtoMsg(message: VoteInfoProtoMsg): VoteInfo { + return VoteInfo.decode(message.value); + }, + toProto(message: VoteInfo): Uint8Array { + return VoteInfo.encode(message).finish(); + }, + toProtoMsg(message: VoteInfo): VoteInfoProtoMsg { + return { + typeUrl: "/tendermint.abci.VoteInfo", + value: VoteInfo.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(VoteInfo.typeUrl, VoteInfo); +function createBaseExtendedVoteInfo(): ExtendedVoteInfo { + return { + validator: Validator.fromPartial({}), + voteExtension: new Uint8Array(), + extensionSignature: new Uint8Array(), + blockIdFlag: 0 + }; +} +export const ExtendedVoteInfo = { + typeUrl: "/tendermint.abci.ExtendedVoteInfo", + is(o: any): o is ExtendedVoteInfo { + return o && (o.$typeUrl === ExtendedVoteInfo.typeUrl || Validator.is(o.validator) && (o.voteExtension instanceof Uint8Array || typeof o.voteExtension === "string") && (o.extensionSignature instanceof Uint8Array || typeof o.extensionSignature === "string") && isSet(o.blockIdFlag)); + }, + isAmino(o: any): o is ExtendedVoteInfoAmino { + return o && (o.$typeUrl === ExtendedVoteInfo.typeUrl || Validator.isAmino(o.validator) && (o.vote_extension instanceof Uint8Array || typeof o.vote_extension === "string") && (o.extension_signature instanceof Uint8Array || typeof o.extension_signature === "string") && isSet(o.block_id_flag)); + }, + encode(message: ExtendedVoteInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(10).fork()).ldelim(); + } + if (message.voteExtension.length !== 0) { + writer.uint32(26).bytes(message.voteExtension); + } + if (message.extensionSignature.length !== 0) { + writer.uint32(34).bytes(message.extensionSignature); + } + if (message.blockIdFlag !== 0) { + writer.uint32(40).int32(message.blockIdFlag); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ExtendedVoteInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtendedVoteInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validator = Validator.decode(reader, reader.uint32()); + break; + case 3: + message.voteExtension = reader.bytes(); + break; + case 4: + message.extensionSignature = reader.bytes(); + break; + case 5: + message.blockIdFlag = (reader.int32() as any); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ExtendedVoteInfo { + const message = createBaseExtendedVoteInfo(); + message.validator = object.validator !== undefined && object.validator !== null ? Validator.fromPartial(object.validator) : undefined; + message.voteExtension = object.voteExtension ?? new Uint8Array(); + message.extensionSignature = object.extensionSignature ?? new Uint8Array(); + message.blockIdFlag = object.blockIdFlag ?? 0; + return message; + }, + fromAmino(object: ExtendedVoteInfoAmino): ExtendedVoteInfo { + const message = createBaseExtendedVoteInfo(); + if (object.validator !== undefined && object.validator !== null) { + message.validator = Validator.fromAmino(object.validator); + } + if (object.vote_extension !== undefined && object.vote_extension !== null) { + message.voteExtension = bytesFromBase64(object.vote_extension); + } + if (object.extension_signature !== undefined && object.extension_signature !== null) { + message.extensionSignature = bytesFromBase64(object.extension_signature); + } + if (object.block_id_flag !== undefined && object.block_id_flag !== null) { + message.blockIdFlag = object.block_id_flag; + } + return message; + }, + toAmino(message: ExtendedVoteInfo): ExtendedVoteInfoAmino { + const obj: any = {}; + obj.validator = message.validator ? Validator.toAmino(message.validator) : undefined; + obj.vote_extension = message.voteExtension ? base64FromBytes(message.voteExtension) : undefined; + obj.extension_signature = message.extensionSignature ? base64FromBytes(message.extensionSignature) : undefined; + obj.block_id_flag = message.blockIdFlag === 0 ? undefined : message.blockIdFlag; + return obj; + }, + fromAminoMsg(object: ExtendedVoteInfoAminoMsg): ExtendedVoteInfo { + return ExtendedVoteInfo.fromAmino(object.value); + }, + fromProtoMsg(message: ExtendedVoteInfoProtoMsg): ExtendedVoteInfo { + return ExtendedVoteInfo.decode(message.value); + }, + toProto(message: ExtendedVoteInfo): Uint8Array { + return ExtendedVoteInfo.encode(message).finish(); + }, + toProtoMsg(message: ExtendedVoteInfo): ExtendedVoteInfoProtoMsg { + return { + typeUrl: "/tendermint.abci.ExtendedVoteInfo", + value: ExtendedVoteInfo.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ExtendedVoteInfo.typeUrl, ExtendedVoteInfo); +function createBaseMisbehavior(): Misbehavior { + return { + type: 0, + validator: Validator.fromPartial({}), + height: BigInt(0), + time: new Date(), + totalVotingPower: BigInt(0) + }; +} +export const Misbehavior = { + typeUrl: "/tendermint.abci.Misbehavior", + is(o: any): o is Misbehavior { + return o && (o.$typeUrl === Misbehavior.typeUrl || isSet(o.type) && Validator.is(o.validator) && typeof o.height === "bigint" && Timestamp.is(o.time) && typeof o.totalVotingPower === "bigint"); + }, + isAmino(o: any): o is MisbehaviorAmino { + return o && (o.$typeUrl === Misbehavior.typeUrl || isSet(o.type) && Validator.isAmino(o.validator) && typeof o.height === "bigint" && Timestamp.isAmino(o.time) && typeof o.total_voting_power === "bigint"); + }, + encode(message: Misbehavior, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (message.validator !== undefined) { + Validator.encode(message.validator, writer.uint32(18).fork()).ldelim(); + } + if (message.height !== BigInt(0)) { + writer.uint32(24).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(34).fork()).ldelim(); + } + if (message.totalVotingPower !== BigInt(0)) { + writer.uint32(40).int64(message.totalVotingPower); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Misbehavior { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMisbehavior(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = (reader.int32() as any); + break; + case 2: + message.validator = Validator.decode(reader, reader.uint32()); + break; + case 3: + message.height = reader.int64(); + break; + case 4: + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 5: + message.totalVotingPower = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Misbehavior { + const message = createBaseMisbehavior(); + message.type = object.type ?? 0; + message.validator = object.validator !== undefined && object.validator !== null ? Validator.fromPartial(object.validator) : undefined; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.time = object.time ?? undefined; + message.totalVotingPower = object.totalVotingPower !== undefined && object.totalVotingPower !== null ? BigInt(object.totalVotingPower.toString()) : BigInt(0); + return message; + }, + fromAmino(object: MisbehaviorAmino): Misbehavior { + const message = createBaseMisbehavior(); + if (object.type !== undefined && object.type !== null) { + message.type = object.type; + } + if (object.validator !== undefined && object.validator !== null) { + message.validator = Validator.fromAmino(object.validator); + } + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.time !== undefined && object.time !== null) { + message.time = fromTimestamp(Timestamp.fromAmino(object.time)); + } + if (object.total_voting_power !== undefined && object.total_voting_power !== null) { + message.totalVotingPower = BigInt(object.total_voting_power); + } + return message; + }, + toAmino(message: Misbehavior): MisbehaviorAmino { + const obj: any = {}; + obj.type = message.type === 0 ? undefined : message.type; + obj.validator = message.validator ? Validator.toAmino(message.validator) : undefined; + obj.height = message.height !== BigInt(0) ? message.height?.toString() : undefined; + obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; + obj.total_voting_power = message.totalVotingPower !== BigInt(0) ? message.totalVotingPower?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: MisbehaviorAminoMsg): Misbehavior { + return Misbehavior.fromAmino(object.value); + }, + fromProtoMsg(message: MisbehaviorProtoMsg): Misbehavior { + return Misbehavior.decode(message.value); + }, + toProto(message: Misbehavior): Uint8Array { + return Misbehavior.encode(message).finish(); + }, + toProtoMsg(message: Misbehavior): MisbehaviorProtoMsg { + return { + typeUrl: "/tendermint.abci.Misbehavior", + value: Misbehavior.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Misbehavior.typeUrl, Misbehavior); +function createBaseSnapshot(): Snapshot { + return { + height: BigInt(0), + format: 0, + chunks: 0, + hash: new Uint8Array(), + metadata: new Uint8Array() + }; +} +export const Snapshot = { + typeUrl: "/tendermint.abci.Snapshot", + is(o: any): o is Snapshot { + return o && (o.$typeUrl === Snapshot.typeUrl || typeof o.height === "bigint" && typeof o.format === "number" && typeof o.chunks === "number" && (o.hash instanceof Uint8Array || typeof o.hash === "string") && (o.metadata instanceof Uint8Array || typeof o.metadata === "string")); + }, + isAmino(o: any): o is SnapshotAmino { + return o && (o.$typeUrl === Snapshot.typeUrl || typeof o.height === "bigint" && typeof o.format === "number" && typeof o.chunks === "number" && (o.hash instanceof Uint8Array || typeof o.hash === "string") && (o.metadata instanceof Uint8Array || typeof o.metadata === "string")); + }, + encode(message: Snapshot, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { + writer.uint32(8).uint64(message.height); + } + if (message.format !== 0) { + writer.uint32(16).uint32(message.format); + } + if (message.chunks !== 0) { + writer.uint32(24).uint32(message.chunks); + } + if (message.hash.length !== 0) { + writer.uint32(34).bytes(message.hash); + } + if (message.metadata.length !== 0) { + writer.uint32(42).bytes(message.metadata); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Snapshot { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSnapshot(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.uint64(); + break; + case 2: + message.format = reader.uint32(); + break; + case 3: + message.chunks = reader.uint32(); + break; + case 4: + message.hash = reader.bytes(); + break; + case 5: + message.metadata = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Snapshot { + const message = createBaseSnapshot(); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.format = object.format ?? 0; + message.chunks = object.chunks ?? 0; + message.hash = object.hash ?? new Uint8Array(); + message.metadata = object.metadata ?? new Uint8Array(); + return message; + }, + fromAmino(object: SnapshotAmino): Snapshot { + const message = createBaseSnapshot(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.format !== undefined && object.format !== null) { + message.format = object.format; + } + if (object.chunks !== undefined && object.chunks !== null) { + message.chunks = object.chunks; + } + if (object.hash !== undefined && object.hash !== null) { + message.hash = bytesFromBase64(object.hash); + } + if (object.metadata !== undefined && object.metadata !== null) { + message.metadata = bytesFromBase64(object.metadata); + } + return message; + }, + toAmino(message: Snapshot): SnapshotAmino { + const obj: any = {}; + obj.height = message.height !== BigInt(0) ? message.height?.toString() : undefined; + obj.format = message.format === 0 ? undefined : message.format; + obj.chunks = message.chunks === 0 ? undefined : message.chunks; + obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; + obj.metadata = message.metadata ? base64FromBytes(message.metadata) : undefined; + return obj; + }, + fromAminoMsg(object: SnapshotAminoMsg): Snapshot { + return Snapshot.fromAmino(object.value); + }, + fromProtoMsg(message: SnapshotProtoMsg): Snapshot { + return Snapshot.decode(message.value); + }, + toProto(message: Snapshot): Uint8Array { + return Snapshot.encode(message).finish(); + }, + toProtoMsg(message: Snapshot): SnapshotProtoMsg { + return { + typeUrl: "/tendermint.abci.Snapshot", + value: Snapshot.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Snapshot.typeUrl, Snapshot); \ No newline at end of file diff --git a/libs/interchain-query/src/tendermint/crypto/keys.ts b/libs/interchain-query/src/tendermint/crypto/keys.ts new file mode 100644 index 00000000..9dc8476b --- /dev/null +++ b/libs/interchain-query/src/tendermint/crypto/keys.ts @@ -0,0 +1,103 @@ +import { BinaryReader, BinaryWriter } from "../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; +/** PublicKey defines the keys available for use with Validators */ +export interface PublicKey { + ed25519?: Uint8Array; + secp256k1?: Uint8Array; +} +export interface PublicKeyProtoMsg { + typeUrl: "/tendermint.crypto.PublicKey"; + value: Uint8Array; +} +/** PublicKey defines the keys available for use with Validators */ +export interface PublicKeyAmino { + ed25519?: string; + secp256k1?: string; +} +export interface PublicKeyAminoMsg { + type: "/tendermint.crypto.PublicKey"; + value: PublicKeyAmino; +} +function createBasePublicKey(): PublicKey { + return { + ed25519: undefined, + secp256k1: undefined + }; +} +export const PublicKey = { + typeUrl: "/tendermint.crypto.PublicKey", + is(o: any): o is PublicKey { + return o && o.$typeUrl === PublicKey.typeUrl; + }, + isAmino(o: any): o is PublicKeyAmino { + return o && o.$typeUrl === PublicKey.typeUrl; + }, + encode(message: PublicKey, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.ed25519 !== undefined) { + writer.uint32(10).bytes(message.ed25519); + } + if (message.secp256k1 !== undefined) { + writer.uint32(18).bytes(message.secp256k1); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PublicKey { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePublicKey(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.ed25519 = reader.bytes(); + break; + case 2: + message.secp256k1 = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): PublicKey { + const message = createBasePublicKey(); + message.ed25519 = object.ed25519 ?? undefined; + message.secp256k1 = object.secp256k1 ?? undefined; + return message; + }, + fromAmino(object: PublicKeyAmino): PublicKey { + const message = createBasePublicKey(); + if (object.ed25519 !== undefined && object.ed25519 !== null) { + message.ed25519 = bytesFromBase64(object.ed25519); + } + if (object.secp256k1 !== undefined && object.secp256k1 !== null) { + message.secp256k1 = bytesFromBase64(object.secp256k1); + } + return message; + }, + toAmino(message: PublicKey): PublicKeyAmino { + const obj: any = {}; + obj.ed25519 = message.ed25519 ? base64FromBytes(message.ed25519) : undefined; + obj.secp256k1 = message.secp256k1 ? base64FromBytes(message.secp256k1) : undefined; + return obj; + }, + fromAminoMsg(object: PublicKeyAminoMsg): PublicKey { + return PublicKey.fromAmino(object.value); + }, + fromProtoMsg(message: PublicKeyProtoMsg): PublicKey { + return PublicKey.decode(message.value); + }, + toProto(message: PublicKey): Uint8Array { + return PublicKey.encode(message).finish(); + }, + toProtoMsg(message: PublicKey): PublicKeyProtoMsg { + return { + typeUrl: "/tendermint.crypto.PublicKey", + value: PublicKey.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(PublicKey.typeUrl, PublicKey); \ No newline at end of file diff --git a/libs/interchain-query/src/tendermint/crypto/proof.ts b/libs/interchain-query/src/tendermint/crypto/proof.ts new file mode 100644 index 00000000..5f372fcf --- /dev/null +++ b/libs/interchain-query/src/tendermint/crypto/proof.ts @@ -0,0 +1,555 @@ +import { BinaryReader, BinaryWriter } from "../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; +export interface Proof { + total: bigint; + index: bigint; + leafHash: Uint8Array; + aunts: Uint8Array[]; +} +export interface ProofProtoMsg { + typeUrl: "/tendermint.crypto.Proof"; + value: Uint8Array; +} +export interface ProofAmino { + total: string; + index: string; + leaf_hash: string; + aunts: string[]; +} +export interface ProofAminoMsg { + type: "/tendermint.crypto.Proof"; + value: ProofAmino; +} +export interface ValueOp { + /** Encoded in ProofOp.Key. */ + key: Uint8Array; + /** To encode in ProofOp.Data */ + proof?: Proof; +} +export interface ValueOpProtoMsg { + typeUrl: "/tendermint.crypto.ValueOp"; + value: Uint8Array; +} +export interface ValueOpAmino { + /** Encoded in ProofOp.Key. */ + key: string; + /** To encode in ProofOp.Data */ + proof?: ProofAmino; +} +export interface ValueOpAminoMsg { + type: "/tendermint.crypto.ValueOp"; + value: ValueOpAmino; +} +export interface DominoOp { + key: string; + input: string; + output: string; +} +export interface DominoOpProtoMsg { + typeUrl: "/tendermint.crypto.DominoOp"; + value: Uint8Array; +} +export interface DominoOpAmino { + key: string; + input: string; + output: string; +} +export interface DominoOpAminoMsg { + type: "/tendermint.crypto.DominoOp"; + value: DominoOpAmino; +} +/** + * ProofOp defines an operation used for calculating Merkle root + * The data could be arbitrary format, providing nessecary data + * for example neighbouring node hash + */ +export interface ProofOp { + type: string; + key: Uint8Array; + data: Uint8Array; +} +export interface ProofOpProtoMsg { + typeUrl: "/tendermint.crypto.ProofOp"; + value: Uint8Array; +} +/** + * ProofOp defines an operation used for calculating Merkle root + * The data could be arbitrary format, providing nessecary data + * for example neighbouring node hash + */ +export interface ProofOpAmino { + type: string; + key: string; + data: string; +} +export interface ProofOpAminoMsg { + type: "/tendermint.crypto.ProofOp"; + value: ProofOpAmino; +} +/** ProofOps is Merkle proof defined by the list of ProofOps */ +export interface ProofOps { + ops: ProofOp[]; +} +export interface ProofOpsProtoMsg { + typeUrl: "/tendermint.crypto.ProofOps"; + value: Uint8Array; +} +/** ProofOps is Merkle proof defined by the list of ProofOps */ +export interface ProofOpsAmino { + ops: ProofOpAmino[]; +} +export interface ProofOpsAminoMsg { + type: "/tendermint.crypto.ProofOps"; + value: ProofOpsAmino; +} +function createBaseProof(): Proof { + return { + total: BigInt(0), + index: BigInt(0), + leafHash: new Uint8Array(), + aunts: [] + }; +} +export const Proof = { + typeUrl: "/tendermint.crypto.Proof", + is(o: any): o is Proof { + return o && (o.$typeUrl === Proof.typeUrl || typeof o.total === "bigint" && typeof o.index === "bigint" && (o.leafHash instanceof Uint8Array || typeof o.leafHash === "string") && Array.isArray(o.aunts) && (!o.aunts.length || o.aunts[0] instanceof Uint8Array || typeof o.aunts[0] === "string")); + }, + isAmino(o: any): o is ProofAmino { + return o && (o.$typeUrl === Proof.typeUrl || typeof o.total === "bigint" && typeof o.index === "bigint" && (o.leaf_hash instanceof Uint8Array || typeof o.leaf_hash === "string") && Array.isArray(o.aunts) && (!o.aunts.length || o.aunts[0] instanceof Uint8Array || typeof o.aunts[0] === "string")); + }, + encode(message: Proof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.total !== BigInt(0)) { + writer.uint32(8).int64(message.total); + } + if (message.index !== BigInt(0)) { + writer.uint32(16).int64(message.index); + } + if (message.leafHash.length !== 0) { + writer.uint32(26).bytes(message.leafHash); + } + for (const v of message.aunts) { + writer.uint32(34).bytes(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Proof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.total = reader.int64(); + break; + case 2: + message.index = reader.int64(); + break; + case 3: + message.leafHash = reader.bytes(); + break; + case 4: + message.aunts.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Proof { + const message = createBaseProof(); + message.total = object.total !== undefined && object.total !== null ? BigInt(object.total.toString()) : BigInt(0); + message.index = object.index !== undefined && object.index !== null ? BigInt(object.index.toString()) : BigInt(0); + message.leafHash = object.leafHash ?? new Uint8Array(); + message.aunts = object.aunts?.map(e => e) || []; + return message; + }, + fromAmino(object: ProofAmino): Proof { + const message = createBaseProof(); + if (object.total !== undefined && object.total !== null) { + message.total = BigInt(object.total); + } + if (object.index !== undefined && object.index !== null) { + message.index = BigInt(object.index); + } + if (object.leaf_hash !== undefined && object.leaf_hash !== null) { + message.leafHash = bytesFromBase64(object.leaf_hash); + } + message.aunts = object.aunts?.map(e => bytesFromBase64(e)) || []; + return message; + }, + toAmino(message: Proof): ProofAmino { + const obj: any = {}; + obj.total = message.total !== BigInt(0) ? message.total?.toString() : undefined; + obj.index = message.index !== BigInt(0) ? message.index?.toString() : undefined; + obj.leaf_hash = message.leafHash ? base64FromBytes(message.leafHash) : undefined; + if (message.aunts) { + obj.aunts = message.aunts.map(e => base64FromBytes(e)); + } else { + obj.aunts = message.aunts; + } + return obj; + }, + fromAminoMsg(object: ProofAminoMsg): Proof { + return Proof.fromAmino(object.value); + }, + fromProtoMsg(message: ProofProtoMsg): Proof { + return Proof.decode(message.value); + }, + toProto(message: Proof): Uint8Array { + return Proof.encode(message).finish(); + }, + toProtoMsg(message: Proof): ProofProtoMsg { + return { + typeUrl: "/tendermint.crypto.Proof", + value: Proof.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Proof.typeUrl, Proof); +function createBaseValueOp(): ValueOp { + return { + key: new Uint8Array(), + proof: undefined + }; +} +export const ValueOp = { + typeUrl: "/tendermint.crypto.ValueOp", + is(o: any): o is ValueOp { + return o && (o.$typeUrl === ValueOp.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + isAmino(o: any): o is ValueOpAmino { + return o && (o.$typeUrl === ValueOp.typeUrl || o.key instanceof Uint8Array || typeof o.key === "string"); + }, + encode(message: ValueOp, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.key.length !== 0) { + writer.uint32(10).bytes(message.key); + } + if (message.proof !== undefined) { + Proof.encode(message.proof, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ValueOp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValueOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.bytes(); + break; + case 2: + message.proof = Proof.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ValueOp { + const message = createBaseValueOp(); + message.key = object.key ?? new Uint8Array(); + message.proof = object.proof !== undefined && object.proof !== null ? Proof.fromPartial(object.proof) : undefined; + return message; + }, + fromAmino(object: ValueOpAmino): ValueOp { + const message = createBaseValueOp(); + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + if (object.proof !== undefined && object.proof !== null) { + message.proof = Proof.fromAmino(object.proof); + } + return message; + }, + toAmino(message: ValueOp): ValueOpAmino { + const obj: any = {}; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + obj.proof = message.proof ? Proof.toAmino(message.proof) : undefined; + return obj; + }, + fromAminoMsg(object: ValueOpAminoMsg): ValueOp { + return ValueOp.fromAmino(object.value); + }, + fromProtoMsg(message: ValueOpProtoMsg): ValueOp { + return ValueOp.decode(message.value); + }, + toProto(message: ValueOp): Uint8Array { + return ValueOp.encode(message).finish(); + }, + toProtoMsg(message: ValueOp): ValueOpProtoMsg { + return { + typeUrl: "/tendermint.crypto.ValueOp", + value: ValueOp.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ValueOp.typeUrl, ValueOp); +function createBaseDominoOp(): DominoOp { + return { + key: "", + input: "", + output: "" + }; +} +export const DominoOp = { + typeUrl: "/tendermint.crypto.DominoOp", + is(o: any): o is DominoOp { + return o && (o.$typeUrl === DominoOp.typeUrl || typeof o.key === "string" && typeof o.input === "string" && typeof o.output === "string"); + }, + isAmino(o: any): o is DominoOpAmino { + return o && (o.$typeUrl === DominoOp.typeUrl || typeof o.key === "string" && typeof o.input === "string" && typeof o.output === "string"); + }, + encode(message: DominoOp, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.input !== "") { + writer.uint32(18).string(message.input); + } + if (message.output !== "") { + writer.uint32(26).string(message.output); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DominoOp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDominoOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.string(); + break; + case 2: + message.input = reader.string(); + break; + case 3: + message.output = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): DominoOp { + const message = createBaseDominoOp(); + message.key = object.key ?? ""; + message.input = object.input ?? ""; + message.output = object.output ?? ""; + return message; + }, + fromAmino(object: DominoOpAmino): DominoOp { + const message = createBaseDominoOp(); + if (object.key !== undefined && object.key !== null) { + message.key = object.key; + } + if (object.input !== undefined && object.input !== null) { + message.input = object.input; + } + if (object.output !== undefined && object.output !== null) { + message.output = object.output; + } + return message; + }, + toAmino(message: DominoOp): DominoOpAmino { + const obj: any = {}; + obj.key = message.key === "" ? undefined : message.key; + obj.input = message.input === "" ? undefined : message.input; + obj.output = message.output === "" ? undefined : message.output; + return obj; + }, + fromAminoMsg(object: DominoOpAminoMsg): DominoOp { + return DominoOp.fromAmino(object.value); + }, + fromProtoMsg(message: DominoOpProtoMsg): DominoOp { + return DominoOp.decode(message.value); + }, + toProto(message: DominoOp): Uint8Array { + return DominoOp.encode(message).finish(); + }, + toProtoMsg(message: DominoOp): DominoOpProtoMsg { + return { + typeUrl: "/tendermint.crypto.DominoOp", + value: DominoOp.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(DominoOp.typeUrl, DominoOp); +function createBaseProofOp(): ProofOp { + return { + type: "", + key: new Uint8Array(), + data: new Uint8Array() + }; +} +export const ProofOp = { + typeUrl: "/tendermint.crypto.ProofOp", + is(o: any): o is ProofOp { + return o && (o.$typeUrl === ProofOp.typeUrl || typeof o.type === "string" && (o.key instanceof Uint8Array || typeof o.key === "string") && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + isAmino(o: any): o is ProofOpAmino { + return o && (o.$typeUrl === ProofOp.typeUrl || typeof o.type === "string" && (o.key instanceof Uint8Array || typeof o.key === "string") && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + encode(message: ProofOp, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.type !== "") { + writer.uint32(10).string(message.type); + } + if (message.key.length !== 0) { + writer.uint32(18).bytes(message.key); + } + if (message.data.length !== 0) { + writer.uint32(26).bytes(message.data); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ProofOp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProofOp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = reader.string(); + break; + case 2: + message.key = reader.bytes(); + break; + case 3: + message.data = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ProofOp { + const message = createBaseProofOp(); + message.type = object.type ?? ""; + message.key = object.key ?? new Uint8Array(); + message.data = object.data ?? new Uint8Array(); + return message; + }, + fromAmino(object: ProofOpAmino): ProofOp { + const message = createBaseProofOp(); + if (object.type !== undefined && object.type !== null) { + message.type = object.type; + } + if (object.key !== undefined && object.key !== null) { + message.key = bytesFromBase64(object.key); + } + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + return message; + }, + toAmino(message: ProofOp): ProofOpAmino { + const obj: any = {}; + obj.type = message.type === "" ? undefined : message.type; + obj.key = message.key ? base64FromBytes(message.key) : undefined; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + return obj; + }, + fromAminoMsg(object: ProofOpAminoMsg): ProofOp { + return ProofOp.fromAmino(object.value); + }, + fromProtoMsg(message: ProofOpProtoMsg): ProofOp { + return ProofOp.decode(message.value); + }, + toProto(message: ProofOp): Uint8Array { + return ProofOp.encode(message).finish(); + }, + toProtoMsg(message: ProofOp): ProofOpProtoMsg { + return { + typeUrl: "/tendermint.crypto.ProofOp", + value: ProofOp.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ProofOp.typeUrl, ProofOp); +function createBaseProofOps(): ProofOps { + return { + ops: [] + }; +} +export const ProofOps = { + typeUrl: "/tendermint.crypto.ProofOps", + is(o: any): o is ProofOps { + return o && (o.$typeUrl === ProofOps.typeUrl || Array.isArray(o.ops) && (!o.ops.length || ProofOp.is(o.ops[0]))); + }, + isAmino(o: any): o is ProofOpsAmino { + return o && (o.$typeUrl === ProofOps.typeUrl || Array.isArray(o.ops) && (!o.ops.length || ProofOp.isAmino(o.ops[0]))); + }, + encode(message: ProofOps, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.ops) { + ProofOp.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ProofOps { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProofOps(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.ops.push(ProofOp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ProofOps { + const message = createBaseProofOps(); + message.ops = object.ops?.map(e => ProofOp.fromPartial(e)) || []; + return message; + }, + fromAmino(object: ProofOpsAmino): ProofOps { + const message = createBaseProofOps(); + message.ops = object.ops?.map(e => ProofOp.fromAmino(e)) || []; + return message; + }, + toAmino(message: ProofOps): ProofOpsAmino { + const obj: any = {}; + if (message.ops) { + obj.ops = message.ops.map(e => e ? ProofOp.toAmino(e) : undefined); + } else { + obj.ops = message.ops; + } + return obj; + }, + fromAminoMsg(object: ProofOpsAminoMsg): ProofOps { + return ProofOps.fromAmino(object.value); + }, + fromProtoMsg(message: ProofOpsProtoMsg): ProofOps { + return ProofOps.decode(message.value); + }, + toProto(message: ProofOps): Uint8Array { + return ProofOps.encode(message).finish(); + }, + toProtoMsg(message: ProofOps): ProofOpsProtoMsg { + return { + typeUrl: "/tendermint.crypto.ProofOps", + value: ProofOps.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ProofOps.typeUrl, ProofOps); \ No newline at end of file diff --git a/libs/interchain-query/src/tendermint/types/block.ts b/libs/interchain-query/src/tendermint/types/block.ts new file mode 100644 index 00000000..16763b51 --- /dev/null +++ b/libs/interchain-query/src/tendermint/types/block.ts @@ -0,0 +1,131 @@ +import { Header, HeaderAmino, Data, DataAmino, Commit, CommitAmino } from "./types"; +import { EvidenceList, EvidenceListAmino } from "./evidence"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { DeepPartial } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; +export interface Block { + header: Header; + data: Data; + evidence: EvidenceList; + lastCommit?: Commit; +} +export interface BlockProtoMsg { + typeUrl: "/tendermint.types.Block"; + value: Uint8Array; +} +export interface BlockAmino { + header: HeaderAmino; + data: DataAmino; + evidence: EvidenceListAmino; + last_commit?: CommitAmino; +} +export interface BlockAminoMsg { + type: "/tendermint.types.Block"; + value: BlockAmino; +} +function createBaseBlock(): Block { + return { + header: Header.fromPartial({}), + data: Data.fromPartial({}), + evidence: EvidenceList.fromPartial({}), + lastCommit: undefined + }; +} +export const Block = { + typeUrl: "/tendermint.types.Block", + is(o: any): o is Block { + return o && (o.$typeUrl === Block.typeUrl || Header.is(o.header) && Data.is(o.data) && EvidenceList.is(o.evidence)); + }, + isAmino(o: any): o is BlockAmino { + return o && (o.$typeUrl === Block.typeUrl || Header.isAmino(o.header) && Data.isAmino(o.data) && EvidenceList.isAmino(o.evidence)); + }, + encode(message: Block, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(10).fork()).ldelim(); + } + if (message.data !== undefined) { + Data.encode(message.data, writer.uint32(18).fork()).ldelim(); + } + if (message.evidence !== undefined) { + EvidenceList.encode(message.evidence, writer.uint32(26).fork()).ldelim(); + } + if (message.lastCommit !== undefined) { + Commit.encode(message.lastCommit, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Block { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.header = Header.decode(reader, reader.uint32()); + break; + case 2: + message.data = Data.decode(reader, reader.uint32()); + break; + case 3: + message.evidence = EvidenceList.decode(reader, reader.uint32()); + break; + case 4: + message.lastCommit = Commit.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Block { + const message = createBaseBlock(); + message.header = object.header !== undefined && object.header !== null ? Header.fromPartial(object.header) : undefined; + message.data = object.data !== undefined && object.data !== null ? Data.fromPartial(object.data) : undefined; + message.evidence = object.evidence !== undefined && object.evidence !== null ? EvidenceList.fromPartial(object.evidence) : undefined; + message.lastCommit = object.lastCommit !== undefined && object.lastCommit !== null ? Commit.fromPartial(object.lastCommit) : undefined; + return message; + }, + fromAmino(object: BlockAmino): Block { + const message = createBaseBlock(); + if (object.header !== undefined && object.header !== null) { + message.header = Header.fromAmino(object.header); + } + if (object.data !== undefined && object.data !== null) { + message.data = Data.fromAmino(object.data); + } + if (object.evidence !== undefined && object.evidence !== null) { + message.evidence = EvidenceList.fromAmino(object.evidence); + } + if (object.last_commit !== undefined && object.last_commit !== null) { + message.lastCommit = Commit.fromAmino(object.last_commit); + } + return message; + }, + toAmino(message: Block): BlockAmino { + const obj: any = {}; + obj.header = message.header ? Header.toAmino(message.header) : undefined; + obj.data = message.data ? Data.toAmino(message.data) : undefined; + obj.evidence = message.evidence ? EvidenceList.toAmino(message.evidence) : undefined; + obj.last_commit = message.lastCommit ? Commit.toAmino(message.lastCommit) : undefined; + return obj; + }, + fromAminoMsg(object: BlockAminoMsg): Block { + return Block.fromAmino(object.value); + }, + fromProtoMsg(message: BlockProtoMsg): Block { + return Block.decode(message.value); + }, + toProto(message: Block): Uint8Array { + return Block.encode(message).finish(); + }, + toProtoMsg(message: Block): BlockProtoMsg { + return { + typeUrl: "/tendermint.types.Block", + value: Block.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Block.typeUrl, Block); \ No newline at end of file diff --git a/libs/interchain-query/src/tendermint/types/evidence.ts b/libs/interchain-query/src/tendermint/types/evidence.ts new file mode 100644 index 00000000..696b6c8a --- /dev/null +++ b/libs/interchain-query/src/tendermint/types/evidence.ts @@ -0,0 +1,476 @@ +import { Vote, VoteAmino, LightBlock, LightBlockAmino } from "./types"; +import { Timestamp } from "../../google/protobuf/timestamp"; +import { Validator, ValidatorAmino } from "./validator"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { DeepPartial, toTimestamp, fromTimestamp } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; +export interface Evidence { + duplicateVoteEvidence?: DuplicateVoteEvidence; + lightClientAttackEvidence?: LightClientAttackEvidence; +} +export interface EvidenceProtoMsg { + typeUrl: "/tendermint.types.Evidence"; + value: Uint8Array; +} +export interface EvidenceAmino { + duplicate_vote_evidence?: DuplicateVoteEvidenceAmino; + light_client_attack_evidence?: LightClientAttackEvidenceAmino; +} +export interface EvidenceAminoMsg { + type: "/tendermint.types.Evidence"; + value: EvidenceAmino; +} +/** DuplicateVoteEvidence contains evidence of a validator signed two conflicting votes. */ +export interface DuplicateVoteEvidence { + voteA?: Vote; + voteB?: Vote; + totalVotingPower: bigint; + validatorPower: bigint; + timestamp: Date; +} +export interface DuplicateVoteEvidenceProtoMsg { + typeUrl: "/tendermint.types.DuplicateVoteEvidence"; + value: Uint8Array; +} +/** DuplicateVoteEvidence contains evidence of a validator signed two conflicting votes. */ +export interface DuplicateVoteEvidenceAmino { + vote_a?: VoteAmino; + vote_b?: VoteAmino; + total_voting_power: string; + validator_power: string; + timestamp: string; +} +export interface DuplicateVoteEvidenceAminoMsg { + type: "/tendermint.types.DuplicateVoteEvidence"; + value: DuplicateVoteEvidenceAmino; +} +/** LightClientAttackEvidence contains evidence of a set of validators attempting to mislead a light client. */ +export interface LightClientAttackEvidence { + conflictingBlock?: LightBlock; + commonHeight: bigint; + byzantineValidators: Validator[]; + totalVotingPower: bigint; + timestamp: Date; +} +export interface LightClientAttackEvidenceProtoMsg { + typeUrl: "/tendermint.types.LightClientAttackEvidence"; + value: Uint8Array; +} +/** LightClientAttackEvidence contains evidence of a set of validators attempting to mislead a light client. */ +export interface LightClientAttackEvidenceAmino { + conflicting_block?: LightBlockAmino; + common_height: string; + byzantine_validators: ValidatorAmino[]; + total_voting_power: string; + timestamp: string; +} +export interface LightClientAttackEvidenceAminoMsg { + type: "/tendermint.types.LightClientAttackEvidence"; + value: LightClientAttackEvidenceAmino; +} +export interface EvidenceList { + evidence: Evidence[]; +} +export interface EvidenceListProtoMsg { + typeUrl: "/tendermint.types.EvidenceList"; + value: Uint8Array; +} +export interface EvidenceListAmino { + evidence: EvidenceAmino[]; +} +export interface EvidenceListAminoMsg { + type: "/tendermint.types.EvidenceList"; + value: EvidenceListAmino; +} +function createBaseEvidence(): Evidence { + return { + duplicateVoteEvidence: undefined, + lightClientAttackEvidence: undefined + }; +} +export const Evidence = { + typeUrl: "/tendermint.types.Evidence", + is(o: any): o is Evidence { + return o && o.$typeUrl === Evidence.typeUrl; + }, + isAmino(o: any): o is EvidenceAmino { + return o && o.$typeUrl === Evidence.typeUrl; + }, + encode(message: Evidence, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.duplicateVoteEvidence !== undefined) { + DuplicateVoteEvidence.encode(message.duplicateVoteEvidence, writer.uint32(10).fork()).ldelim(); + } + if (message.lightClientAttackEvidence !== undefined) { + LightClientAttackEvidence.encode(message.lightClientAttackEvidence, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Evidence { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvidence(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.duplicateVoteEvidence = DuplicateVoteEvidence.decode(reader, reader.uint32()); + break; + case 2: + message.lightClientAttackEvidence = LightClientAttackEvidence.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Evidence { + const message = createBaseEvidence(); + message.duplicateVoteEvidence = object.duplicateVoteEvidence !== undefined && object.duplicateVoteEvidence !== null ? DuplicateVoteEvidence.fromPartial(object.duplicateVoteEvidence) : undefined; + message.lightClientAttackEvidence = object.lightClientAttackEvidence !== undefined && object.lightClientAttackEvidence !== null ? LightClientAttackEvidence.fromPartial(object.lightClientAttackEvidence) : undefined; + return message; + }, + fromAmino(object: EvidenceAmino): Evidence { + const message = createBaseEvidence(); + if (object.duplicate_vote_evidence !== undefined && object.duplicate_vote_evidence !== null) { + message.duplicateVoteEvidence = DuplicateVoteEvidence.fromAmino(object.duplicate_vote_evidence); + } + if (object.light_client_attack_evidence !== undefined && object.light_client_attack_evidence !== null) { + message.lightClientAttackEvidence = LightClientAttackEvidence.fromAmino(object.light_client_attack_evidence); + } + return message; + }, + toAmino(message: Evidence): EvidenceAmino { + const obj: any = {}; + obj.duplicate_vote_evidence = message.duplicateVoteEvidence ? DuplicateVoteEvidence.toAmino(message.duplicateVoteEvidence) : undefined; + obj.light_client_attack_evidence = message.lightClientAttackEvidence ? LightClientAttackEvidence.toAmino(message.lightClientAttackEvidence) : undefined; + return obj; + }, + fromAminoMsg(object: EvidenceAminoMsg): Evidence { + return Evidence.fromAmino(object.value); + }, + fromProtoMsg(message: EvidenceProtoMsg): Evidence { + return Evidence.decode(message.value); + }, + toProto(message: Evidence): Uint8Array { + return Evidence.encode(message).finish(); + }, + toProtoMsg(message: Evidence): EvidenceProtoMsg { + return { + typeUrl: "/tendermint.types.Evidence", + value: Evidence.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Evidence.typeUrl, Evidence); +function createBaseDuplicateVoteEvidence(): DuplicateVoteEvidence { + return { + voteA: undefined, + voteB: undefined, + totalVotingPower: BigInt(0), + validatorPower: BigInt(0), + timestamp: new Date() + }; +} +export const DuplicateVoteEvidence = { + typeUrl: "/tendermint.types.DuplicateVoteEvidence", + is(o: any): o is DuplicateVoteEvidence { + return o && (o.$typeUrl === DuplicateVoteEvidence.typeUrl || typeof o.totalVotingPower === "bigint" && typeof o.validatorPower === "bigint" && Timestamp.is(o.timestamp)); + }, + isAmino(o: any): o is DuplicateVoteEvidenceAmino { + return o && (o.$typeUrl === DuplicateVoteEvidence.typeUrl || typeof o.total_voting_power === "bigint" && typeof o.validator_power === "bigint" && Timestamp.isAmino(o.timestamp)); + }, + encode(message: DuplicateVoteEvidence, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.voteA !== undefined) { + Vote.encode(message.voteA, writer.uint32(10).fork()).ldelim(); + } + if (message.voteB !== undefined) { + Vote.encode(message.voteB, writer.uint32(18).fork()).ldelim(); + } + if (message.totalVotingPower !== BigInt(0)) { + writer.uint32(24).int64(message.totalVotingPower); + } + if (message.validatorPower !== BigInt(0)) { + writer.uint32(32).int64(message.validatorPower); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DuplicateVoteEvidence { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDuplicateVoteEvidence(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.voteA = Vote.decode(reader, reader.uint32()); + break; + case 2: + message.voteB = Vote.decode(reader, reader.uint32()); + break; + case 3: + message.totalVotingPower = reader.int64(); + break; + case 4: + message.validatorPower = reader.int64(); + break; + case 5: + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): DuplicateVoteEvidence { + const message = createBaseDuplicateVoteEvidence(); + message.voteA = object.voteA !== undefined && object.voteA !== null ? Vote.fromPartial(object.voteA) : undefined; + message.voteB = object.voteB !== undefined && object.voteB !== null ? Vote.fromPartial(object.voteB) : undefined; + message.totalVotingPower = object.totalVotingPower !== undefined && object.totalVotingPower !== null ? BigInt(object.totalVotingPower.toString()) : BigInt(0); + message.validatorPower = object.validatorPower !== undefined && object.validatorPower !== null ? BigInt(object.validatorPower.toString()) : BigInt(0); + message.timestamp = object.timestamp ?? undefined; + return message; + }, + fromAmino(object: DuplicateVoteEvidenceAmino): DuplicateVoteEvidence { + const message = createBaseDuplicateVoteEvidence(); + if (object.vote_a !== undefined && object.vote_a !== null) { + message.voteA = Vote.fromAmino(object.vote_a); + } + if (object.vote_b !== undefined && object.vote_b !== null) { + message.voteB = Vote.fromAmino(object.vote_b); + } + if (object.total_voting_power !== undefined && object.total_voting_power !== null) { + message.totalVotingPower = BigInt(object.total_voting_power); + } + if (object.validator_power !== undefined && object.validator_power !== null) { + message.validatorPower = BigInt(object.validator_power); + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = fromTimestamp(Timestamp.fromAmino(object.timestamp)); + } + return message; + }, + toAmino(message: DuplicateVoteEvidence): DuplicateVoteEvidenceAmino { + const obj: any = {}; + obj.vote_a = message.voteA ? Vote.toAmino(message.voteA) : undefined; + obj.vote_b = message.voteB ? Vote.toAmino(message.voteB) : undefined; + obj.total_voting_power = message.totalVotingPower !== BigInt(0) ? message.totalVotingPower?.toString() : undefined; + obj.validator_power = message.validatorPower !== BigInt(0) ? message.validatorPower?.toString() : undefined; + obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; + return obj; + }, + fromAminoMsg(object: DuplicateVoteEvidenceAminoMsg): DuplicateVoteEvidence { + return DuplicateVoteEvidence.fromAmino(object.value); + }, + fromProtoMsg(message: DuplicateVoteEvidenceProtoMsg): DuplicateVoteEvidence { + return DuplicateVoteEvidence.decode(message.value); + }, + toProto(message: DuplicateVoteEvidence): Uint8Array { + return DuplicateVoteEvidence.encode(message).finish(); + }, + toProtoMsg(message: DuplicateVoteEvidence): DuplicateVoteEvidenceProtoMsg { + return { + typeUrl: "/tendermint.types.DuplicateVoteEvidence", + value: DuplicateVoteEvidence.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(DuplicateVoteEvidence.typeUrl, DuplicateVoteEvidence); +function createBaseLightClientAttackEvidence(): LightClientAttackEvidence { + return { + conflictingBlock: undefined, + commonHeight: BigInt(0), + byzantineValidators: [], + totalVotingPower: BigInt(0), + timestamp: new Date() + }; +} +export const LightClientAttackEvidence = { + typeUrl: "/tendermint.types.LightClientAttackEvidence", + is(o: any): o is LightClientAttackEvidence { + return o && (o.$typeUrl === LightClientAttackEvidence.typeUrl || typeof o.commonHeight === "bigint" && Array.isArray(o.byzantineValidators) && (!o.byzantineValidators.length || Validator.is(o.byzantineValidators[0])) && typeof o.totalVotingPower === "bigint" && Timestamp.is(o.timestamp)); + }, + isAmino(o: any): o is LightClientAttackEvidenceAmino { + return o && (o.$typeUrl === LightClientAttackEvidence.typeUrl || typeof o.common_height === "bigint" && Array.isArray(o.byzantine_validators) && (!o.byzantine_validators.length || Validator.isAmino(o.byzantine_validators[0])) && typeof o.total_voting_power === "bigint" && Timestamp.isAmino(o.timestamp)); + }, + encode(message: LightClientAttackEvidence, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.conflictingBlock !== undefined) { + LightBlock.encode(message.conflictingBlock, writer.uint32(10).fork()).ldelim(); + } + if (message.commonHeight !== BigInt(0)) { + writer.uint32(16).int64(message.commonHeight); + } + for (const v of message.byzantineValidators) { + Validator.encode(v!, writer.uint32(26).fork()).ldelim(); + } + if (message.totalVotingPower !== BigInt(0)) { + writer.uint32(32).int64(message.totalVotingPower); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): LightClientAttackEvidence { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLightClientAttackEvidence(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.conflictingBlock = LightBlock.decode(reader, reader.uint32()); + break; + case 2: + message.commonHeight = reader.int64(); + break; + case 3: + message.byzantineValidators.push(Validator.decode(reader, reader.uint32())); + break; + case 4: + message.totalVotingPower = reader.int64(); + break; + case 5: + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): LightClientAttackEvidence { + const message = createBaseLightClientAttackEvidence(); + message.conflictingBlock = object.conflictingBlock !== undefined && object.conflictingBlock !== null ? LightBlock.fromPartial(object.conflictingBlock) : undefined; + message.commonHeight = object.commonHeight !== undefined && object.commonHeight !== null ? BigInt(object.commonHeight.toString()) : BigInt(0); + message.byzantineValidators = object.byzantineValidators?.map(e => Validator.fromPartial(e)) || []; + message.totalVotingPower = object.totalVotingPower !== undefined && object.totalVotingPower !== null ? BigInt(object.totalVotingPower.toString()) : BigInt(0); + message.timestamp = object.timestamp ?? undefined; + return message; + }, + fromAmino(object: LightClientAttackEvidenceAmino): LightClientAttackEvidence { + const message = createBaseLightClientAttackEvidence(); + if (object.conflicting_block !== undefined && object.conflicting_block !== null) { + message.conflictingBlock = LightBlock.fromAmino(object.conflicting_block); + } + if (object.common_height !== undefined && object.common_height !== null) { + message.commonHeight = BigInt(object.common_height); + } + message.byzantineValidators = object.byzantine_validators?.map(e => Validator.fromAmino(e)) || []; + if (object.total_voting_power !== undefined && object.total_voting_power !== null) { + message.totalVotingPower = BigInt(object.total_voting_power); + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = fromTimestamp(Timestamp.fromAmino(object.timestamp)); + } + return message; + }, + toAmino(message: LightClientAttackEvidence): LightClientAttackEvidenceAmino { + const obj: any = {}; + obj.conflicting_block = message.conflictingBlock ? LightBlock.toAmino(message.conflictingBlock) : undefined; + obj.common_height = message.commonHeight !== BigInt(0) ? message.commonHeight?.toString() : undefined; + if (message.byzantineValidators) { + obj.byzantine_validators = message.byzantineValidators.map(e => e ? Validator.toAmino(e) : undefined); + } else { + obj.byzantine_validators = message.byzantineValidators; + } + obj.total_voting_power = message.totalVotingPower !== BigInt(0) ? message.totalVotingPower?.toString() : undefined; + obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; + return obj; + }, + fromAminoMsg(object: LightClientAttackEvidenceAminoMsg): LightClientAttackEvidence { + return LightClientAttackEvidence.fromAmino(object.value); + }, + fromProtoMsg(message: LightClientAttackEvidenceProtoMsg): LightClientAttackEvidence { + return LightClientAttackEvidence.decode(message.value); + }, + toProto(message: LightClientAttackEvidence): Uint8Array { + return LightClientAttackEvidence.encode(message).finish(); + }, + toProtoMsg(message: LightClientAttackEvidence): LightClientAttackEvidenceProtoMsg { + return { + typeUrl: "/tendermint.types.LightClientAttackEvidence", + value: LightClientAttackEvidence.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(LightClientAttackEvidence.typeUrl, LightClientAttackEvidence); +function createBaseEvidenceList(): EvidenceList { + return { + evidence: [] + }; +} +export const EvidenceList = { + typeUrl: "/tendermint.types.EvidenceList", + is(o: any): o is EvidenceList { + return o && (o.$typeUrl === EvidenceList.typeUrl || Array.isArray(o.evidence) && (!o.evidence.length || Evidence.is(o.evidence[0]))); + }, + isAmino(o: any): o is EvidenceListAmino { + return o && (o.$typeUrl === EvidenceList.typeUrl || Array.isArray(o.evidence) && (!o.evidence.length || Evidence.isAmino(o.evidence[0]))); + }, + encode(message: EvidenceList, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.evidence) { + Evidence.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EvidenceList { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvidenceList(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.evidence.push(Evidence.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): EvidenceList { + const message = createBaseEvidenceList(); + message.evidence = object.evidence?.map(e => Evidence.fromPartial(e)) || []; + return message; + }, + fromAmino(object: EvidenceListAmino): EvidenceList { + const message = createBaseEvidenceList(); + message.evidence = object.evidence?.map(e => Evidence.fromAmino(e)) || []; + return message; + }, + toAmino(message: EvidenceList): EvidenceListAmino { + const obj: any = {}; + if (message.evidence) { + obj.evidence = message.evidence.map(e => e ? Evidence.toAmino(e) : undefined); + } else { + obj.evidence = message.evidence; + } + return obj; + }, + fromAminoMsg(object: EvidenceListAminoMsg): EvidenceList { + return EvidenceList.fromAmino(object.value); + }, + fromProtoMsg(message: EvidenceListProtoMsg): EvidenceList { + return EvidenceList.decode(message.value); + }, + toProto(message: EvidenceList): Uint8Array { + return EvidenceList.encode(message).finish(); + }, + toProtoMsg(message: EvidenceList): EvidenceListProtoMsg { + return { + typeUrl: "/tendermint.types.EvidenceList", + value: EvidenceList.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(EvidenceList.typeUrl, EvidenceList); \ No newline at end of file diff --git a/libs/interchain-query/src/tendermint/types/params.ts b/libs/interchain-query/src/tendermint/types/params.ts new file mode 100644 index 00000000..0b15190e --- /dev/null +++ b/libs/interchain-query/src/tendermint/types/params.ts @@ -0,0 +1,814 @@ +import { Duration, DurationAmino } from "../../google/protobuf/duration"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { DeepPartial } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; +/** + * ConsensusParams contains consensus critical parameters that determine the + * validity of blocks. + */ +export interface ConsensusParams { + block?: BlockParams; + evidence?: EvidenceParams; + validator?: ValidatorParams; + version?: VersionParams; + abci?: ABCIParams; +} +export interface ConsensusParamsProtoMsg { + typeUrl: "/tendermint.types.ConsensusParams"; + value: Uint8Array; +} +/** + * ConsensusParams contains consensus critical parameters that determine the + * validity of blocks. + */ +export interface ConsensusParamsAmino { + block?: BlockParamsAmino; + evidence?: EvidenceParamsAmino; + validator?: ValidatorParamsAmino; + version?: VersionParamsAmino; + abci?: ABCIParamsAmino; +} +export interface ConsensusParamsAminoMsg { + type: "/tendermint.types.ConsensusParams"; + value: ConsensusParamsAmino; +} +/** BlockParams contains limits on the block size. */ +export interface BlockParams { + /** + * Max block size, in bytes. + * Note: must be greater than 0 + */ + maxBytes: bigint; + /** + * Max gas per block. + * Note: must be greater or equal to -1 + */ + maxGas: bigint; +} +export interface BlockParamsProtoMsg { + typeUrl: "/tendermint.types.BlockParams"; + value: Uint8Array; +} +/** BlockParams contains limits on the block size. */ +export interface BlockParamsAmino { + /** + * Max block size, in bytes. + * Note: must be greater than 0 + */ + max_bytes: string; + /** + * Max gas per block. + * Note: must be greater or equal to -1 + */ + max_gas: string; +} +export interface BlockParamsAminoMsg { + type: "/tendermint.types.BlockParams"; + value: BlockParamsAmino; +} +/** EvidenceParams determine how we handle evidence of malfeasance. */ +export interface EvidenceParams { + /** + * Max age of evidence, in blocks. + * + * The basic formula for calculating this is: MaxAgeDuration / {average block + * time}. + */ + maxAgeNumBlocks: bigint; + /** + * Max age of evidence, in time. + * + * It should correspond with an app's "unbonding period" or other similar + * mechanism for handling [Nothing-At-Stake + * attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed). + */ + maxAgeDuration: Duration; + /** + * This sets the maximum size of total evidence in bytes that can be committed in a single block. + * and should fall comfortably under the max block bytes. + * Default is 1048576 or 1MB + */ + maxBytes: bigint; +} +export interface EvidenceParamsProtoMsg { + typeUrl: "/tendermint.types.EvidenceParams"; + value: Uint8Array; +} +/** EvidenceParams determine how we handle evidence of malfeasance. */ +export interface EvidenceParamsAmino { + /** + * Max age of evidence, in blocks. + * + * The basic formula for calculating this is: MaxAgeDuration / {average block + * time}. + */ + max_age_num_blocks: string; + /** + * Max age of evidence, in time. + * + * It should correspond with an app's "unbonding period" or other similar + * mechanism for handling [Nothing-At-Stake + * attacks](https://github.com/ethereum/wiki/wiki/Proof-of-Stake-FAQ#what-is-the-nothing-at-stake-problem-and-how-can-it-be-fixed). + */ + max_age_duration: DurationAmino; + /** + * This sets the maximum size of total evidence in bytes that can be committed in a single block. + * and should fall comfortably under the max block bytes. + * Default is 1048576 or 1MB + */ + max_bytes: string; +} +export interface EvidenceParamsAminoMsg { + type: "/tendermint.types.EvidenceParams"; + value: EvidenceParamsAmino; +} +/** + * ValidatorParams restrict the public key types validators can use. + * NOTE: uses ABCI pubkey naming, not Amino names. + */ +export interface ValidatorParams { + pubKeyTypes: string[]; +} +export interface ValidatorParamsProtoMsg { + typeUrl: "/tendermint.types.ValidatorParams"; + value: Uint8Array; +} +/** + * ValidatorParams restrict the public key types validators can use. + * NOTE: uses ABCI pubkey naming, not Amino names. + */ +export interface ValidatorParamsAmino { + pub_key_types: string[]; +} +export interface ValidatorParamsAminoMsg { + type: "/tendermint.types.ValidatorParams"; + value: ValidatorParamsAmino; +} +/** VersionParams contains the ABCI application version. */ +export interface VersionParams { + app: bigint; +} +export interface VersionParamsProtoMsg { + typeUrl: "/tendermint.types.VersionParams"; + value: Uint8Array; +} +/** VersionParams contains the ABCI application version. */ +export interface VersionParamsAmino { + app: string; +} +export interface VersionParamsAminoMsg { + type: "/tendermint.types.VersionParams"; + value: VersionParamsAmino; +} +/** + * HashedParams is a subset of ConsensusParams. + * + * It is hashed into the Header.ConsensusHash. + */ +export interface HashedParams { + blockMaxBytes: bigint; + blockMaxGas: bigint; +} +export interface HashedParamsProtoMsg { + typeUrl: "/tendermint.types.HashedParams"; + value: Uint8Array; +} +/** + * HashedParams is a subset of ConsensusParams. + * + * It is hashed into the Header.ConsensusHash. + */ +export interface HashedParamsAmino { + block_max_bytes: string; + block_max_gas: string; +} +export interface HashedParamsAminoMsg { + type: "/tendermint.types.HashedParams"; + value: HashedParamsAmino; +} +/** ABCIParams configure functionality specific to the Application Blockchain Interface. */ +export interface ABCIParams { + /** + * vote_extensions_enable_height configures the first height during which + * vote extensions will be enabled. During this specified height, and for all + * subsequent heights, precommit messages that do not contain valid extension data + * will be considered invalid. Prior to this height, vote extensions will not + * be used or accepted by validators on the network. + * + * Once enabled, vote extensions will be created by the application in ExtendVote, + * passed to the application for validation in VerifyVoteExtension and given + * to the application to use when proposing a block during PrepareProposal. + */ + voteExtensionsEnableHeight: bigint; +} +export interface ABCIParamsProtoMsg { + typeUrl: "/tendermint.types.ABCIParams"; + value: Uint8Array; +} +/** ABCIParams configure functionality specific to the Application Blockchain Interface. */ +export interface ABCIParamsAmino { + /** + * vote_extensions_enable_height configures the first height during which + * vote extensions will be enabled. During this specified height, and for all + * subsequent heights, precommit messages that do not contain valid extension data + * will be considered invalid. Prior to this height, vote extensions will not + * be used or accepted by validators on the network. + * + * Once enabled, vote extensions will be created by the application in ExtendVote, + * passed to the application for validation in VerifyVoteExtension and given + * to the application to use when proposing a block during PrepareProposal. + */ + vote_extensions_enable_height: string; +} +export interface ABCIParamsAminoMsg { + type: "/tendermint.types.ABCIParams"; + value: ABCIParamsAmino; +} +function createBaseConsensusParams(): ConsensusParams { + return { + block: undefined, + evidence: undefined, + validator: undefined, + version: undefined, + abci: undefined + }; +} +export const ConsensusParams = { + typeUrl: "/tendermint.types.ConsensusParams", + is(o: any): o is ConsensusParams { + return o && o.$typeUrl === ConsensusParams.typeUrl; + }, + isAmino(o: any): o is ConsensusParamsAmino { + return o && o.$typeUrl === ConsensusParams.typeUrl; + }, + encode(message: ConsensusParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.block !== undefined) { + BlockParams.encode(message.block, writer.uint32(10).fork()).ldelim(); + } + if (message.evidence !== undefined) { + EvidenceParams.encode(message.evidence, writer.uint32(18).fork()).ldelim(); + } + if (message.validator !== undefined) { + ValidatorParams.encode(message.validator, writer.uint32(26).fork()).ldelim(); + } + if (message.version !== undefined) { + VersionParams.encode(message.version, writer.uint32(34).fork()).ldelim(); + } + if (message.abci !== undefined) { + ABCIParams.encode(message.abci, writer.uint32(42).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ConsensusParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConsensusParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.block = BlockParams.decode(reader, reader.uint32()); + break; + case 2: + message.evidence = EvidenceParams.decode(reader, reader.uint32()); + break; + case 3: + message.validator = ValidatorParams.decode(reader, reader.uint32()); + break; + case 4: + message.version = VersionParams.decode(reader, reader.uint32()); + break; + case 5: + message.abci = ABCIParams.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ConsensusParams { + const message = createBaseConsensusParams(); + message.block = object.block !== undefined && object.block !== null ? BlockParams.fromPartial(object.block) : undefined; + message.evidence = object.evidence !== undefined && object.evidence !== null ? EvidenceParams.fromPartial(object.evidence) : undefined; + message.validator = object.validator !== undefined && object.validator !== null ? ValidatorParams.fromPartial(object.validator) : undefined; + message.version = object.version !== undefined && object.version !== null ? VersionParams.fromPartial(object.version) : undefined; + message.abci = object.abci !== undefined && object.abci !== null ? ABCIParams.fromPartial(object.abci) : undefined; + return message; + }, + fromAmino(object: ConsensusParamsAmino): ConsensusParams { + const message = createBaseConsensusParams(); + if (object.block !== undefined && object.block !== null) { + message.block = BlockParams.fromAmino(object.block); + } + if (object.evidence !== undefined && object.evidence !== null) { + message.evidence = EvidenceParams.fromAmino(object.evidence); + } + if (object.validator !== undefined && object.validator !== null) { + message.validator = ValidatorParams.fromAmino(object.validator); + } + if (object.version !== undefined && object.version !== null) { + message.version = VersionParams.fromAmino(object.version); + } + if (object.abci !== undefined && object.abci !== null) { + message.abci = ABCIParams.fromAmino(object.abci); + } + return message; + }, + toAmino(message: ConsensusParams): ConsensusParamsAmino { + const obj: any = {}; + obj.block = message.block ? BlockParams.toAmino(message.block) : undefined; + obj.evidence = message.evidence ? EvidenceParams.toAmino(message.evidence) : undefined; + obj.validator = message.validator ? ValidatorParams.toAmino(message.validator) : undefined; + obj.version = message.version ? VersionParams.toAmino(message.version) : undefined; + obj.abci = message.abci ? ABCIParams.toAmino(message.abci) : undefined; + return obj; + }, + fromAminoMsg(object: ConsensusParamsAminoMsg): ConsensusParams { + return ConsensusParams.fromAmino(object.value); + }, + fromProtoMsg(message: ConsensusParamsProtoMsg): ConsensusParams { + return ConsensusParams.decode(message.value); + }, + toProto(message: ConsensusParams): Uint8Array { + return ConsensusParams.encode(message).finish(); + }, + toProtoMsg(message: ConsensusParams): ConsensusParamsProtoMsg { + return { + typeUrl: "/tendermint.types.ConsensusParams", + value: ConsensusParams.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ConsensusParams.typeUrl, ConsensusParams); +function createBaseBlockParams(): BlockParams { + return { + maxBytes: BigInt(0), + maxGas: BigInt(0) + }; +} +export const BlockParams = { + typeUrl: "/tendermint.types.BlockParams", + is(o: any): o is BlockParams { + return o && (o.$typeUrl === BlockParams.typeUrl || typeof o.maxBytes === "bigint" && typeof o.maxGas === "bigint"); + }, + isAmino(o: any): o is BlockParamsAmino { + return o && (o.$typeUrl === BlockParams.typeUrl || typeof o.max_bytes === "bigint" && typeof o.max_gas === "bigint"); + }, + encode(message: BlockParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.maxBytes !== BigInt(0)) { + writer.uint32(8).int64(message.maxBytes); + } + if (message.maxGas !== BigInt(0)) { + writer.uint32(16).int64(message.maxGas); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): BlockParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.maxBytes = reader.int64(); + break; + case 2: + message.maxGas = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): BlockParams { + const message = createBaseBlockParams(); + message.maxBytes = object.maxBytes !== undefined && object.maxBytes !== null ? BigInt(object.maxBytes.toString()) : BigInt(0); + message.maxGas = object.maxGas !== undefined && object.maxGas !== null ? BigInt(object.maxGas.toString()) : BigInt(0); + return message; + }, + fromAmino(object: BlockParamsAmino): BlockParams { + const message = createBaseBlockParams(); + if (object.max_bytes !== undefined && object.max_bytes !== null) { + message.maxBytes = BigInt(object.max_bytes); + } + if (object.max_gas !== undefined && object.max_gas !== null) { + message.maxGas = BigInt(object.max_gas); + } + return message; + }, + toAmino(message: BlockParams): BlockParamsAmino { + const obj: any = {}; + obj.max_bytes = message.maxBytes !== BigInt(0) ? message.maxBytes?.toString() : undefined; + obj.max_gas = message.maxGas !== BigInt(0) ? message.maxGas?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: BlockParamsAminoMsg): BlockParams { + return BlockParams.fromAmino(object.value); + }, + fromProtoMsg(message: BlockParamsProtoMsg): BlockParams { + return BlockParams.decode(message.value); + }, + toProto(message: BlockParams): Uint8Array { + return BlockParams.encode(message).finish(); + }, + toProtoMsg(message: BlockParams): BlockParamsProtoMsg { + return { + typeUrl: "/tendermint.types.BlockParams", + value: BlockParams.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(BlockParams.typeUrl, BlockParams); +function createBaseEvidenceParams(): EvidenceParams { + return { + maxAgeNumBlocks: BigInt(0), + maxAgeDuration: Duration.fromPartial({}), + maxBytes: BigInt(0) + }; +} +export const EvidenceParams = { + typeUrl: "/tendermint.types.EvidenceParams", + is(o: any): o is EvidenceParams { + return o && (o.$typeUrl === EvidenceParams.typeUrl || typeof o.maxAgeNumBlocks === "bigint" && Duration.is(o.maxAgeDuration) && typeof o.maxBytes === "bigint"); + }, + isAmino(o: any): o is EvidenceParamsAmino { + return o && (o.$typeUrl === EvidenceParams.typeUrl || typeof o.max_age_num_blocks === "bigint" && Duration.isAmino(o.max_age_duration) && typeof o.max_bytes === "bigint"); + }, + encode(message: EvidenceParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.maxAgeNumBlocks !== BigInt(0)) { + writer.uint32(8).int64(message.maxAgeNumBlocks); + } + if (message.maxAgeDuration !== undefined) { + Duration.encode(message.maxAgeDuration, writer.uint32(18).fork()).ldelim(); + } + if (message.maxBytes !== BigInt(0)) { + writer.uint32(24).int64(message.maxBytes); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EvidenceParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvidenceParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.maxAgeNumBlocks = reader.int64(); + break; + case 2: + message.maxAgeDuration = Duration.decode(reader, reader.uint32()); + break; + case 3: + message.maxBytes = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): EvidenceParams { + const message = createBaseEvidenceParams(); + message.maxAgeNumBlocks = object.maxAgeNumBlocks !== undefined && object.maxAgeNumBlocks !== null ? BigInt(object.maxAgeNumBlocks.toString()) : BigInt(0); + message.maxAgeDuration = object.maxAgeDuration !== undefined && object.maxAgeDuration !== null ? Duration.fromPartial(object.maxAgeDuration) : undefined; + message.maxBytes = object.maxBytes !== undefined && object.maxBytes !== null ? BigInt(object.maxBytes.toString()) : BigInt(0); + return message; + }, + fromAmino(object: EvidenceParamsAmino): EvidenceParams { + const message = createBaseEvidenceParams(); + if (object.max_age_num_blocks !== undefined && object.max_age_num_blocks !== null) { + message.maxAgeNumBlocks = BigInt(object.max_age_num_blocks); + } + if (object.max_age_duration !== undefined && object.max_age_duration !== null) { + message.maxAgeDuration = Duration.fromAmino(object.max_age_duration); + } + if (object.max_bytes !== undefined && object.max_bytes !== null) { + message.maxBytes = BigInt(object.max_bytes); + } + return message; + }, + toAmino(message: EvidenceParams): EvidenceParamsAmino { + const obj: any = {}; + obj.max_age_num_blocks = message.maxAgeNumBlocks !== BigInt(0) ? message.maxAgeNumBlocks?.toString() : undefined; + obj.max_age_duration = message.maxAgeDuration ? Duration.toAmino(message.maxAgeDuration) : undefined; + obj.max_bytes = message.maxBytes !== BigInt(0) ? message.maxBytes?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: EvidenceParamsAminoMsg): EvidenceParams { + return EvidenceParams.fromAmino(object.value); + }, + fromProtoMsg(message: EvidenceParamsProtoMsg): EvidenceParams { + return EvidenceParams.decode(message.value); + }, + toProto(message: EvidenceParams): Uint8Array { + return EvidenceParams.encode(message).finish(); + }, + toProtoMsg(message: EvidenceParams): EvidenceParamsProtoMsg { + return { + typeUrl: "/tendermint.types.EvidenceParams", + value: EvidenceParams.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(EvidenceParams.typeUrl, EvidenceParams); +function createBaseValidatorParams(): ValidatorParams { + return { + pubKeyTypes: [] + }; +} +export const ValidatorParams = { + typeUrl: "/tendermint.types.ValidatorParams", + is(o: any): o is ValidatorParams { + return o && (o.$typeUrl === ValidatorParams.typeUrl || Array.isArray(o.pubKeyTypes) && (!o.pubKeyTypes.length || typeof o.pubKeyTypes[0] === "string")); + }, + isAmino(o: any): o is ValidatorParamsAmino { + return o && (o.$typeUrl === ValidatorParams.typeUrl || Array.isArray(o.pub_key_types) && (!o.pub_key_types.length || typeof o.pub_key_types[0] === "string")); + }, + encode(message: ValidatorParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.pubKeyTypes) { + writer.uint32(10).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pubKeyTypes.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ValidatorParams { + const message = createBaseValidatorParams(); + message.pubKeyTypes = object.pubKeyTypes?.map(e => e) || []; + return message; + }, + fromAmino(object: ValidatorParamsAmino): ValidatorParams { + const message = createBaseValidatorParams(); + message.pubKeyTypes = object.pub_key_types?.map(e => e) || []; + return message; + }, + toAmino(message: ValidatorParams): ValidatorParamsAmino { + const obj: any = {}; + if (message.pubKeyTypes) { + obj.pub_key_types = message.pubKeyTypes.map(e => e); + } else { + obj.pub_key_types = message.pubKeyTypes; + } + return obj; + }, + fromAminoMsg(object: ValidatorParamsAminoMsg): ValidatorParams { + return ValidatorParams.fromAmino(object.value); + }, + fromProtoMsg(message: ValidatorParamsProtoMsg): ValidatorParams { + return ValidatorParams.decode(message.value); + }, + toProto(message: ValidatorParams): Uint8Array { + return ValidatorParams.encode(message).finish(); + }, + toProtoMsg(message: ValidatorParams): ValidatorParamsProtoMsg { + return { + typeUrl: "/tendermint.types.ValidatorParams", + value: ValidatorParams.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ValidatorParams.typeUrl, ValidatorParams); +function createBaseVersionParams(): VersionParams { + return { + app: BigInt(0) + }; +} +export const VersionParams = { + typeUrl: "/tendermint.types.VersionParams", + is(o: any): o is VersionParams { + return o && (o.$typeUrl === VersionParams.typeUrl || typeof o.app === "bigint"); + }, + isAmino(o: any): o is VersionParamsAmino { + return o && (o.$typeUrl === VersionParams.typeUrl || typeof o.app === "bigint"); + }, + encode(message: VersionParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.app !== BigInt(0)) { + writer.uint32(8).uint64(message.app); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): VersionParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVersionParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.app = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): VersionParams { + const message = createBaseVersionParams(); + message.app = object.app !== undefined && object.app !== null ? BigInt(object.app.toString()) : BigInt(0); + return message; + }, + fromAmino(object: VersionParamsAmino): VersionParams { + const message = createBaseVersionParams(); + if (object.app !== undefined && object.app !== null) { + message.app = BigInt(object.app); + } + return message; + }, + toAmino(message: VersionParams): VersionParamsAmino { + const obj: any = {}; + obj.app = message.app !== BigInt(0) ? message.app?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: VersionParamsAminoMsg): VersionParams { + return VersionParams.fromAmino(object.value); + }, + fromProtoMsg(message: VersionParamsProtoMsg): VersionParams { + return VersionParams.decode(message.value); + }, + toProto(message: VersionParams): Uint8Array { + return VersionParams.encode(message).finish(); + }, + toProtoMsg(message: VersionParams): VersionParamsProtoMsg { + return { + typeUrl: "/tendermint.types.VersionParams", + value: VersionParams.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(VersionParams.typeUrl, VersionParams); +function createBaseHashedParams(): HashedParams { + return { + blockMaxBytes: BigInt(0), + blockMaxGas: BigInt(0) + }; +} +export const HashedParams = { + typeUrl: "/tendermint.types.HashedParams", + is(o: any): o is HashedParams { + return o && (o.$typeUrl === HashedParams.typeUrl || typeof o.blockMaxBytes === "bigint" && typeof o.blockMaxGas === "bigint"); + }, + isAmino(o: any): o is HashedParamsAmino { + return o && (o.$typeUrl === HashedParams.typeUrl || typeof o.block_max_bytes === "bigint" && typeof o.block_max_gas === "bigint"); + }, + encode(message: HashedParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.blockMaxBytes !== BigInt(0)) { + writer.uint32(8).int64(message.blockMaxBytes); + } + if (message.blockMaxGas !== BigInt(0)) { + writer.uint32(16).int64(message.blockMaxGas); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): HashedParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHashedParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.blockMaxBytes = reader.int64(); + break; + case 2: + message.blockMaxGas = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): HashedParams { + const message = createBaseHashedParams(); + message.blockMaxBytes = object.blockMaxBytes !== undefined && object.blockMaxBytes !== null ? BigInt(object.blockMaxBytes.toString()) : BigInt(0); + message.blockMaxGas = object.blockMaxGas !== undefined && object.blockMaxGas !== null ? BigInt(object.blockMaxGas.toString()) : BigInt(0); + return message; + }, + fromAmino(object: HashedParamsAmino): HashedParams { + const message = createBaseHashedParams(); + if (object.block_max_bytes !== undefined && object.block_max_bytes !== null) { + message.blockMaxBytes = BigInt(object.block_max_bytes); + } + if (object.block_max_gas !== undefined && object.block_max_gas !== null) { + message.blockMaxGas = BigInt(object.block_max_gas); + } + return message; + }, + toAmino(message: HashedParams): HashedParamsAmino { + const obj: any = {}; + obj.block_max_bytes = message.blockMaxBytes !== BigInt(0) ? message.blockMaxBytes?.toString() : undefined; + obj.block_max_gas = message.blockMaxGas !== BigInt(0) ? message.blockMaxGas?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: HashedParamsAminoMsg): HashedParams { + return HashedParams.fromAmino(object.value); + }, + fromProtoMsg(message: HashedParamsProtoMsg): HashedParams { + return HashedParams.decode(message.value); + }, + toProto(message: HashedParams): Uint8Array { + return HashedParams.encode(message).finish(); + }, + toProtoMsg(message: HashedParams): HashedParamsProtoMsg { + return { + typeUrl: "/tendermint.types.HashedParams", + value: HashedParams.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(HashedParams.typeUrl, HashedParams); +function createBaseABCIParams(): ABCIParams { + return { + voteExtensionsEnableHeight: BigInt(0) + }; +} +export const ABCIParams = { + typeUrl: "/tendermint.types.ABCIParams", + is(o: any): o is ABCIParams { + return o && (o.$typeUrl === ABCIParams.typeUrl || typeof o.voteExtensionsEnableHeight === "bigint"); + }, + isAmino(o: any): o is ABCIParamsAmino { + return o && (o.$typeUrl === ABCIParams.typeUrl || typeof o.vote_extensions_enable_height === "bigint"); + }, + encode(message: ABCIParams, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.voteExtensionsEnableHeight !== BigInt(0)) { + writer.uint32(8).int64(message.voteExtensionsEnableHeight); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ABCIParams { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseABCIParams(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.voteExtensionsEnableHeight = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ABCIParams { + const message = createBaseABCIParams(); + message.voteExtensionsEnableHeight = object.voteExtensionsEnableHeight !== undefined && object.voteExtensionsEnableHeight !== null ? BigInt(object.voteExtensionsEnableHeight.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ABCIParamsAmino): ABCIParams { + const message = createBaseABCIParams(); + if (object.vote_extensions_enable_height !== undefined && object.vote_extensions_enable_height !== null) { + message.voteExtensionsEnableHeight = BigInt(object.vote_extensions_enable_height); + } + return message; + }, + toAmino(message: ABCIParams): ABCIParamsAmino { + const obj: any = {}; + obj.vote_extensions_enable_height = message.voteExtensionsEnableHeight !== BigInt(0) ? message.voteExtensionsEnableHeight?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ABCIParamsAminoMsg): ABCIParams { + return ABCIParams.fromAmino(object.value); + }, + fromProtoMsg(message: ABCIParamsProtoMsg): ABCIParams { + return ABCIParams.decode(message.value); + }, + toProto(message: ABCIParams): Uint8Array { + return ABCIParams.encode(message).finish(); + }, + toProtoMsg(message: ABCIParams): ABCIParamsProtoMsg { + return { + typeUrl: "/tendermint.types.ABCIParams", + value: ABCIParams.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ABCIParams.typeUrl, ABCIParams); \ No newline at end of file diff --git a/libs/interchain-query/src/tendermint/types/types.ts b/libs/interchain-query/src/tendermint/types/types.ts new file mode 100644 index 00000000..c44fd8af --- /dev/null +++ b/libs/interchain-query/src/tendermint/types/types.ts @@ -0,0 +1,2157 @@ +import { Proof, ProofAmino } from "../crypto/proof"; +import { Consensus, ConsensusAmino } from "../version/types"; +import { Timestamp } from "../../google/protobuf/timestamp"; +import { BlockIDFlag, ValidatorSet, ValidatorSetAmino } from "./validator"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes, toTimestamp, fromTimestamp, isSet } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; +/** SignedMsgType is a type of signed message in the consensus. */ +export enum SignedMsgType { + SIGNED_MSG_TYPE_UNKNOWN = 0, + /** SIGNED_MSG_TYPE_PREVOTE - Votes */ + SIGNED_MSG_TYPE_PREVOTE = 1, + SIGNED_MSG_TYPE_PRECOMMIT = 2, + /** SIGNED_MSG_TYPE_PROPOSAL - Proposals */ + SIGNED_MSG_TYPE_PROPOSAL = 32, + UNRECOGNIZED = -1, +} +export const SignedMsgTypeAmino = SignedMsgType; +export function signedMsgTypeFromJSON(object: any): SignedMsgType { + switch (object) { + case 0: + case "SIGNED_MSG_TYPE_UNKNOWN": + return SignedMsgType.SIGNED_MSG_TYPE_UNKNOWN; + case 1: + case "SIGNED_MSG_TYPE_PREVOTE": + return SignedMsgType.SIGNED_MSG_TYPE_PREVOTE; + case 2: + case "SIGNED_MSG_TYPE_PRECOMMIT": + return SignedMsgType.SIGNED_MSG_TYPE_PRECOMMIT; + case 32: + case "SIGNED_MSG_TYPE_PROPOSAL": + return SignedMsgType.SIGNED_MSG_TYPE_PROPOSAL; + case -1: + case "UNRECOGNIZED": + default: + return SignedMsgType.UNRECOGNIZED; + } +} +export function signedMsgTypeToJSON(object: SignedMsgType): string { + switch (object) { + case SignedMsgType.SIGNED_MSG_TYPE_UNKNOWN: + return "SIGNED_MSG_TYPE_UNKNOWN"; + case SignedMsgType.SIGNED_MSG_TYPE_PREVOTE: + return "SIGNED_MSG_TYPE_PREVOTE"; + case SignedMsgType.SIGNED_MSG_TYPE_PRECOMMIT: + return "SIGNED_MSG_TYPE_PRECOMMIT"; + case SignedMsgType.SIGNED_MSG_TYPE_PROPOSAL: + return "SIGNED_MSG_TYPE_PROPOSAL"; + case SignedMsgType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** PartsetHeader */ +export interface PartSetHeader { + total: number; + hash: Uint8Array; +} +export interface PartSetHeaderProtoMsg { + typeUrl: "/tendermint.types.PartSetHeader"; + value: Uint8Array; +} +/** PartsetHeader */ +export interface PartSetHeaderAmino { + total: number; + hash: string; +} +export interface PartSetHeaderAminoMsg { + type: "/tendermint.types.PartSetHeader"; + value: PartSetHeaderAmino; +} +export interface Part { + index: number; + bytes: Uint8Array; + proof: Proof; +} +export interface PartProtoMsg { + typeUrl: "/tendermint.types.Part"; + value: Uint8Array; +} +export interface PartAmino { + index: number; + bytes: string; + proof: ProofAmino; +} +export interface PartAminoMsg { + type: "/tendermint.types.Part"; + value: PartAmino; +} +/** BlockID */ +export interface BlockID { + hash: Uint8Array; + partSetHeader: PartSetHeader; +} +export interface BlockIDProtoMsg { + typeUrl: "/tendermint.types.BlockID"; + value: Uint8Array; +} +/** BlockID */ +export interface BlockIDAmino { + hash: string; + part_set_header: PartSetHeaderAmino; +} +export interface BlockIDAminoMsg { + type: "/tendermint.types.BlockID"; + value: BlockIDAmino; +} +/** Header defines the structure of a block header. */ +export interface Header { + /** basic block info */ + version: Consensus; + chainId: string; + height: bigint; + time: Date; + /** prev block info */ + lastBlockId: BlockID; + /** hashes of block data */ + lastCommitHash: Uint8Array; + /** transactions */ + dataHash: Uint8Array; + /** hashes from the app output from the prev block */ + validatorsHash: Uint8Array; + /** validators for the next block */ + nextValidatorsHash: Uint8Array; + /** consensus params for current block */ + consensusHash: Uint8Array; + /** state after txs from the previous block */ + appHash: Uint8Array; + /** root hash of all results from the txs from the previous block */ + lastResultsHash: Uint8Array; + /** consensus info */ + evidenceHash: Uint8Array; + /** original proposer of the block */ + proposerAddress: Uint8Array; +} +export interface HeaderProtoMsg { + typeUrl: "/tendermint.types.Header"; + value: Uint8Array; +} +/** Header defines the structure of a block header. */ +export interface HeaderAmino { + /** basic block info */ + version: ConsensusAmino; + chain_id: string; + height: string; + time: string; + /** prev block info */ + last_block_id: BlockIDAmino; + /** hashes of block data */ + last_commit_hash: string; + /** transactions */ + data_hash: string; + /** hashes from the app output from the prev block */ + validators_hash: string; + /** validators for the next block */ + next_validators_hash: string; + /** consensus params for current block */ + consensus_hash: string; + /** state after txs from the previous block */ + app_hash: string; + /** root hash of all results from the txs from the previous block */ + last_results_hash: string; + /** consensus info */ + evidence_hash: string; + /** original proposer of the block */ + proposer_address: string; +} +export interface HeaderAminoMsg { + type: "/tendermint.types.Header"; + value: HeaderAmino; +} +/** Data contains the set of transactions included in the block */ +export interface Data { + /** + * Txs that will be applied by state @ block.Height+1. + * NOTE: not all txs here are valid. We're just agreeing on the order first. + * This means that block.AppHash does not include these txs. + */ + txs: Uint8Array[]; +} +export interface DataProtoMsg { + typeUrl: "/tendermint.types.Data"; + value: Uint8Array; +} +/** Data contains the set of transactions included in the block */ +export interface DataAmino { + /** + * Txs that will be applied by state @ block.Height+1. + * NOTE: not all txs here are valid. We're just agreeing on the order first. + * This means that block.AppHash does not include these txs. + */ + txs: string[]; +} +export interface DataAminoMsg { + type: "/tendermint.types.Data"; + value: DataAmino; +} +/** + * Vote represents a prevote or precommit vote from validators for + * consensus. + */ +export interface Vote { + type: SignedMsgType; + height: bigint; + round: number; + /** zero if vote is nil. */ + blockId: BlockID; + timestamp: Date; + validatorAddress: Uint8Array; + validatorIndex: number; + /** + * Vote signature by the validator if they participated in consensus for the + * associated block. + */ + signature: Uint8Array; + /** + * Vote extension provided by the application. Only valid for precommit + * messages. + */ + extension: Uint8Array; + /** + * Vote extension signature by the validator if they participated in + * consensus for the associated block. + * Only valid for precommit messages. + */ + extensionSignature: Uint8Array; +} +export interface VoteProtoMsg { + typeUrl: "/tendermint.types.Vote"; + value: Uint8Array; +} +/** + * Vote represents a prevote or precommit vote from validators for + * consensus. + */ +export interface VoteAmino { + type: SignedMsgType; + height: string; + round: number; + /** zero if vote is nil. */ + block_id: BlockIDAmino; + timestamp: string; + validator_address: string; + validator_index: number; + /** + * Vote signature by the validator if they participated in consensus for the + * associated block. + */ + signature: string; + /** + * Vote extension provided by the application. Only valid for precommit + * messages. + */ + extension: string; + /** + * Vote extension signature by the validator if they participated in + * consensus for the associated block. + * Only valid for precommit messages. + */ + extension_signature: string; +} +export interface VoteAminoMsg { + type: "/tendermint.types.Vote"; + value: VoteAmino; +} +/** Commit contains the evidence that a block was committed by a set of validators. */ +export interface Commit { + height: bigint; + round: number; + blockId: BlockID; + signatures: CommitSig[]; +} +export interface CommitProtoMsg { + typeUrl: "/tendermint.types.Commit"; + value: Uint8Array; +} +/** Commit contains the evidence that a block was committed by a set of validators. */ +export interface CommitAmino { + height: string; + round: number; + block_id: BlockIDAmino; + signatures: CommitSigAmino[]; +} +export interface CommitAminoMsg { + type: "/tendermint.types.Commit"; + value: CommitAmino; +} +/** CommitSig is a part of the Vote included in a Commit. */ +export interface CommitSig { + blockIdFlag: BlockIDFlag; + validatorAddress: Uint8Array; + timestamp: Date; + signature: Uint8Array; +} +export interface CommitSigProtoMsg { + typeUrl: "/tendermint.types.CommitSig"; + value: Uint8Array; +} +/** CommitSig is a part of the Vote included in a Commit. */ +export interface CommitSigAmino { + block_id_flag: BlockIDFlag; + validator_address: string; + timestamp: string; + signature: string; +} +export interface CommitSigAminoMsg { + type: "/tendermint.types.CommitSig"; + value: CommitSigAmino; +} +export interface ExtendedCommit { + height: bigint; + round: number; + blockId: BlockID; + extendedSignatures: ExtendedCommitSig[]; +} +export interface ExtendedCommitProtoMsg { + typeUrl: "/tendermint.types.ExtendedCommit"; + value: Uint8Array; +} +export interface ExtendedCommitAmino { + height: string; + round: number; + block_id: BlockIDAmino; + extended_signatures: ExtendedCommitSigAmino[]; +} +export interface ExtendedCommitAminoMsg { + type: "/tendermint.types.ExtendedCommit"; + value: ExtendedCommitAmino; +} +/** + * ExtendedCommitSig retains all the same fields as CommitSig but adds vote + * extension-related fields. We use two signatures to ensure backwards compatibility. + * That is the digest of the original signature is still the same in prior versions + */ +export interface ExtendedCommitSig { + blockIdFlag: BlockIDFlag; + validatorAddress: Uint8Array; + timestamp: Date; + signature: Uint8Array; + /** Vote extension data */ + extension: Uint8Array; + /** Vote extension signature */ + extensionSignature: Uint8Array; +} +export interface ExtendedCommitSigProtoMsg { + typeUrl: "/tendermint.types.ExtendedCommitSig"; + value: Uint8Array; +} +/** + * ExtendedCommitSig retains all the same fields as CommitSig but adds vote + * extension-related fields. We use two signatures to ensure backwards compatibility. + * That is the digest of the original signature is still the same in prior versions + */ +export interface ExtendedCommitSigAmino { + block_id_flag: BlockIDFlag; + validator_address: string; + timestamp: string; + signature: string; + /** Vote extension data */ + extension: string; + /** Vote extension signature */ + extension_signature: string; +} +export interface ExtendedCommitSigAminoMsg { + type: "/tendermint.types.ExtendedCommitSig"; + value: ExtendedCommitSigAmino; +} +export interface Proposal { + type: SignedMsgType; + height: bigint; + round: number; + polRound: number; + blockId: BlockID; + timestamp: Date; + signature: Uint8Array; +} +export interface ProposalProtoMsg { + typeUrl: "/tendermint.types.Proposal"; + value: Uint8Array; +} +export interface ProposalAmino { + type: SignedMsgType; + height: string; + round: number; + pol_round: number; + block_id: BlockIDAmino; + timestamp: string; + signature: string; +} +export interface ProposalAminoMsg { + type: "/tendermint.types.Proposal"; + value: ProposalAmino; +} +export interface SignedHeader { + header?: Header; + commit?: Commit; +} +export interface SignedHeaderProtoMsg { + typeUrl: "/tendermint.types.SignedHeader"; + value: Uint8Array; +} +export interface SignedHeaderAmino { + header?: HeaderAmino; + commit?: CommitAmino; +} +export interface SignedHeaderAminoMsg { + type: "/tendermint.types.SignedHeader"; + value: SignedHeaderAmino; +} +export interface LightBlock { + signedHeader?: SignedHeader; + validatorSet?: ValidatorSet; +} +export interface LightBlockProtoMsg { + typeUrl: "/tendermint.types.LightBlock"; + value: Uint8Array; +} +export interface LightBlockAmino { + signed_header?: SignedHeaderAmino; + validator_set?: ValidatorSetAmino; +} +export interface LightBlockAminoMsg { + type: "/tendermint.types.LightBlock"; + value: LightBlockAmino; +} +export interface BlockMeta { + blockId: BlockID; + blockSize: bigint; + header: Header; + numTxs: bigint; +} +export interface BlockMetaProtoMsg { + typeUrl: "/tendermint.types.BlockMeta"; + value: Uint8Array; +} +export interface BlockMetaAmino { + block_id: BlockIDAmino; + block_size: string; + header: HeaderAmino; + num_txs: string; +} +export interface BlockMetaAminoMsg { + type: "/tendermint.types.BlockMeta"; + value: BlockMetaAmino; +} +/** TxProof represents a Merkle proof of the presence of a transaction in the Merkle tree. */ +export interface TxProof { + rootHash: Uint8Array; + data: Uint8Array; + proof?: Proof; +} +export interface TxProofProtoMsg { + typeUrl: "/tendermint.types.TxProof"; + value: Uint8Array; +} +/** TxProof represents a Merkle proof of the presence of a transaction in the Merkle tree. */ +export interface TxProofAmino { + root_hash: string; + data: string; + proof?: ProofAmino; +} +export interface TxProofAminoMsg { + type: "/tendermint.types.TxProof"; + value: TxProofAmino; +} +function createBasePartSetHeader(): PartSetHeader { + return { + total: 0, + hash: new Uint8Array() + }; +} +export const PartSetHeader = { + typeUrl: "/tendermint.types.PartSetHeader", + is(o: any): o is PartSetHeader { + return o && (o.$typeUrl === PartSetHeader.typeUrl || typeof o.total === "number" && (o.hash instanceof Uint8Array || typeof o.hash === "string")); + }, + isAmino(o: any): o is PartSetHeaderAmino { + return o && (o.$typeUrl === PartSetHeader.typeUrl || typeof o.total === "number" && (o.hash instanceof Uint8Array || typeof o.hash === "string")); + }, + encode(message: PartSetHeader, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.total !== 0) { + writer.uint32(8).uint32(message.total); + } + if (message.hash.length !== 0) { + writer.uint32(18).bytes(message.hash); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): PartSetHeader { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePartSetHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.total = reader.uint32(); + break; + case 2: + message.hash = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): PartSetHeader { + const message = createBasePartSetHeader(); + message.total = object.total ?? 0; + message.hash = object.hash ?? new Uint8Array(); + return message; + }, + fromAmino(object: PartSetHeaderAmino): PartSetHeader { + const message = createBasePartSetHeader(); + if (object.total !== undefined && object.total !== null) { + message.total = object.total; + } + if (object.hash !== undefined && object.hash !== null) { + message.hash = bytesFromBase64(object.hash); + } + return message; + }, + toAmino(message: PartSetHeader): PartSetHeaderAmino { + const obj: any = {}; + obj.total = message.total === 0 ? undefined : message.total; + obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; + return obj; + }, + fromAminoMsg(object: PartSetHeaderAminoMsg): PartSetHeader { + return PartSetHeader.fromAmino(object.value); + }, + fromProtoMsg(message: PartSetHeaderProtoMsg): PartSetHeader { + return PartSetHeader.decode(message.value); + }, + toProto(message: PartSetHeader): Uint8Array { + return PartSetHeader.encode(message).finish(); + }, + toProtoMsg(message: PartSetHeader): PartSetHeaderProtoMsg { + return { + typeUrl: "/tendermint.types.PartSetHeader", + value: PartSetHeader.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(PartSetHeader.typeUrl, PartSetHeader); +function createBasePart(): Part { + return { + index: 0, + bytes: new Uint8Array(), + proof: Proof.fromPartial({}) + }; +} +export const Part = { + typeUrl: "/tendermint.types.Part", + is(o: any): o is Part { + return o && (o.$typeUrl === Part.typeUrl || typeof o.index === "number" && (o.bytes instanceof Uint8Array || typeof o.bytes === "string") && Proof.is(o.proof)); + }, + isAmino(o: any): o is PartAmino { + return o && (o.$typeUrl === Part.typeUrl || typeof o.index === "number" && (o.bytes instanceof Uint8Array || typeof o.bytes === "string") && Proof.isAmino(o.proof)); + }, + encode(message: Part, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.index !== 0) { + writer.uint32(8).uint32(message.index); + } + if (message.bytes.length !== 0) { + writer.uint32(18).bytes(message.bytes); + } + if (message.proof !== undefined) { + Proof.encode(message.proof, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Part { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePart(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.index = reader.uint32(); + break; + case 2: + message.bytes = reader.bytes(); + break; + case 3: + message.proof = Proof.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Part { + const message = createBasePart(); + message.index = object.index ?? 0; + message.bytes = object.bytes ?? new Uint8Array(); + message.proof = object.proof !== undefined && object.proof !== null ? Proof.fromPartial(object.proof) : undefined; + return message; + }, + fromAmino(object: PartAmino): Part { + const message = createBasePart(); + if (object.index !== undefined && object.index !== null) { + message.index = object.index; + } + if (object.bytes !== undefined && object.bytes !== null) { + message.bytes = bytesFromBase64(object.bytes); + } + if (object.proof !== undefined && object.proof !== null) { + message.proof = Proof.fromAmino(object.proof); + } + return message; + }, + toAmino(message: Part): PartAmino { + const obj: any = {}; + obj.index = message.index === 0 ? undefined : message.index; + obj.bytes = message.bytes ? base64FromBytes(message.bytes) : undefined; + obj.proof = message.proof ? Proof.toAmino(message.proof) : undefined; + return obj; + }, + fromAminoMsg(object: PartAminoMsg): Part { + return Part.fromAmino(object.value); + }, + fromProtoMsg(message: PartProtoMsg): Part { + return Part.decode(message.value); + }, + toProto(message: Part): Uint8Array { + return Part.encode(message).finish(); + }, + toProtoMsg(message: Part): PartProtoMsg { + return { + typeUrl: "/tendermint.types.Part", + value: Part.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Part.typeUrl, Part); +function createBaseBlockID(): BlockID { + return { + hash: new Uint8Array(), + partSetHeader: PartSetHeader.fromPartial({}) + }; +} +export const BlockID = { + typeUrl: "/tendermint.types.BlockID", + is(o: any): o is BlockID { + return o && (o.$typeUrl === BlockID.typeUrl || (o.hash instanceof Uint8Array || typeof o.hash === "string") && PartSetHeader.is(o.partSetHeader)); + }, + isAmino(o: any): o is BlockIDAmino { + return o && (o.$typeUrl === BlockID.typeUrl || (o.hash instanceof Uint8Array || typeof o.hash === "string") && PartSetHeader.isAmino(o.part_set_header)); + }, + encode(message: BlockID, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.hash.length !== 0) { + writer.uint32(10).bytes(message.hash); + } + if (message.partSetHeader !== undefined) { + PartSetHeader.encode(message.partSetHeader, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): BlockID { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockID(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.hash = reader.bytes(); + break; + case 2: + message.partSetHeader = PartSetHeader.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): BlockID { + const message = createBaseBlockID(); + message.hash = object.hash ?? new Uint8Array(); + message.partSetHeader = object.partSetHeader !== undefined && object.partSetHeader !== null ? PartSetHeader.fromPartial(object.partSetHeader) : undefined; + return message; + }, + fromAmino(object: BlockIDAmino): BlockID { + const message = createBaseBlockID(); + if (object.hash !== undefined && object.hash !== null) { + message.hash = bytesFromBase64(object.hash); + } + if (object.part_set_header !== undefined && object.part_set_header !== null) { + message.partSetHeader = PartSetHeader.fromAmino(object.part_set_header); + } + return message; + }, + toAmino(message: BlockID): BlockIDAmino { + const obj: any = {}; + obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; + obj.part_set_header = message.partSetHeader ? PartSetHeader.toAmino(message.partSetHeader) : undefined; + return obj; + }, + fromAminoMsg(object: BlockIDAminoMsg): BlockID { + return BlockID.fromAmino(object.value); + }, + fromProtoMsg(message: BlockIDProtoMsg): BlockID { + return BlockID.decode(message.value); + }, + toProto(message: BlockID): Uint8Array { + return BlockID.encode(message).finish(); + }, + toProtoMsg(message: BlockID): BlockIDProtoMsg { + return { + typeUrl: "/tendermint.types.BlockID", + value: BlockID.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(BlockID.typeUrl, BlockID); +function createBaseHeader(): Header { + return { + version: Consensus.fromPartial({}), + chainId: "", + height: BigInt(0), + time: new Date(), + lastBlockId: BlockID.fromPartial({}), + lastCommitHash: new Uint8Array(), + dataHash: new Uint8Array(), + validatorsHash: new Uint8Array(), + nextValidatorsHash: new Uint8Array(), + consensusHash: new Uint8Array(), + appHash: new Uint8Array(), + lastResultsHash: new Uint8Array(), + evidenceHash: new Uint8Array(), + proposerAddress: new Uint8Array() + }; +} +export const Header = { + typeUrl: "/tendermint.types.Header", + is(o: any): o is Header { + return o && (o.$typeUrl === Header.typeUrl || Consensus.is(o.version) && typeof o.chainId === "string" && typeof o.height === "bigint" && Timestamp.is(o.time) && BlockID.is(o.lastBlockId) && (o.lastCommitHash instanceof Uint8Array || typeof o.lastCommitHash === "string") && (o.dataHash instanceof Uint8Array || typeof o.dataHash === "string") && (o.validatorsHash instanceof Uint8Array || typeof o.validatorsHash === "string") && (o.nextValidatorsHash instanceof Uint8Array || typeof o.nextValidatorsHash === "string") && (o.consensusHash instanceof Uint8Array || typeof o.consensusHash === "string") && (o.appHash instanceof Uint8Array || typeof o.appHash === "string") && (o.lastResultsHash instanceof Uint8Array || typeof o.lastResultsHash === "string") && (o.evidenceHash instanceof Uint8Array || typeof o.evidenceHash === "string") && (o.proposerAddress instanceof Uint8Array || typeof o.proposerAddress === "string")); + }, + isAmino(o: any): o is HeaderAmino { + return o && (o.$typeUrl === Header.typeUrl || Consensus.isAmino(o.version) && typeof o.chain_id === "string" && typeof o.height === "bigint" && Timestamp.isAmino(o.time) && BlockID.isAmino(o.last_block_id) && (o.last_commit_hash instanceof Uint8Array || typeof o.last_commit_hash === "string") && (o.data_hash instanceof Uint8Array || typeof o.data_hash === "string") && (o.validators_hash instanceof Uint8Array || typeof o.validators_hash === "string") && (o.next_validators_hash instanceof Uint8Array || typeof o.next_validators_hash === "string") && (o.consensus_hash instanceof Uint8Array || typeof o.consensus_hash === "string") && (o.app_hash instanceof Uint8Array || typeof o.app_hash === "string") && (o.last_results_hash instanceof Uint8Array || typeof o.last_results_hash === "string") && (o.evidence_hash instanceof Uint8Array || typeof o.evidence_hash === "string") && (o.proposer_address instanceof Uint8Array || typeof o.proposer_address === "string")); + }, + encode(message: Header, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.version !== undefined) { + Consensus.encode(message.version, writer.uint32(10).fork()).ldelim(); + } + if (message.chainId !== "") { + writer.uint32(18).string(message.chainId); + } + if (message.height !== BigInt(0)) { + writer.uint32(24).int64(message.height); + } + if (message.time !== undefined) { + Timestamp.encode(toTimestamp(message.time), writer.uint32(34).fork()).ldelim(); + } + if (message.lastBlockId !== undefined) { + BlockID.encode(message.lastBlockId, writer.uint32(42).fork()).ldelim(); + } + if (message.lastCommitHash.length !== 0) { + writer.uint32(50).bytes(message.lastCommitHash); + } + if (message.dataHash.length !== 0) { + writer.uint32(58).bytes(message.dataHash); + } + if (message.validatorsHash.length !== 0) { + writer.uint32(66).bytes(message.validatorsHash); + } + if (message.nextValidatorsHash.length !== 0) { + writer.uint32(74).bytes(message.nextValidatorsHash); + } + if (message.consensusHash.length !== 0) { + writer.uint32(82).bytes(message.consensusHash); + } + if (message.appHash.length !== 0) { + writer.uint32(90).bytes(message.appHash); + } + if (message.lastResultsHash.length !== 0) { + writer.uint32(98).bytes(message.lastResultsHash); + } + if (message.evidenceHash.length !== 0) { + writer.uint32(106).bytes(message.evidenceHash); + } + if (message.proposerAddress.length !== 0) { + writer.uint32(114).bytes(message.proposerAddress); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Header { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.version = Consensus.decode(reader, reader.uint32()); + break; + case 2: + message.chainId = reader.string(); + break; + case 3: + message.height = reader.int64(); + break; + case 4: + message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 5: + message.lastBlockId = BlockID.decode(reader, reader.uint32()); + break; + case 6: + message.lastCommitHash = reader.bytes(); + break; + case 7: + message.dataHash = reader.bytes(); + break; + case 8: + message.validatorsHash = reader.bytes(); + break; + case 9: + message.nextValidatorsHash = reader.bytes(); + break; + case 10: + message.consensusHash = reader.bytes(); + break; + case 11: + message.appHash = reader.bytes(); + break; + case 12: + message.lastResultsHash = reader.bytes(); + break; + case 13: + message.evidenceHash = reader.bytes(); + break; + case 14: + message.proposerAddress = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial
): Header { + const message = createBaseHeader(); + message.version = object.version !== undefined && object.version !== null ? Consensus.fromPartial(object.version) : undefined; + message.chainId = object.chainId ?? ""; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.time = object.time ?? undefined; + message.lastBlockId = object.lastBlockId !== undefined && object.lastBlockId !== null ? BlockID.fromPartial(object.lastBlockId) : undefined; + message.lastCommitHash = object.lastCommitHash ?? new Uint8Array(); + message.dataHash = object.dataHash ?? new Uint8Array(); + message.validatorsHash = object.validatorsHash ?? new Uint8Array(); + message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array(); + message.consensusHash = object.consensusHash ?? new Uint8Array(); + message.appHash = object.appHash ?? new Uint8Array(); + message.lastResultsHash = object.lastResultsHash ?? new Uint8Array(); + message.evidenceHash = object.evidenceHash ?? new Uint8Array(); + message.proposerAddress = object.proposerAddress ?? new Uint8Array(); + return message; + }, + fromAmino(object: HeaderAmino): Header { + const message = createBaseHeader(); + if (object.version !== undefined && object.version !== null) { + message.version = Consensus.fromAmino(object.version); + } + if (object.chain_id !== undefined && object.chain_id !== null) { + message.chainId = object.chain_id; + } + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.time !== undefined && object.time !== null) { + message.time = fromTimestamp(Timestamp.fromAmino(object.time)); + } + if (object.last_block_id !== undefined && object.last_block_id !== null) { + message.lastBlockId = BlockID.fromAmino(object.last_block_id); + } + if (object.last_commit_hash !== undefined && object.last_commit_hash !== null) { + message.lastCommitHash = bytesFromBase64(object.last_commit_hash); + } + if (object.data_hash !== undefined && object.data_hash !== null) { + message.dataHash = bytesFromBase64(object.data_hash); + } + if (object.validators_hash !== undefined && object.validators_hash !== null) { + message.validatorsHash = bytesFromBase64(object.validators_hash); + } + if (object.next_validators_hash !== undefined && object.next_validators_hash !== null) { + message.nextValidatorsHash = bytesFromBase64(object.next_validators_hash); + } + if (object.consensus_hash !== undefined && object.consensus_hash !== null) { + message.consensusHash = bytesFromBase64(object.consensus_hash); + } + if (object.app_hash !== undefined && object.app_hash !== null) { + message.appHash = bytesFromBase64(object.app_hash); + } + if (object.last_results_hash !== undefined && object.last_results_hash !== null) { + message.lastResultsHash = bytesFromBase64(object.last_results_hash); + } + if (object.evidence_hash !== undefined && object.evidence_hash !== null) { + message.evidenceHash = bytesFromBase64(object.evidence_hash); + } + if (object.proposer_address !== undefined && object.proposer_address !== null) { + message.proposerAddress = bytesFromBase64(object.proposer_address); + } + return message; + }, + toAmino(message: Header): HeaderAmino { + const obj: any = {}; + obj.version = message.version ? Consensus.toAmino(message.version) : undefined; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; + obj.height = message.height !== BigInt(0) ? message.height?.toString() : undefined; + obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; + obj.last_block_id = message.lastBlockId ? BlockID.toAmino(message.lastBlockId) : undefined; + obj.last_commit_hash = message.lastCommitHash ? base64FromBytes(message.lastCommitHash) : undefined; + obj.data_hash = message.dataHash ? base64FromBytes(message.dataHash) : undefined; + obj.validators_hash = message.validatorsHash ? base64FromBytes(message.validatorsHash) : undefined; + obj.next_validators_hash = message.nextValidatorsHash ? base64FromBytes(message.nextValidatorsHash) : undefined; + obj.consensus_hash = message.consensusHash ? base64FromBytes(message.consensusHash) : undefined; + obj.app_hash = message.appHash ? base64FromBytes(message.appHash) : undefined; + obj.last_results_hash = message.lastResultsHash ? base64FromBytes(message.lastResultsHash) : undefined; + obj.evidence_hash = message.evidenceHash ? base64FromBytes(message.evidenceHash) : undefined; + obj.proposer_address = message.proposerAddress ? base64FromBytes(message.proposerAddress) : undefined; + return obj; + }, + fromAminoMsg(object: HeaderAminoMsg): Header { + return Header.fromAmino(object.value); + }, + fromProtoMsg(message: HeaderProtoMsg): Header { + return Header.decode(message.value); + }, + toProto(message: Header): Uint8Array { + return Header.encode(message).finish(); + }, + toProtoMsg(message: Header): HeaderProtoMsg { + return { + typeUrl: "/tendermint.types.Header", + value: Header.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Header.typeUrl, Header); +function createBaseData(): Data { + return { + txs: [] + }; +} +export const Data = { + typeUrl: "/tendermint.types.Data", + is(o: any): o is Data { + return o && (o.$typeUrl === Data.typeUrl || Array.isArray(o.txs) && (!o.txs.length || o.txs[0] instanceof Uint8Array || typeof o.txs[0] === "string")); + }, + isAmino(o: any): o is DataAmino { + return o && (o.$typeUrl === Data.typeUrl || Array.isArray(o.txs) && (!o.txs.length || o.txs[0] instanceof Uint8Array || typeof o.txs[0] === "string")); + }, + encode(message: Data, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.txs) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Data { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseData(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.txs.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Data { + const message = createBaseData(); + message.txs = object.txs?.map(e => e) || []; + return message; + }, + fromAmino(object: DataAmino): Data { + const message = createBaseData(); + message.txs = object.txs?.map(e => bytesFromBase64(e)) || []; + return message; + }, + toAmino(message: Data): DataAmino { + const obj: any = {}; + if (message.txs) { + obj.txs = message.txs.map(e => base64FromBytes(e)); + } else { + obj.txs = message.txs; + } + return obj; + }, + fromAminoMsg(object: DataAminoMsg): Data { + return Data.fromAmino(object.value); + }, + fromProtoMsg(message: DataProtoMsg): Data { + return Data.decode(message.value); + }, + toProto(message: Data): Uint8Array { + return Data.encode(message).finish(); + }, + toProtoMsg(message: Data): DataProtoMsg { + return { + typeUrl: "/tendermint.types.Data", + value: Data.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Data.typeUrl, Data); +function createBaseVote(): Vote { + return { + type: 0, + height: BigInt(0), + round: 0, + blockId: BlockID.fromPartial({}), + timestamp: new Date(), + validatorAddress: new Uint8Array(), + validatorIndex: 0, + signature: new Uint8Array(), + extension: new Uint8Array(), + extensionSignature: new Uint8Array() + }; +} +export const Vote = { + typeUrl: "/tendermint.types.Vote", + is(o: any): o is Vote { + return o && (o.$typeUrl === Vote.typeUrl || isSet(o.type) && typeof o.height === "bigint" && typeof o.round === "number" && BlockID.is(o.blockId) && Timestamp.is(o.timestamp) && (o.validatorAddress instanceof Uint8Array || typeof o.validatorAddress === "string") && typeof o.validatorIndex === "number" && (o.signature instanceof Uint8Array || typeof o.signature === "string") && (o.extension instanceof Uint8Array || typeof o.extension === "string") && (o.extensionSignature instanceof Uint8Array || typeof o.extensionSignature === "string")); + }, + isAmino(o: any): o is VoteAmino { + return o && (o.$typeUrl === Vote.typeUrl || isSet(o.type) && typeof o.height === "bigint" && typeof o.round === "number" && BlockID.isAmino(o.block_id) && Timestamp.isAmino(o.timestamp) && (o.validator_address instanceof Uint8Array || typeof o.validator_address === "string") && typeof o.validator_index === "number" && (o.signature instanceof Uint8Array || typeof o.signature === "string") && (o.extension instanceof Uint8Array || typeof o.extension === "string") && (o.extension_signature instanceof Uint8Array || typeof o.extension_signature === "string")); + }, + encode(message: Vote, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (message.height !== BigInt(0)) { + writer.uint32(16).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(24).int32(message.round); + } + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(34).fork()).ldelim(); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(42).fork()).ldelim(); + } + if (message.validatorAddress.length !== 0) { + writer.uint32(50).bytes(message.validatorAddress); + } + if (message.validatorIndex !== 0) { + writer.uint32(56).int32(message.validatorIndex); + } + if (message.signature.length !== 0) { + writer.uint32(66).bytes(message.signature); + } + if (message.extension.length !== 0) { + writer.uint32(74).bytes(message.extension); + } + if (message.extensionSignature.length !== 0) { + writer.uint32(82).bytes(message.extensionSignature); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Vote { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseVote(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = (reader.int32() as any); + break; + case 2: + message.height = reader.int64(); + break; + case 3: + message.round = reader.int32(); + break; + case 4: + message.blockId = BlockID.decode(reader, reader.uint32()); + break; + case 5: + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 6: + message.validatorAddress = reader.bytes(); + break; + case 7: + message.validatorIndex = reader.int32(); + break; + case 8: + message.signature = reader.bytes(); + break; + case 9: + message.extension = reader.bytes(); + break; + case 10: + message.extensionSignature = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Vote { + const message = createBaseVote(); + message.type = object.type ?? 0; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.round = object.round ?? 0; + message.blockId = object.blockId !== undefined && object.blockId !== null ? BlockID.fromPartial(object.blockId) : undefined; + message.timestamp = object.timestamp ?? undefined; + message.validatorAddress = object.validatorAddress ?? new Uint8Array(); + message.validatorIndex = object.validatorIndex ?? 0; + message.signature = object.signature ?? new Uint8Array(); + message.extension = object.extension ?? new Uint8Array(); + message.extensionSignature = object.extensionSignature ?? new Uint8Array(); + return message; + }, + fromAmino(object: VoteAmino): Vote { + const message = createBaseVote(); + if (object.type !== undefined && object.type !== null) { + message.type = object.type; + } + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.round !== undefined && object.round !== null) { + message.round = object.round; + } + if (object.block_id !== undefined && object.block_id !== null) { + message.blockId = BlockID.fromAmino(object.block_id); + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = fromTimestamp(Timestamp.fromAmino(object.timestamp)); + } + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = bytesFromBase64(object.validator_address); + } + if (object.validator_index !== undefined && object.validator_index !== null) { + message.validatorIndex = object.validator_index; + } + if (object.signature !== undefined && object.signature !== null) { + message.signature = bytesFromBase64(object.signature); + } + if (object.extension !== undefined && object.extension !== null) { + message.extension = bytesFromBase64(object.extension); + } + if (object.extension_signature !== undefined && object.extension_signature !== null) { + message.extensionSignature = bytesFromBase64(object.extension_signature); + } + return message; + }, + toAmino(message: Vote): VoteAmino { + const obj: any = {}; + obj.type = message.type === 0 ? undefined : message.type; + obj.height = message.height !== BigInt(0) ? message.height?.toString() : undefined; + obj.round = message.round === 0 ? undefined : message.round; + obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; + obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; + obj.validator_address = message.validatorAddress ? base64FromBytes(message.validatorAddress) : undefined; + obj.validator_index = message.validatorIndex === 0 ? undefined : message.validatorIndex; + obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; + obj.extension = message.extension ? base64FromBytes(message.extension) : undefined; + obj.extension_signature = message.extensionSignature ? base64FromBytes(message.extensionSignature) : undefined; + return obj; + }, + fromAminoMsg(object: VoteAminoMsg): Vote { + return Vote.fromAmino(object.value); + }, + fromProtoMsg(message: VoteProtoMsg): Vote { + return Vote.decode(message.value); + }, + toProto(message: Vote): Uint8Array { + return Vote.encode(message).finish(); + }, + toProtoMsg(message: Vote): VoteProtoMsg { + return { + typeUrl: "/tendermint.types.Vote", + value: Vote.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Vote.typeUrl, Vote); +function createBaseCommit(): Commit { + return { + height: BigInt(0), + round: 0, + blockId: BlockID.fromPartial({}), + signatures: [] + }; +} +export const Commit = { + typeUrl: "/tendermint.types.Commit", + is(o: any): o is Commit { + return o && (o.$typeUrl === Commit.typeUrl || typeof o.height === "bigint" && typeof o.round === "number" && BlockID.is(o.blockId) && Array.isArray(o.signatures) && (!o.signatures.length || CommitSig.is(o.signatures[0]))); + }, + isAmino(o: any): o is CommitAmino { + return o && (o.$typeUrl === Commit.typeUrl || typeof o.height === "bigint" && typeof o.round === "number" && BlockID.isAmino(o.block_id) && Array.isArray(o.signatures) && (!o.signatures.length || CommitSig.isAmino(o.signatures[0]))); + }, + encode(message: Commit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { + writer.uint32(8).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(16).int32(message.round); + } + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.signatures) { + CommitSig.encode(v!, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Commit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.int64(); + break; + case 2: + message.round = reader.int32(); + break; + case 3: + message.blockId = BlockID.decode(reader, reader.uint32()); + break; + case 4: + message.signatures.push(CommitSig.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Commit { + const message = createBaseCommit(); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.round = object.round ?? 0; + message.blockId = object.blockId !== undefined && object.blockId !== null ? BlockID.fromPartial(object.blockId) : undefined; + message.signatures = object.signatures?.map(e => CommitSig.fromPartial(e)) || []; + return message; + }, + fromAmino(object: CommitAmino): Commit { + const message = createBaseCommit(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.round !== undefined && object.round !== null) { + message.round = object.round; + } + if (object.block_id !== undefined && object.block_id !== null) { + message.blockId = BlockID.fromAmino(object.block_id); + } + message.signatures = object.signatures?.map(e => CommitSig.fromAmino(e)) || []; + return message; + }, + toAmino(message: Commit): CommitAmino { + const obj: any = {}; + obj.height = message.height !== BigInt(0) ? message.height?.toString() : undefined; + obj.round = message.round === 0 ? undefined : message.round; + obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; + if (message.signatures) { + obj.signatures = message.signatures.map(e => e ? CommitSig.toAmino(e) : undefined); + } else { + obj.signatures = message.signatures; + } + return obj; + }, + fromAminoMsg(object: CommitAminoMsg): Commit { + return Commit.fromAmino(object.value); + }, + fromProtoMsg(message: CommitProtoMsg): Commit { + return Commit.decode(message.value); + }, + toProto(message: Commit): Uint8Array { + return Commit.encode(message).finish(); + }, + toProtoMsg(message: Commit): CommitProtoMsg { + return { + typeUrl: "/tendermint.types.Commit", + value: Commit.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Commit.typeUrl, Commit); +function createBaseCommitSig(): CommitSig { + return { + blockIdFlag: 0, + validatorAddress: new Uint8Array(), + timestamp: new Date(), + signature: new Uint8Array() + }; +} +export const CommitSig = { + typeUrl: "/tendermint.types.CommitSig", + is(o: any): o is CommitSig { + return o && (o.$typeUrl === CommitSig.typeUrl || isSet(o.blockIdFlag) && (o.validatorAddress instanceof Uint8Array || typeof o.validatorAddress === "string") && Timestamp.is(o.timestamp) && (o.signature instanceof Uint8Array || typeof o.signature === "string")); + }, + isAmino(o: any): o is CommitSigAmino { + return o && (o.$typeUrl === CommitSig.typeUrl || isSet(o.block_id_flag) && (o.validator_address instanceof Uint8Array || typeof o.validator_address === "string") && Timestamp.isAmino(o.timestamp) && (o.signature instanceof Uint8Array || typeof o.signature === "string")); + }, + encode(message: CommitSig, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.blockIdFlag !== 0) { + writer.uint32(8).int32(message.blockIdFlag); + } + if (message.validatorAddress.length !== 0) { + writer.uint32(18).bytes(message.validatorAddress); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(26).fork()).ldelim(); + } + if (message.signature.length !== 0) { + writer.uint32(34).bytes(message.signature); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): CommitSig { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseCommitSig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.blockIdFlag = (reader.int32() as any); + break; + case 2: + message.validatorAddress = reader.bytes(); + break; + case 3: + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 4: + message.signature = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): CommitSig { + const message = createBaseCommitSig(); + message.blockIdFlag = object.blockIdFlag ?? 0; + message.validatorAddress = object.validatorAddress ?? new Uint8Array(); + message.timestamp = object.timestamp ?? undefined; + message.signature = object.signature ?? new Uint8Array(); + return message; + }, + fromAmino(object: CommitSigAmino): CommitSig { + const message = createBaseCommitSig(); + if (object.block_id_flag !== undefined && object.block_id_flag !== null) { + message.blockIdFlag = object.block_id_flag; + } + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = bytesFromBase64(object.validator_address); + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = fromTimestamp(Timestamp.fromAmino(object.timestamp)); + } + if (object.signature !== undefined && object.signature !== null) { + message.signature = bytesFromBase64(object.signature); + } + return message; + }, + toAmino(message: CommitSig): CommitSigAmino { + const obj: any = {}; + obj.block_id_flag = message.blockIdFlag === 0 ? undefined : message.blockIdFlag; + obj.validator_address = message.validatorAddress ? base64FromBytes(message.validatorAddress) : undefined; + obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; + obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; + return obj; + }, + fromAminoMsg(object: CommitSigAminoMsg): CommitSig { + return CommitSig.fromAmino(object.value); + }, + fromProtoMsg(message: CommitSigProtoMsg): CommitSig { + return CommitSig.decode(message.value); + }, + toProto(message: CommitSig): Uint8Array { + return CommitSig.encode(message).finish(); + }, + toProtoMsg(message: CommitSig): CommitSigProtoMsg { + return { + typeUrl: "/tendermint.types.CommitSig", + value: CommitSig.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(CommitSig.typeUrl, CommitSig); +function createBaseExtendedCommit(): ExtendedCommit { + return { + height: BigInt(0), + round: 0, + blockId: BlockID.fromPartial({}), + extendedSignatures: [] + }; +} +export const ExtendedCommit = { + typeUrl: "/tendermint.types.ExtendedCommit", + is(o: any): o is ExtendedCommit { + return o && (o.$typeUrl === ExtendedCommit.typeUrl || typeof o.height === "bigint" && typeof o.round === "number" && BlockID.is(o.blockId) && Array.isArray(o.extendedSignatures) && (!o.extendedSignatures.length || ExtendedCommitSig.is(o.extendedSignatures[0]))); + }, + isAmino(o: any): o is ExtendedCommitAmino { + return o && (o.$typeUrl === ExtendedCommit.typeUrl || typeof o.height === "bigint" && typeof o.round === "number" && BlockID.isAmino(o.block_id) && Array.isArray(o.extended_signatures) && (!o.extended_signatures.length || ExtendedCommitSig.isAmino(o.extended_signatures[0]))); + }, + encode(message: ExtendedCommit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.height !== BigInt(0)) { + writer.uint32(8).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(16).int32(message.round); + } + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.extendedSignatures) { + ExtendedCommitSig.encode(v!, writer.uint32(34).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ExtendedCommit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtendedCommit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.height = reader.int64(); + break; + case 2: + message.round = reader.int32(); + break; + case 3: + message.blockId = BlockID.decode(reader, reader.uint32()); + break; + case 4: + message.extendedSignatures.push(ExtendedCommitSig.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ExtendedCommit { + const message = createBaseExtendedCommit(); + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.round = object.round ?? 0; + message.blockId = object.blockId !== undefined && object.blockId !== null ? BlockID.fromPartial(object.blockId) : undefined; + message.extendedSignatures = object.extendedSignatures?.map(e => ExtendedCommitSig.fromPartial(e)) || []; + return message; + }, + fromAmino(object: ExtendedCommitAmino): ExtendedCommit { + const message = createBaseExtendedCommit(); + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.round !== undefined && object.round !== null) { + message.round = object.round; + } + if (object.block_id !== undefined && object.block_id !== null) { + message.blockId = BlockID.fromAmino(object.block_id); + } + message.extendedSignatures = object.extended_signatures?.map(e => ExtendedCommitSig.fromAmino(e)) || []; + return message; + }, + toAmino(message: ExtendedCommit): ExtendedCommitAmino { + const obj: any = {}; + obj.height = message.height !== BigInt(0) ? message.height?.toString() : undefined; + obj.round = message.round === 0 ? undefined : message.round; + obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; + if (message.extendedSignatures) { + obj.extended_signatures = message.extendedSignatures.map(e => e ? ExtendedCommitSig.toAmino(e) : undefined); + } else { + obj.extended_signatures = message.extendedSignatures; + } + return obj; + }, + fromAminoMsg(object: ExtendedCommitAminoMsg): ExtendedCommit { + return ExtendedCommit.fromAmino(object.value); + }, + fromProtoMsg(message: ExtendedCommitProtoMsg): ExtendedCommit { + return ExtendedCommit.decode(message.value); + }, + toProto(message: ExtendedCommit): Uint8Array { + return ExtendedCommit.encode(message).finish(); + }, + toProtoMsg(message: ExtendedCommit): ExtendedCommitProtoMsg { + return { + typeUrl: "/tendermint.types.ExtendedCommit", + value: ExtendedCommit.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ExtendedCommit.typeUrl, ExtendedCommit); +function createBaseExtendedCommitSig(): ExtendedCommitSig { + return { + blockIdFlag: 0, + validatorAddress: new Uint8Array(), + timestamp: new Date(), + signature: new Uint8Array(), + extension: new Uint8Array(), + extensionSignature: new Uint8Array() + }; +} +export const ExtendedCommitSig = { + typeUrl: "/tendermint.types.ExtendedCommitSig", + is(o: any): o is ExtendedCommitSig { + return o && (o.$typeUrl === ExtendedCommitSig.typeUrl || isSet(o.blockIdFlag) && (o.validatorAddress instanceof Uint8Array || typeof o.validatorAddress === "string") && Timestamp.is(o.timestamp) && (o.signature instanceof Uint8Array || typeof o.signature === "string") && (o.extension instanceof Uint8Array || typeof o.extension === "string") && (o.extensionSignature instanceof Uint8Array || typeof o.extensionSignature === "string")); + }, + isAmino(o: any): o is ExtendedCommitSigAmino { + return o && (o.$typeUrl === ExtendedCommitSig.typeUrl || isSet(o.block_id_flag) && (o.validator_address instanceof Uint8Array || typeof o.validator_address === "string") && Timestamp.isAmino(o.timestamp) && (o.signature instanceof Uint8Array || typeof o.signature === "string") && (o.extension instanceof Uint8Array || typeof o.extension === "string") && (o.extension_signature instanceof Uint8Array || typeof o.extension_signature === "string")); + }, + encode(message: ExtendedCommitSig, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.blockIdFlag !== 0) { + writer.uint32(8).int32(message.blockIdFlag); + } + if (message.validatorAddress.length !== 0) { + writer.uint32(18).bytes(message.validatorAddress); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(26).fork()).ldelim(); + } + if (message.signature.length !== 0) { + writer.uint32(34).bytes(message.signature); + } + if (message.extension.length !== 0) { + writer.uint32(42).bytes(message.extension); + } + if (message.extensionSignature.length !== 0) { + writer.uint32(50).bytes(message.extensionSignature); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ExtendedCommitSig { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtendedCommitSig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.blockIdFlag = (reader.int32() as any); + break; + case 2: + message.validatorAddress = reader.bytes(); + break; + case 3: + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 4: + message.signature = reader.bytes(); + break; + case 5: + message.extension = reader.bytes(); + break; + case 6: + message.extensionSignature = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ExtendedCommitSig { + const message = createBaseExtendedCommitSig(); + message.blockIdFlag = object.blockIdFlag ?? 0; + message.validatorAddress = object.validatorAddress ?? new Uint8Array(); + message.timestamp = object.timestamp ?? undefined; + message.signature = object.signature ?? new Uint8Array(); + message.extension = object.extension ?? new Uint8Array(); + message.extensionSignature = object.extensionSignature ?? new Uint8Array(); + return message; + }, + fromAmino(object: ExtendedCommitSigAmino): ExtendedCommitSig { + const message = createBaseExtendedCommitSig(); + if (object.block_id_flag !== undefined && object.block_id_flag !== null) { + message.blockIdFlag = object.block_id_flag; + } + if (object.validator_address !== undefined && object.validator_address !== null) { + message.validatorAddress = bytesFromBase64(object.validator_address); + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = fromTimestamp(Timestamp.fromAmino(object.timestamp)); + } + if (object.signature !== undefined && object.signature !== null) { + message.signature = bytesFromBase64(object.signature); + } + if (object.extension !== undefined && object.extension !== null) { + message.extension = bytesFromBase64(object.extension); + } + if (object.extension_signature !== undefined && object.extension_signature !== null) { + message.extensionSignature = bytesFromBase64(object.extension_signature); + } + return message; + }, + toAmino(message: ExtendedCommitSig): ExtendedCommitSigAmino { + const obj: any = {}; + obj.block_id_flag = message.blockIdFlag === 0 ? undefined : message.blockIdFlag; + obj.validator_address = message.validatorAddress ? base64FromBytes(message.validatorAddress) : undefined; + obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; + obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; + obj.extension = message.extension ? base64FromBytes(message.extension) : undefined; + obj.extension_signature = message.extensionSignature ? base64FromBytes(message.extensionSignature) : undefined; + return obj; + }, + fromAminoMsg(object: ExtendedCommitSigAminoMsg): ExtendedCommitSig { + return ExtendedCommitSig.fromAmino(object.value); + }, + fromProtoMsg(message: ExtendedCommitSigProtoMsg): ExtendedCommitSig { + return ExtendedCommitSig.decode(message.value); + }, + toProto(message: ExtendedCommitSig): Uint8Array { + return ExtendedCommitSig.encode(message).finish(); + }, + toProtoMsg(message: ExtendedCommitSig): ExtendedCommitSigProtoMsg { + return { + typeUrl: "/tendermint.types.ExtendedCommitSig", + value: ExtendedCommitSig.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ExtendedCommitSig.typeUrl, ExtendedCommitSig); +function createBaseProposal(): Proposal { + return { + type: 0, + height: BigInt(0), + round: 0, + polRound: 0, + blockId: BlockID.fromPartial({}), + timestamp: new Date(), + signature: new Uint8Array() + }; +} +export const Proposal = { + typeUrl: "/tendermint.types.Proposal", + is(o: any): o is Proposal { + return o && (o.$typeUrl === Proposal.typeUrl || isSet(o.type) && typeof o.height === "bigint" && typeof o.round === "number" && typeof o.polRound === "number" && BlockID.is(o.blockId) && Timestamp.is(o.timestamp) && (o.signature instanceof Uint8Array || typeof o.signature === "string")); + }, + isAmino(o: any): o is ProposalAmino { + return o && (o.$typeUrl === Proposal.typeUrl || isSet(o.type) && typeof o.height === "bigint" && typeof o.round === "number" && typeof o.pol_round === "number" && BlockID.isAmino(o.block_id) && Timestamp.isAmino(o.timestamp) && (o.signature instanceof Uint8Array || typeof o.signature === "string")); + }, + encode(message: Proposal, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.type !== 0) { + writer.uint32(8).int32(message.type); + } + if (message.height !== BigInt(0)) { + writer.uint32(16).int64(message.height); + } + if (message.round !== 0) { + writer.uint32(24).int32(message.round); + } + if (message.polRound !== 0) { + writer.uint32(32).int32(message.polRound); + } + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(42).fork()).ldelim(); + } + if (message.timestamp !== undefined) { + Timestamp.encode(toTimestamp(message.timestamp), writer.uint32(50).fork()).ldelim(); + } + if (message.signature.length !== 0) { + writer.uint32(58).bytes(message.signature); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Proposal { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseProposal(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.type = (reader.int32() as any); + break; + case 2: + message.height = reader.int64(); + break; + case 3: + message.round = reader.int32(); + break; + case 4: + message.polRound = reader.int32(); + break; + case 5: + message.blockId = BlockID.decode(reader, reader.uint32()); + break; + case 6: + message.timestamp = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 7: + message.signature = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Proposal { + const message = createBaseProposal(); + message.type = object.type ?? 0; + message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0); + message.round = object.round ?? 0; + message.polRound = object.polRound ?? 0; + message.blockId = object.blockId !== undefined && object.blockId !== null ? BlockID.fromPartial(object.blockId) : undefined; + message.timestamp = object.timestamp ?? undefined; + message.signature = object.signature ?? new Uint8Array(); + return message; + }, + fromAmino(object: ProposalAmino): Proposal { + const message = createBaseProposal(); + if (object.type !== undefined && object.type !== null) { + message.type = object.type; + } + if (object.height !== undefined && object.height !== null) { + message.height = BigInt(object.height); + } + if (object.round !== undefined && object.round !== null) { + message.round = object.round; + } + if (object.pol_round !== undefined && object.pol_round !== null) { + message.polRound = object.pol_round; + } + if (object.block_id !== undefined && object.block_id !== null) { + message.blockId = BlockID.fromAmino(object.block_id); + } + if (object.timestamp !== undefined && object.timestamp !== null) { + message.timestamp = fromTimestamp(Timestamp.fromAmino(object.timestamp)); + } + if (object.signature !== undefined && object.signature !== null) { + message.signature = bytesFromBase64(object.signature); + } + return message; + }, + toAmino(message: Proposal): ProposalAmino { + const obj: any = {}; + obj.type = message.type === 0 ? undefined : message.type; + obj.height = message.height !== BigInt(0) ? message.height?.toString() : undefined; + obj.round = message.round === 0 ? undefined : message.round; + obj.pol_round = message.polRound === 0 ? undefined : message.polRound; + obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; + obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; + obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; + return obj; + }, + fromAminoMsg(object: ProposalAminoMsg): Proposal { + return Proposal.fromAmino(object.value); + }, + fromProtoMsg(message: ProposalProtoMsg): Proposal { + return Proposal.decode(message.value); + }, + toProto(message: Proposal): Uint8Array { + return Proposal.encode(message).finish(); + }, + toProtoMsg(message: Proposal): ProposalProtoMsg { + return { + typeUrl: "/tendermint.types.Proposal", + value: Proposal.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Proposal.typeUrl, Proposal); +function createBaseSignedHeader(): SignedHeader { + return { + header: undefined, + commit: undefined + }; +} +export const SignedHeader = { + typeUrl: "/tendermint.types.SignedHeader", + is(o: any): o is SignedHeader { + return o && o.$typeUrl === SignedHeader.typeUrl; + }, + isAmino(o: any): o is SignedHeaderAmino { + return o && o.$typeUrl === SignedHeader.typeUrl; + }, + encode(message: SignedHeader, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(10).fork()).ldelim(); + } + if (message.commit !== undefined) { + Commit.encode(message.commit, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SignedHeader { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSignedHeader(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.header = Header.decode(reader, reader.uint32()); + break; + case 2: + message.commit = Commit.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SignedHeader { + const message = createBaseSignedHeader(); + message.header = object.header !== undefined && object.header !== null ? Header.fromPartial(object.header) : undefined; + message.commit = object.commit !== undefined && object.commit !== null ? Commit.fromPartial(object.commit) : undefined; + return message; + }, + fromAmino(object: SignedHeaderAmino): SignedHeader { + const message = createBaseSignedHeader(); + if (object.header !== undefined && object.header !== null) { + message.header = Header.fromAmino(object.header); + } + if (object.commit !== undefined && object.commit !== null) { + message.commit = Commit.fromAmino(object.commit); + } + return message; + }, + toAmino(message: SignedHeader): SignedHeaderAmino { + const obj: any = {}; + obj.header = message.header ? Header.toAmino(message.header) : undefined; + obj.commit = message.commit ? Commit.toAmino(message.commit) : undefined; + return obj; + }, + fromAminoMsg(object: SignedHeaderAminoMsg): SignedHeader { + return SignedHeader.fromAmino(object.value); + }, + fromProtoMsg(message: SignedHeaderProtoMsg): SignedHeader { + return SignedHeader.decode(message.value); + }, + toProto(message: SignedHeader): Uint8Array { + return SignedHeader.encode(message).finish(); + }, + toProtoMsg(message: SignedHeader): SignedHeaderProtoMsg { + return { + typeUrl: "/tendermint.types.SignedHeader", + value: SignedHeader.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(SignedHeader.typeUrl, SignedHeader); +function createBaseLightBlock(): LightBlock { + return { + signedHeader: undefined, + validatorSet: undefined + }; +} +export const LightBlock = { + typeUrl: "/tendermint.types.LightBlock", + is(o: any): o is LightBlock { + return o && o.$typeUrl === LightBlock.typeUrl; + }, + isAmino(o: any): o is LightBlockAmino { + return o && o.$typeUrl === LightBlock.typeUrl; + }, + encode(message: LightBlock, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.signedHeader !== undefined) { + SignedHeader.encode(message.signedHeader, writer.uint32(10).fork()).ldelim(); + } + if (message.validatorSet !== undefined) { + ValidatorSet.encode(message.validatorSet, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): LightBlock { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseLightBlock(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.signedHeader = SignedHeader.decode(reader, reader.uint32()); + break; + case 2: + message.validatorSet = ValidatorSet.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): LightBlock { + const message = createBaseLightBlock(); + message.signedHeader = object.signedHeader !== undefined && object.signedHeader !== null ? SignedHeader.fromPartial(object.signedHeader) : undefined; + message.validatorSet = object.validatorSet !== undefined && object.validatorSet !== null ? ValidatorSet.fromPartial(object.validatorSet) : undefined; + return message; + }, + fromAmino(object: LightBlockAmino): LightBlock { + const message = createBaseLightBlock(); + if (object.signed_header !== undefined && object.signed_header !== null) { + message.signedHeader = SignedHeader.fromAmino(object.signed_header); + } + if (object.validator_set !== undefined && object.validator_set !== null) { + message.validatorSet = ValidatorSet.fromAmino(object.validator_set); + } + return message; + }, + toAmino(message: LightBlock): LightBlockAmino { + const obj: any = {}; + obj.signed_header = message.signedHeader ? SignedHeader.toAmino(message.signedHeader) : undefined; + obj.validator_set = message.validatorSet ? ValidatorSet.toAmino(message.validatorSet) : undefined; + return obj; + }, + fromAminoMsg(object: LightBlockAminoMsg): LightBlock { + return LightBlock.fromAmino(object.value); + }, + fromProtoMsg(message: LightBlockProtoMsg): LightBlock { + return LightBlock.decode(message.value); + }, + toProto(message: LightBlock): Uint8Array { + return LightBlock.encode(message).finish(); + }, + toProtoMsg(message: LightBlock): LightBlockProtoMsg { + return { + typeUrl: "/tendermint.types.LightBlock", + value: LightBlock.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(LightBlock.typeUrl, LightBlock); +function createBaseBlockMeta(): BlockMeta { + return { + blockId: BlockID.fromPartial({}), + blockSize: BigInt(0), + header: Header.fromPartial({}), + numTxs: BigInt(0) + }; +} +export const BlockMeta = { + typeUrl: "/tendermint.types.BlockMeta", + is(o: any): o is BlockMeta { + return o && (o.$typeUrl === BlockMeta.typeUrl || BlockID.is(o.blockId) && typeof o.blockSize === "bigint" && Header.is(o.header) && typeof o.numTxs === "bigint"); + }, + isAmino(o: any): o is BlockMetaAmino { + return o && (o.$typeUrl === BlockMeta.typeUrl || BlockID.isAmino(o.block_id) && typeof o.block_size === "bigint" && Header.isAmino(o.header) && typeof o.num_txs === "bigint"); + }, + encode(message: BlockMeta, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.blockId !== undefined) { + BlockID.encode(message.blockId, writer.uint32(10).fork()).ldelim(); + } + if (message.blockSize !== BigInt(0)) { + writer.uint32(16).int64(message.blockSize); + } + if (message.header !== undefined) { + Header.encode(message.header, writer.uint32(26).fork()).ldelim(); + } + if (message.numTxs !== BigInt(0)) { + writer.uint32(32).int64(message.numTxs); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): BlockMeta { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseBlockMeta(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.blockId = BlockID.decode(reader, reader.uint32()); + break; + case 2: + message.blockSize = reader.int64(); + break; + case 3: + message.header = Header.decode(reader, reader.uint32()); + break; + case 4: + message.numTxs = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): BlockMeta { + const message = createBaseBlockMeta(); + message.blockId = object.blockId !== undefined && object.blockId !== null ? BlockID.fromPartial(object.blockId) : undefined; + message.blockSize = object.blockSize !== undefined && object.blockSize !== null ? BigInt(object.blockSize.toString()) : BigInt(0); + message.header = object.header !== undefined && object.header !== null ? Header.fromPartial(object.header) : undefined; + message.numTxs = object.numTxs !== undefined && object.numTxs !== null ? BigInt(object.numTxs.toString()) : BigInt(0); + return message; + }, + fromAmino(object: BlockMetaAmino): BlockMeta { + const message = createBaseBlockMeta(); + if (object.block_id !== undefined && object.block_id !== null) { + message.blockId = BlockID.fromAmino(object.block_id); + } + if (object.block_size !== undefined && object.block_size !== null) { + message.blockSize = BigInt(object.block_size); + } + if (object.header !== undefined && object.header !== null) { + message.header = Header.fromAmino(object.header); + } + if (object.num_txs !== undefined && object.num_txs !== null) { + message.numTxs = BigInt(object.num_txs); + } + return message; + }, + toAmino(message: BlockMeta): BlockMetaAmino { + const obj: any = {}; + obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; + obj.block_size = message.blockSize !== BigInt(0) ? message.blockSize?.toString() : undefined; + obj.header = message.header ? Header.toAmino(message.header) : undefined; + obj.num_txs = message.numTxs !== BigInt(0) ? message.numTxs?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: BlockMetaAminoMsg): BlockMeta { + return BlockMeta.fromAmino(object.value); + }, + fromProtoMsg(message: BlockMetaProtoMsg): BlockMeta { + return BlockMeta.decode(message.value); + }, + toProto(message: BlockMeta): Uint8Array { + return BlockMeta.encode(message).finish(); + }, + toProtoMsg(message: BlockMeta): BlockMetaProtoMsg { + return { + typeUrl: "/tendermint.types.BlockMeta", + value: BlockMeta.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(BlockMeta.typeUrl, BlockMeta); +function createBaseTxProof(): TxProof { + return { + rootHash: new Uint8Array(), + data: new Uint8Array(), + proof: undefined + }; +} +export const TxProof = { + typeUrl: "/tendermint.types.TxProof", + is(o: any): o is TxProof { + return o && (o.$typeUrl === TxProof.typeUrl || (o.rootHash instanceof Uint8Array || typeof o.rootHash === "string") && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + isAmino(o: any): o is TxProofAmino { + return o && (o.$typeUrl === TxProof.typeUrl || (o.root_hash instanceof Uint8Array || typeof o.root_hash === "string") && (o.data instanceof Uint8Array || typeof o.data === "string")); + }, + encode(message: TxProof, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.rootHash.length !== 0) { + writer.uint32(10).bytes(message.rootHash); + } + if (message.data.length !== 0) { + writer.uint32(18).bytes(message.data); + } + if (message.proof !== undefined) { + Proof.encode(message.proof, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): TxProof { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTxProof(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.rootHash = reader.bytes(); + break; + case 2: + message.data = reader.bytes(); + break; + case 3: + message.proof = Proof.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): TxProof { + const message = createBaseTxProof(); + message.rootHash = object.rootHash ?? new Uint8Array(); + message.data = object.data ?? new Uint8Array(); + message.proof = object.proof !== undefined && object.proof !== null ? Proof.fromPartial(object.proof) : undefined; + return message; + }, + fromAmino(object: TxProofAmino): TxProof { + const message = createBaseTxProof(); + if (object.root_hash !== undefined && object.root_hash !== null) { + message.rootHash = bytesFromBase64(object.root_hash); + } + if (object.data !== undefined && object.data !== null) { + message.data = bytesFromBase64(object.data); + } + if (object.proof !== undefined && object.proof !== null) { + message.proof = Proof.fromAmino(object.proof); + } + return message; + }, + toAmino(message: TxProof): TxProofAmino { + const obj: any = {}; + obj.root_hash = message.rootHash ? base64FromBytes(message.rootHash) : undefined; + obj.data = message.data ? base64FromBytes(message.data) : undefined; + obj.proof = message.proof ? Proof.toAmino(message.proof) : undefined; + return obj; + }, + fromAminoMsg(object: TxProofAminoMsg): TxProof { + return TxProof.fromAmino(object.value); + }, + fromProtoMsg(message: TxProofProtoMsg): TxProof { + return TxProof.decode(message.value); + }, + toProto(message: TxProof): Uint8Array { + return TxProof.encode(message).finish(); + }, + toProtoMsg(message: TxProof): TxProofProtoMsg { + return { + typeUrl: "/tendermint.types.TxProof", + value: TxProof.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(TxProof.typeUrl, TxProof); \ No newline at end of file diff --git a/libs/interchain-query/src/tendermint/types/validator.ts b/libs/interchain-query/src/tendermint/types/validator.ts new file mode 100644 index 00000000..0c652786 --- /dev/null +++ b/libs/interchain-query/src/tendermint/types/validator.ts @@ -0,0 +1,389 @@ +import { PublicKey, PublicKeyAmino } from "../crypto/keys"; +import { BinaryReader, BinaryWriter } from "../../binary"; +import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; +/** BlockIdFlag indicates which BlockID the signature is for */ +export enum BlockIDFlag { + /** BLOCK_ID_FLAG_UNKNOWN - indicates an error condition */ + BLOCK_ID_FLAG_UNKNOWN = 0, + /** BLOCK_ID_FLAG_ABSENT - the vote was not received */ + BLOCK_ID_FLAG_ABSENT = 1, + BLOCK_ID_FLAG_COMMIT = 2, + /** BLOCK_ID_FLAG_NIL - voted for nil */ + BLOCK_ID_FLAG_NIL = 3, + UNRECOGNIZED = -1, +} +export const BlockIDFlagAmino = BlockIDFlag; +export function blockIDFlagFromJSON(object: any): BlockIDFlag { + switch (object) { + case 0: + case "BLOCK_ID_FLAG_UNKNOWN": + return BlockIDFlag.BLOCK_ID_FLAG_UNKNOWN; + case 1: + case "BLOCK_ID_FLAG_ABSENT": + return BlockIDFlag.BLOCK_ID_FLAG_ABSENT; + case 2: + case "BLOCK_ID_FLAG_COMMIT": + return BlockIDFlag.BLOCK_ID_FLAG_COMMIT; + case 3: + case "BLOCK_ID_FLAG_NIL": + return BlockIDFlag.BLOCK_ID_FLAG_NIL; + case -1: + case "UNRECOGNIZED": + default: + return BlockIDFlag.UNRECOGNIZED; + } +} +export function blockIDFlagToJSON(object: BlockIDFlag): string { + switch (object) { + case BlockIDFlag.BLOCK_ID_FLAG_UNKNOWN: + return "BLOCK_ID_FLAG_UNKNOWN"; + case BlockIDFlag.BLOCK_ID_FLAG_ABSENT: + return "BLOCK_ID_FLAG_ABSENT"; + case BlockIDFlag.BLOCK_ID_FLAG_COMMIT: + return "BLOCK_ID_FLAG_COMMIT"; + case BlockIDFlag.BLOCK_ID_FLAG_NIL: + return "BLOCK_ID_FLAG_NIL"; + case BlockIDFlag.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export interface ValidatorSet { + validators: Validator[]; + proposer?: Validator; + totalVotingPower: bigint; +} +export interface ValidatorSetProtoMsg { + typeUrl: "/tendermint.types.ValidatorSet"; + value: Uint8Array; +} +export interface ValidatorSetAmino { + validators: ValidatorAmino[]; + proposer?: ValidatorAmino; + total_voting_power: string; +} +export interface ValidatorSetAminoMsg { + type: "/tendermint.types.ValidatorSet"; + value: ValidatorSetAmino; +} +export interface Validator { + address: Uint8Array; + pubKey: PublicKey; + votingPower: bigint; + proposerPriority: bigint; +} +export interface ValidatorProtoMsg { + typeUrl: "/tendermint.types.Validator"; + value: Uint8Array; +} +export interface ValidatorAmino { + address: string; + pub_key: PublicKeyAmino; + voting_power: string; + proposer_priority: string; +} +export interface ValidatorAminoMsg { + type: "/tendermint.types.Validator"; + value: ValidatorAmino; +} +export interface SimpleValidator { + pubKey?: PublicKey; + votingPower: bigint; +} +export interface SimpleValidatorProtoMsg { + typeUrl: "/tendermint.types.SimpleValidator"; + value: Uint8Array; +} +export interface SimpleValidatorAmino { + pub_key?: PublicKeyAmino; + voting_power: string; +} +export interface SimpleValidatorAminoMsg { + type: "/tendermint.types.SimpleValidator"; + value: SimpleValidatorAmino; +} +function createBaseValidatorSet(): ValidatorSet { + return { + validators: [], + proposer: undefined, + totalVotingPower: BigInt(0) + }; +} +export const ValidatorSet = { + typeUrl: "/tendermint.types.ValidatorSet", + is(o: any): o is ValidatorSet { + return o && (o.$typeUrl === ValidatorSet.typeUrl || Array.isArray(o.validators) && (!o.validators.length || Validator.is(o.validators[0])) && typeof o.totalVotingPower === "bigint"); + }, + isAmino(o: any): o is ValidatorSetAmino { + return o && (o.$typeUrl === ValidatorSet.typeUrl || Array.isArray(o.validators) && (!o.validators.length || Validator.isAmino(o.validators[0])) && typeof o.total_voting_power === "bigint"); + }, + encode(message: ValidatorSet, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.validators) { + Validator.encode(v!, writer.uint32(10).fork()).ldelim(); + } + if (message.proposer !== undefined) { + Validator.encode(message.proposer, writer.uint32(18).fork()).ldelim(); + } + if (message.totalVotingPower !== BigInt(0)) { + writer.uint32(24).int64(message.totalVotingPower); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ValidatorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidatorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.validators.push(Validator.decode(reader, reader.uint32())); + break; + case 2: + message.proposer = Validator.decode(reader, reader.uint32()); + break; + case 3: + message.totalVotingPower = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): ValidatorSet { + const message = createBaseValidatorSet(); + message.validators = object.validators?.map(e => Validator.fromPartial(e)) || []; + message.proposer = object.proposer !== undefined && object.proposer !== null ? Validator.fromPartial(object.proposer) : undefined; + message.totalVotingPower = object.totalVotingPower !== undefined && object.totalVotingPower !== null ? BigInt(object.totalVotingPower.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ValidatorSetAmino): ValidatorSet { + const message = createBaseValidatorSet(); + message.validators = object.validators?.map(e => Validator.fromAmino(e)) || []; + if (object.proposer !== undefined && object.proposer !== null) { + message.proposer = Validator.fromAmino(object.proposer); + } + if (object.total_voting_power !== undefined && object.total_voting_power !== null) { + message.totalVotingPower = BigInt(object.total_voting_power); + } + return message; + }, + toAmino(message: ValidatorSet): ValidatorSetAmino { + const obj: any = {}; + if (message.validators) { + obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); + } else { + obj.validators = message.validators; + } + obj.proposer = message.proposer ? Validator.toAmino(message.proposer) : undefined; + obj.total_voting_power = message.totalVotingPower !== BigInt(0) ? message.totalVotingPower?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ValidatorSetAminoMsg): ValidatorSet { + return ValidatorSet.fromAmino(object.value); + }, + fromProtoMsg(message: ValidatorSetProtoMsg): ValidatorSet { + return ValidatorSet.decode(message.value); + }, + toProto(message: ValidatorSet): Uint8Array { + return ValidatorSet.encode(message).finish(); + }, + toProtoMsg(message: ValidatorSet): ValidatorSetProtoMsg { + return { + typeUrl: "/tendermint.types.ValidatorSet", + value: ValidatorSet.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(ValidatorSet.typeUrl, ValidatorSet); +function createBaseValidator(): Validator { + return { + address: new Uint8Array(), + pubKey: PublicKey.fromPartial({}), + votingPower: BigInt(0), + proposerPriority: BigInt(0) + }; +} +export const Validator = { + typeUrl: "/tendermint.types.Validator", + is(o: any): o is Validator { + return o && (o.$typeUrl === Validator.typeUrl || (o.address instanceof Uint8Array || typeof o.address === "string") && PublicKey.is(o.pubKey) && typeof o.votingPower === "bigint" && typeof o.proposerPriority === "bigint"); + }, + isAmino(o: any): o is ValidatorAmino { + return o && (o.$typeUrl === Validator.typeUrl || (o.address instanceof Uint8Array || typeof o.address === "string") && PublicKey.isAmino(o.pub_key) && typeof o.voting_power === "bigint" && typeof o.proposer_priority === "bigint"); + }, + encode(message: Validator, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.address.length !== 0) { + writer.uint32(10).bytes(message.address); + } + if (message.pubKey !== undefined) { + PublicKey.encode(message.pubKey, writer.uint32(18).fork()).ldelim(); + } + if (message.votingPower !== BigInt(0)) { + writer.uint32(24).int64(message.votingPower); + } + if (message.proposerPriority !== BigInt(0)) { + writer.uint32(32).int64(message.proposerPriority); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Validator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.address = reader.bytes(); + break; + case 2: + message.pubKey = PublicKey.decode(reader, reader.uint32()); + break; + case 3: + message.votingPower = reader.int64(); + break; + case 4: + message.proposerPriority = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Validator { + const message = createBaseValidator(); + message.address = object.address ?? new Uint8Array(); + message.pubKey = object.pubKey !== undefined && object.pubKey !== null ? PublicKey.fromPartial(object.pubKey) : undefined; + message.votingPower = object.votingPower !== undefined && object.votingPower !== null ? BigInt(object.votingPower.toString()) : BigInt(0); + message.proposerPriority = object.proposerPriority !== undefined && object.proposerPriority !== null ? BigInt(object.proposerPriority.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ValidatorAmino): Validator { + const message = createBaseValidator(); + if (object.address !== undefined && object.address !== null) { + message.address = bytesFromBase64(object.address); + } + if (object.pub_key !== undefined && object.pub_key !== null) { + message.pubKey = PublicKey.fromAmino(object.pub_key); + } + if (object.voting_power !== undefined && object.voting_power !== null) { + message.votingPower = BigInt(object.voting_power); + } + if (object.proposer_priority !== undefined && object.proposer_priority !== null) { + message.proposerPriority = BigInt(object.proposer_priority); + } + return message; + }, + toAmino(message: Validator): ValidatorAmino { + const obj: any = {}; + obj.address = message.address ? base64FromBytes(message.address) : undefined; + obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey) : undefined; + obj.voting_power = message.votingPower !== BigInt(0) ? message.votingPower?.toString() : undefined; + obj.proposer_priority = message.proposerPriority !== BigInt(0) ? message.proposerPriority?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ValidatorAminoMsg): Validator { + return Validator.fromAmino(object.value); + }, + fromProtoMsg(message: ValidatorProtoMsg): Validator { + return Validator.decode(message.value); + }, + toProto(message: Validator): Uint8Array { + return Validator.encode(message).finish(); + }, + toProtoMsg(message: Validator): ValidatorProtoMsg { + return { + typeUrl: "/tendermint.types.Validator", + value: Validator.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Validator.typeUrl, Validator); +function createBaseSimpleValidator(): SimpleValidator { + return { + pubKey: undefined, + votingPower: BigInt(0) + }; +} +export const SimpleValidator = { + typeUrl: "/tendermint.types.SimpleValidator", + is(o: any): o is SimpleValidator { + return o && (o.$typeUrl === SimpleValidator.typeUrl || typeof o.votingPower === "bigint"); + }, + isAmino(o: any): o is SimpleValidatorAmino { + return o && (o.$typeUrl === SimpleValidator.typeUrl || typeof o.voting_power === "bigint"); + }, + encode(message: SimpleValidator, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.pubKey !== undefined) { + PublicKey.encode(message.pubKey, writer.uint32(10).fork()).ldelim(); + } + if (message.votingPower !== BigInt(0)) { + writer.uint32(16).int64(message.votingPower); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SimpleValidator { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSimpleValidator(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.pubKey = PublicKey.decode(reader, reader.uint32()); + break; + case 2: + message.votingPower = reader.int64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): SimpleValidator { + const message = createBaseSimpleValidator(); + message.pubKey = object.pubKey !== undefined && object.pubKey !== null ? PublicKey.fromPartial(object.pubKey) : undefined; + message.votingPower = object.votingPower !== undefined && object.votingPower !== null ? BigInt(object.votingPower.toString()) : BigInt(0); + return message; + }, + fromAmino(object: SimpleValidatorAmino): SimpleValidator { + const message = createBaseSimpleValidator(); + if (object.pub_key !== undefined && object.pub_key !== null) { + message.pubKey = PublicKey.fromAmino(object.pub_key); + } + if (object.voting_power !== undefined && object.voting_power !== null) { + message.votingPower = BigInt(object.voting_power); + } + return message; + }, + toAmino(message: SimpleValidator): SimpleValidatorAmino { + const obj: any = {}; + obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey) : undefined; + obj.voting_power = message.votingPower !== BigInt(0) ? message.votingPower?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: SimpleValidatorAminoMsg): SimpleValidator { + return SimpleValidator.fromAmino(object.value); + }, + fromProtoMsg(message: SimpleValidatorProtoMsg): SimpleValidator { + return SimpleValidator.decode(message.value); + }, + toProto(message: SimpleValidator): Uint8Array { + return SimpleValidator.encode(message).finish(); + }, + toProtoMsg(message: SimpleValidator): SimpleValidatorProtoMsg { + return { + typeUrl: "/tendermint.types.SimpleValidator", + value: SimpleValidator.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(SimpleValidator.typeUrl, SimpleValidator); \ No newline at end of file diff --git a/libs/interchain-query/src/tendermint/version/types.ts b/libs/interchain-query/src/tendermint/version/types.ts new file mode 100644 index 00000000..824f3644 --- /dev/null +++ b/libs/interchain-query/src/tendermint/version/types.ts @@ -0,0 +1,219 @@ +import { BinaryReader, BinaryWriter } from "../../binary"; +import { DeepPartial } from "../../helpers"; +import { GlobalDecoderRegistry } from "../../registry"; +/** + * App includes the protocol and software version for the application. + * This information is included in ResponseInfo. The App.Protocol can be + * updated in ResponseEndBlock. + */ +export interface App { + protocol: bigint; + software: string; +} +export interface AppProtoMsg { + typeUrl: "/tendermint.version.App"; + value: Uint8Array; +} +/** + * App includes the protocol and software version for the application. + * This information is included in ResponseInfo. The App.Protocol can be + * updated in ResponseEndBlock. + */ +export interface AppAmino { + protocol: string; + software: string; +} +export interface AppAminoMsg { + type: "/tendermint.version.App"; + value: AppAmino; +} +/** + * Consensus captures the consensus rules for processing a block in the blockchain, + * including all blockchain data structures and the rules of the application's + * state transition machine. + */ +export interface Consensus { + block: bigint; + app: bigint; +} +export interface ConsensusProtoMsg { + typeUrl: "/tendermint.version.Consensus"; + value: Uint8Array; +} +/** + * Consensus captures the consensus rules for processing a block in the blockchain, + * including all blockchain data structures and the rules of the application's + * state transition machine. + */ +export interface ConsensusAmino { + block: string; + app: string; +} +export interface ConsensusAminoMsg { + type: "/tendermint.version.Consensus"; + value: ConsensusAmino; +} +function createBaseApp(): App { + return { + protocol: BigInt(0), + software: "" + }; +} +export const App = { + typeUrl: "/tendermint.version.App", + is(o: any): o is App { + return o && (o.$typeUrl === App.typeUrl || typeof o.protocol === "bigint" && typeof o.software === "string"); + }, + isAmino(o: any): o is AppAmino { + return o && (o.$typeUrl === App.typeUrl || typeof o.protocol === "bigint" && typeof o.software === "string"); + }, + encode(message: App, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.protocol !== BigInt(0)) { + writer.uint32(8).uint64(message.protocol); + } + if (message.software !== "") { + writer.uint32(18).string(message.software); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): App { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseApp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.protocol = reader.uint64(); + break; + case 2: + message.software = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): App { + const message = createBaseApp(); + message.protocol = object.protocol !== undefined && object.protocol !== null ? BigInt(object.protocol.toString()) : BigInt(0); + message.software = object.software ?? ""; + return message; + }, + fromAmino(object: AppAmino): App { + const message = createBaseApp(); + if (object.protocol !== undefined && object.protocol !== null) { + message.protocol = BigInt(object.protocol); + } + if (object.software !== undefined && object.software !== null) { + message.software = object.software; + } + return message; + }, + toAmino(message: App): AppAmino { + const obj: any = {}; + obj.protocol = message.protocol !== BigInt(0) ? message.protocol?.toString() : undefined; + obj.software = message.software === "" ? undefined : message.software; + return obj; + }, + fromAminoMsg(object: AppAminoMsg): App { + return App.fromAmino(object.value); + }, + fromProtoMsg(message: AppProtoMsg): App { + return App.decode(message.value); + }, + toProto(message: App): Uint8Array { + return App.encode(message).finish(); + }, + toProtoMsg(message: App): AppProtoMsg { + return { + typeUrl: "/tendermint.version.App", + value: App.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(App.typeUrl, App); +function createBaseConsensus(): Consensus { + return { + block: BigInt(0), + app: BigInt(0) + }; +} +export const Consensus = { + typeUrl: "/tendermint.version.Consensus", + is(o: any): o is Consensus { + return o && (o.$typeUrl === Consensus.typeUrl || typeof o.block === "bigint" && typeof o.app === "bigint"); + }, + isAmino(o: any): o is ConsensusAmino { + return o && (o.$typeUrl === Consensus.typeUrl || typeof o.block === "bigint" && typeof o.app === "bigint"); + }, + encode(message: Consensus, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.block !== BigInt(0)) { + writer.uint32(8).uint64(message.block); + } + if (message.app !== BigInt(0)) { + writer.uint32(16).uint64(message.app); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Consensus { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseConsensus(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.block = reader.uint64(); + break; + case 2: + message.app = reader.uint64(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromPartial(object: DeepPartial): Consensus { + const message = createBaseConsensus(); + message.block = object.block !== undefined && object.block !== null ? BigInt(object.block.toString()) : BigInt(0); + message.app = object.app !== undefined && object.app !== null ? BigInt(object.app.toString()) : BigInt(0); + return message; + }, + fromAmino(object: ConsensusAmino): Consensus { + const message = createBaseConsensus(); + if (object.block !== undefined && object.block !== null) { + message.block = BigInt(object.block); + } + if (object.app !== undefined && object.app !== null) { + message.app = BigInt(object.app); + } + return message; + }, + toAmino(message: Consensus): ConsensusAmino { + const obj: any = {}; + obj.block = message.block !== BigInt(0) ? message.block?.toString() : undefined; + obj.app = message.app !== BigInt(0) ? message.app?.toString() : undefined; + return obj; + }, + fromAminoMsg(object: ConsensusAminoMsg): Consensus { + return Consensus.fromAmino(object.value); + }, + fromProtoMsg(message: ConsensusProtoMsg): Consensus { + return Consensus.decode(message.value); + }, + toProto(message: Consensus): Uint8Array { + return Consensus.encode(message).finish(); + }, + toProtoMsg(message: Consensus): ConsensusProtoMsg { + return { + typeUrl: "/tendermint.version.Consensus", + value: Consensus.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(Consensus.typeUrl, Consensus); \ No newline at end of file diff --git a/libs/interchain-query/src/types.ts b/libs/interchain-query/src/types.ts new file mode 100644 index 00000000..95dbec3a --- /dev/null +++ b/libs/interchain-query/src/types.ts @@ -0,0 +1,155 @@ +/** +* This file and any referenced files were automatically generated by @cosmology/telescope@1.10.8 +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + +import { IBinaryReader, IBinaryWriter } from "./binary"; +import { Any } from "./google/protobuf/any"; +import { OfflineSigner } from "@interchainjs/cosmos/types/wallet"; +import { HttpEndpoint } from "@interchainjs/types"; + +export type ProtoMsg = Omit & { typeUrl: any }; + +export interface IAminoMsg { + type: any; + value: Amino; +} + +export interface IProtoType { + $typeUrl?: any; +} + +/** + * A type generated by Telescope 1.0. + */ +export interface TelescopeGeneratedCodec< + T = unknown, + SDK = unknown, + Amino = unknown +> { + readonly typeUrl: string; + readonly aminoType?: string; + is?(o: unknown): o is T; + isSDK?(o: unknown): o is SDK; + isAmino?(o: unknown): o is Amino; + encode: (message: T, writer?: IBinaryWriter | any) => IBinaryWriter | any; + decode: (input: IBinaryReader | Uint8Array | any, length?: number) => T; + fromPartial: (object: any) => T | any; + fromJSON?: (object: any) => T | any; + toJSON?: (message: T | any) => any; + fromSDK?: (sdk: SDK) => T; + fromSDKJSON?: (object: any) => SDK; + toSDK?: (message: T) => SDK; + fromAmino?: (amino: Amino) => T; + toAmino?: (message: T) => Amino; + fromAminoMsg?: (aminoMsg: IAminoMsg) => T; + toAminoMsg?: (message: T) => IAminoMsg; + toProto?: (message: T) => Uint8Array; + fromProtoMsg?: (message: ProtoMsg) => T; + toProtoMsg?: (message: T) => Any; +} + +export type TelescopeGeneratedType< + T = unknown, + SDK = unknown, + Amino = unknown +> = TelescopeGeneratedCodec; + +export type GeneratedType = TelescopeGeneratedCodec; + +/** + * Coin defines a token with a denomination and an amount. + * + * NOTE: The amount field is an Int which implements the custom method + * signatures required by gogoproto. + */ +export interface Coin { + denom: string; + amount: string; +} + +export type EncodeObject = Message; + +export interface Message { + typeUrl: string; + value: T; +} + +export interface StdFee { + amount: Coin[]; + gas: string; + /** The granter address that is used for paying with feegrants */ + granter?: string; + /** The fee payer address. The payer must have signed the transaction. */ + payer?: string; +} + +export interface MsgData { + msgType: string; + data: Uint8Array; +} + +export interface Attribute { + key: string; + value: string; + index: boolean; +} +export interface Event { + type: string; + attributes: Attribute[]; +} + +/** + * The response after successfully broadcasting a transaction. + * Success or failure refer to the execution result. + */ +export interface DeliverTxResponse { + height: number; + /** The position of the transaction within the block. This is a 0-based index. */ + txIndex: number; + /** Error code. The transaction suceeded if and only if code is 0. */ + code: number; + transactionHash: string; + events: Event[]; + /** + * A string-based log document. + * + * This currently seems to merge attributes of multiple events into one event per type + * (https://github.com/tendermint/tendermint/issues/9595). You might want to use the `events` + * field instead. + */ + rawLog?: string; + /** @deprecated Use `msgResponses` instead. */ + data?: MsgData[]; + /** + * The message responses of the [TxMsgData](https://github.com/cosmos/cosmos-sdk/blob/v0.46.3/proto/cosmos/base/abci/v1beta1/abci.proto#L128-L140) + * as `Any`s. + * This field is an empty list for chains running Cosmos SDK < 0.46. + */ + msgResponses: Array<{ + typeUrl: string; + value: Uint8Array; + }>; + gasUsed: bigint; + gasWanted: bigint; +} + +export interface TxRpc { + request( + service: string, + method: string, + data: Uint8Array + ): Promise; + signAndBroadcast?( + signerAddress: string, + messages: EncodeObject[], + fee: StdFee | "auto" | number, + memo: string + ): Promise; +} + +export interface SigningClientParams { + rpcEndpoint: string | HttpEndpoint; + signer: OfflineSigner; +} diff --git a/libs/interchain-query/src/utf8.ts b/libs/interchain-query/src/utf8.ts new file mode 100644 index 00000000..288be9f6 --- /dev/null +++ b/libs/interchain-query/src/utf8.ts @@ -0,0 +1,148 @@ +/** +* This file and any referenced files were automatically generated by @cosmology/telescope@1.10.8 +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +// Copyright (c) 2016, Daniel Wirtz All rights reserved. + +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: + +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of its author, nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. + +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"use strict"; + +/** + * Calculates the UTF8 byte length of a string. + * @param {string} string String + * @returns {number} Byte length + */ +export function utf8Length(str: string) { + let len = 0, + c = 0; + for (let i = 0; i < str.length; ++i) { + c = str.charCodeAt(i); + if (c < 128) len += 1; + else if (c < 2048) len += 2; + else if ( + (c & 0xfc00) === 0xd800 && + (str.charCodeAt(i + 1) & 0xfc00) === 0xdc00 + ) { + ++i; + len += 4; + } else len += 3; + } + return len; +} + +/** + * Reads UTF8 bytes as a string. + * @param {Uint8Array} buffer Source buffer + * @param {number} start Source start + * @param {number} end Source end + * @returns {string} String read + */ +export function utf8Read( + buffer: ArrayLike, + start: number, + end: number +) { + const len = end - start; + if (len < 1) return ""; + const chunk = []; + let parts: string[] = [], + i = 0, // char offset + t; // temporary + while (start < end) { + t = buffer[start++]; + if (t < 128) chunk[i++] = t; + else if (t > 191 && t < 224) + chunk[i++] = ((t & 31) << 6) | (buffer[start++] & 63); + else if (t > 239 && t < 365) { + t = + (((t & 7) << 18) | + ((buffer[start++] & 63) << 12) | + ((buffer[start++] & 63) << 6) | + (buffer[start++] & 63)) - + 0x10000; + chunk[i++] = 0xd800 + (t >> 10); + chunk[i++] = 0xdc00 + (t & 1023); + } else + chunk[i++] = + ((t & 15) << 12) | + ((buffer[start++] & 63) << 6) | + (buffer[start++] & 63); + if (i > 8191) { + (parts || (parts = [])).push(String.fromCharCode(...chunk)); + i = 0; + } + } + if (parts) { + if (i) parts.push(String.fromCharCode(...chunk.slice(0, i))); + return parts.join(""); + } + return String.fromCharCode(...chunk.slice(0, i)); +} + +/** + * Writes a string as UTF8 bytes. + * @param {string} string Source string + * @param {Uint8Array} buffer Destination buffer + * @param {number} offset Destination offset + * @returns {number} Bytes written + */ +export function utf8Write( + str: string, + buffer: Uint8Array | Array, + offset: number +) { + const start = offset; + let c1, // character 1 + c2; // character 2 + for (let i = 0; i < str.length; ++i) { + c1 = str.charCodeAt(i); + if (c1 < 128) { + buffer[offset++] = c1; + } else if (c1 < 2048) { + buffer[offset++] = (c1 >> 6) | 192; + buffer[offset++] = (c1 & 63) | 128; + } else if ( + (c1 & 0xfc00) === 0xd800 && + ((c2 = str.charCodeAt(i + 1)) & 0xfc00) === 0xdc00 + ) { + c1 = 0x10000 + ((c1 & 0x03ff) << 10) + (c2 & 0x03ff); + ++i; + buffer[offset++] = (c1 >> 18) | 240; + buffer[offset++] = ((c1 >> 12) & 63) | 128; + buffer[offset++] = ((c1 >> 6) & 63) | 128; + buffer[offset++] = (c1 & 63) | 128; + } else { + buffer[offset++] = (c1 >> 12) | 224; + buffer[offset++] = ((c1 >> 6) & 63) | 128; + buffer[offset++] = (c1 & 63) | 128; + } + } + return offset - start; +} diff --git a/libs/interchain-query/src/varint.ts b/libs/interchain-query/src/varint.ts new file mode 100644 index 00000000..0b7431a3 --- /dev/null +++ b/libs/interchain-query/src/varint.ts @@ -0,0 +1,488 @@ +/** +* This file and any referenced files were automatically generated by @cosmology/telescope@1.10.8 +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or npm scripts command that is used to regenerate this bundle. +*/ + + +// Copyright 2008 Google Inc. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Code generated by the Protocol Buffer compiler is owned by the owner +// of the input file used when generating it. This code is not +// standalone and requires a support library to be linked with it. This +// support library is itself covered by the above license. + +/* eslint-disable prefer-const,@typescript-eslint/restrict-plus-operands */ + +/** + * Read a 64 bit varint as two JS numbers. + * + * Returns tuple: + * [0]: low bits + * [1]: high bits + * + * Copyright 2008 Google Inc. All rights reserved. + * + * See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/buffer_decoder.js#L175 + */ +export function varint64read(this: ReaderLike): [number, number] { + let lowBits = 0; + let highBits = 0; + + for (let shift = 0; shift < 28; shift += 7) { + let b = this.buf[this.pos++]; + lowBits |= (b & 0x7f) << shift; + if ((b & 0x80) == 0) { + this.assertBounds(); + return [lowBits, highBits]; + } + } + + let middleByte = this.buf[this.pos++]; + + // last four bits of the first 32 bit number + lowBits |= (middleByte & 0x0f) << 28; + + // 3 upper bits are part of the next 32 bit number + highBits = (middleByte & 0x70) >> 4; + + if ((middleByte & 0x80) == 0) { + this.assertBounds(); + return [lowBits, highBits]; + } + + for (let shift = 3; shift <= 31; shift += 7) { + let b = this.buf[this.pos++]; + highBits |= (b & 0x7f) << shift; + if ((b & 0x80) == 0) { + this.assertBounds(); + return [lowBits, highBits]; + } + } + + throw new Error("invalid varint"); +} + +/** + * Write a 64 bit varint, given as two JS numbers, to the given bytes array. + * + * Copyright 2008 Google Inc. All rights reserved. + * + * See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/writer.js#L344 + */ +export function varint64write(lo: number, hi: number, bytes: number[]): void { + for (let i = 0; i < 28; i = i + 7) { + const shift = lo >>> i; + const hasNext = !(shift >>> 7 == 0 && hi == 0); + const byte = (hasNext ? shift | 0x80 : shift) & 0xff; + bytes.push(byte); + if (!hasNext) { + return; + } + } + + const splitBits = ((lo >>> 28) & 0x0f) | ((hi & 0x07) << 4); + const hasMoreBits = !(hi >> 3 == 0); + bytes.push((hasMoreBits ? splitBits | 0x80 : splitBits) & 0xff); + + if (!hasMoreBits) { + return; + } + + for (let i = 3; i < 31; i = i + 7) { + const shift = hi >>> i; + const hasNext = !(shift >>> 7 == 0); + const byte = (hasNext ? shift | 0x80 : shift) & 0xff; + bytes.push(byte); + if (!hasNext) { + return; + } + } + + bytes.push((hi >>> 31) & 0x01); +} + +// constants for binary math +const TWO_PWR_32_DBL = 0x100000000; + +/** + * Parse decimal string of 64 bit integer value as two JS numbers. + * + * Copyright 2008 Google Inc. All rights reserved. + * + * See https://github.com/protocolbuffers/protobuf-javascript/blob/a428c58273abad07c66071d9753bc4d1289de426/experimental/runtime/int64.js#L10 + */ +export function int64FromString(dec: string): { lo: number; hi: number } { + // Check for minus sign. + const minus = dec[0] === "-"; + if (minus) { + dec = dec.slice(1); + } + + // Work 6 decimal digits at a time, acting like we're converting base 1e6 + // digits to binary. This is safe to do with floating point math because + // Number.isSafeInteger(ALL_32_BITS * 1e6) == true. + const base = 1e6; + let lowBits = 0; + let highBits = 0; + + function add1e6digit(begin: number, end?: number) { + // Note: Number('') is 0. + const digit1e6 = Number(dec.slice(begin, end)); + highBits *= base; + lowBits = lowBits * base + digit1e6; + // Carry bits from lowBits to + if (lowBits >= TWO_PWR_32_DBL) { + highBits = highBits + ((lowBits / TWO_PWR_32_DBL) | 0); + lowBits = lowBits % TWO_PWR_32_DBL; + } + } + + add1e6digit(-24, -18); + add1e6digit(-18, -12); + add1e6digit(-12, -6); + add1e6digit(-6); + return minus ? negate(lowBits, highBits) : newBits(lowBits, highBits); +} + +/** + * Losslessly converts a 64-bit signed integer in 32:32 split representation + * into a decimal string. + * + * Copyright 2008 Google Inc. All rights reserved. + * + * See https://github.com/protocolbuffers/protobuf-javascript/blob/a428c58273abad07c66071d9753bc4d1289de426/experimental/runtime/int64.js#L10 + */ +export function int64ToString(lo: number, hi: number): string { + let bits = newBits(lo, hi); + // If we're treating the input as a signed value and the high bit is set, do + // a manual two's complement conversion before the decimal conversion. + const negative = bits.hi & 0x80000000; + if (negative) { + bits = negate(bits.lo, bits.hi); + } + const result = uInt64ToString(bits.lo, bits.hi); + return negative ? "-" + result : result; +} + +/** + * Losslessly converts a 64-bit unsigned integer in 32:32 split representation + * into a decimal string. + * + * Copyright 2008 Google Inc. All rights reserved. + * + * See https://github.com/protocolbuffers/protobuf-javascript/blob/a428c58273abad07c66071d9753bc4d1289de426/experimental/runtime/int64.js#L10 + */ +export function uInt64ToString(lo: number, hi: number): string { + ({ lo, hi } = toUnsigned(lo, hi)); + // Skip the expensive conversion if the number is small enough to use the + // built-in conversions. + // Number.MAX_SAFE_INTEGER = 0x001FFFFF FFFFFFFF, thus any number with + // highBits <= 0x1FFFFF can be safely expressed with a double and retain + // integer precision. + // Proven by: Number.isSafeInteger(0x1FFFFF * 2**32 + 0xFFFFFFFF) == true. + if (hi <= 0x1fffff) { + return String(TWO_PWR_32_DBL * hi + lo); + } + + // What this code is doing is essentially converting the input number from + // base-2 to base-1e7, which allows us to represent the 64-bit range with + // only 3 (very large) digits. Those digits are then trivial to convert to + // a base-10 string. + + // The magic numbers used here are - + // 2^24 = 16777216 = (1,6777216) in base-1e7. + // 2^48 = 281474976710656 = (2,8147497,6710656) in base-1e7. + + // Split 32:32 representation into 16:24:24 representation so our + // intermediate digits don't overflow. + const low = lo & 0xffffff; + const mid = ((lo >>> 24) | (hi << 8)) & 0xffffff; + const high = (hi >> 16) & 0xffff; + + // Assemble our three base-1e7 digits, ignoring carries. The maximum + // value in a digit at this step is representable as a 48-bit integer, which + // can be stored in a 64-bit floating point number. + let digitA = low + mid * 6777216 + high * 6710656; + let digitB = mid + high * 8147497; + let digitC = high * 2; + + // Apply carries from A to B and from B to C. + const base = 10000000; + if (digitA >= base) { + digitB += Math.floor(digitA / base); + digitA %= base; + } + + if (digitB >= base) { + digitC += Math.floor(digitB / base); + digitB %= base; + } + + // If digitC is 0, then we should have returned in the trivial code path + // at the top for non-safe integers. Given this, we can assume both digitB + // and digitA need leading zeros. + return ( + digitC.toString() + + decimalFrom1e7WithLeadingZeros(digitB) + + decimalFrom1e7WithLeadingZeros(digitA) + ); +} + +function toUnsigned(lo: number, hi: number): { lo: number; hi: number } { + return { lo: lo >>> 0, hi: hi >>> 0 }; +} + +function newBits(lo: number, hi: number): { lo: number; hi: number } { + return { lo: lo | 0, hi: hi | 0 }; +} + +/** + * Returns two's compliment negation of input. + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Signed_32-bit_integers + */ +function negate(lowBits: number, highBits: number) { + highBits = ~highBits; + if (lowBits) { + lowBits = ~lowBits + 1; + } else { + // If lowBits is 0, then bitwise-not is 0xFFFFFFFF, + // adding 1 to that, results in 0x100000000, which leaves + // the low bits 0x0 and simply adds one to the high bits. + highBits += 1; + } + return newBits(lowBits, highBits); +} + +/** + * Returns decimal representation of digit1e7 with leading zeros. + */ +const decimalFrom1e7WithLeadingZeros = (digit1e7: number) => { + const partial = String(digit1e7); + return "0000000".slice(partial.length) + partial; +}; + +/** + * Write a 32 bit varint, signed or unsigned. Same as `varint64write(0, value, bytes)` + * + * Copyright 2008 Google Inc. All rights reserved. + * + * See https://github.com/protocolbuffers/protobuf/blob/1b18833f4f2a2f681f4e4a25cdf3b0a43115ec26/js/binary/encoder.js#L144 + */ +export function varint32write(value: number, bytes: number[]): void { + if (value >= 0) { + // write value as varint 32 + while (value > 0x7f) { + bytes.push((value & 0x7f) | 0x80); + value = value >>> 7; + } + bytes.push(value); + } else { + for (let i = 0; i < 9; i++) { + bytes.push((value & 127) | 128); + value = value >> 7; + } + bytes.push(1); + } +} + +/** + * Read an unsigned 32 bit varint. + * + * See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/buffer_decoder.js#L220 + */ +export function varint32read(this: ReaderLike): number { + let b = this.buf[this.pos++]; + let result = b & 0x7f; + if ((b & 0x80) == 0) { + this.assertBounds(); + return result; + } + + b = this.buf[this.pos++]; + result |= (b & 0x7f) << 7; + if ((b & 0x80) == 0) { + this.assertBounds(); + return result; + } + + b = this.buf[this.pos++]; + result |= (b & 0x7f) << 14; + if ((b & 0x80) == 0) { + this.assertBounds(); + return result; + } + + b = this.buf[this.pos++]; + result |= (b & 0x7f) << 21; + if ((b & 0x80) == 0) { + this.assertBounds(); + return result; + } + + // Extract only last 4 bits + b = this.buf[this.pos++]; + result |= (b & 0x0f) << 28; + + for (let readBytes = 5; (b & 0x80) !== 0 && readBytes < 10; readBytes++) + b = this.buf[this.pos++]; + + if ((b & 0x80) != 0) throw new Error("invalid varint"); + + this.assertBounds(); + + // Result can have 32 bits, convert it to unsigned + return result >>> 0; +} + +type ReaderLike = { + buf: Uint8Array; + pos: number; + len: number; + assertBounds(): void; +}; + +/** + * encode zig zag + */ +export function zzEncode(lo: number, hi: number) { + let mask = hi >> 31; + hi = (((hi << 1) | (lo >>> 31)) ^ mask) >>> 0; + lo = ((lo << 1) ^ mask) >>> 0; + return [lo, hi]; +} + +/** + * decode zig zag + */ +export function zzDecode(lo: number, hi: number) { + let mask = -(lo & 1); + lo = (((lo >>> 1) | (hi << 31)) ^ mask) >>> 0; + hi = ((hi >>> 1) ^ mask) >>> 0; + return [lo, hi]; +} + +/** + * unsigned int32 without moving pos. + */ +export function readUInt32(buf: Uint8Array, pos: number) { + return ( + (buf[pos] | (buf[pos + 1] << 8) | (buf[pos + 2] << 16)) + + buf[pos + 3] * 0x1000000 + ); +} + +/** + * signed int32 without moving pos. + */ +export function readInt32(buf: Uint8Array, pos: number) { + return ( + (buf[pos] | (buf[pos + 1] << 8) | (buf[pos + 2] << 16)) + + (buf[pos + 3] << 24) + ); +} + +/** + * writing varint32 to pos + */ +export function writeVarint32( + val: number, + buf: Uint8Array | number[], + pos: number +) { + while (val > 127) { + buf[pos++] = (val & 127) | 128; + val >>>= 7; + } + buf[pos] = val; +} + +/** + * writing varint64 to pos + */ +export function writeVarint64( + val: { lo: number; hi: number }, + buf: Uint8Array | number[], + pos: number +) { + while (val.hi) { + buf[pos++] = (val.lo & 127) | 128; + val.lo = ((val.lo >>> 7) | (val.hi << 25)) >>> 0; + val.hi >>>= 7; + } + while (val.lo > 127) { + buf[pos++] = (val.lo & 127) | 128; + val.lo = val.lo >>> 7; + } + buf[pos++] = val.lo; +} + +export function int64Length(lo: number, hi: number) { + let part0 = lo, + part1 = ((lo >>> 28) | (hi << 4)) >>> 0, + part2 = hi >>> 24; + return part2 === 0 + ? part1 === 0 + ? part0 < 16384 + ? part0 < 128 + ? 1 + : 2 + : part0 < 2097152 + ? 3 + : 4 + : part1 < 16384 + ? part1 < 128 + ? 5 + : 6 + : part1 < 2097152 + ? 7 + : 8 + : part2 < 128 + ? 9 + : 10; +} + +export function writeFixed32( + val: number, + buf: Uint8Array | number[], + pos: number +) { + buf[pos] = val & 255; + buf[pos + 1] = (val >>> 8) & 255; + buf[pos + 2] = (val >>> 16) & 255; + buf[pos + 3] = val >>> 24; +} + +export function writeByte( + val: number, + buf: Uint8Array | number[], + pos: number +) { + buf[pos] = val & 255; +} diff --git a/libs/interchain-query/tsconfig.esm.json b/libs/interchain-query/tsconfig.esm.json new file mode 100644 index 00000000..800d7506 --- /dev/null +++ b/libs/interchain-query/tsconfig.esm.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "dist/esm", + "module": "es2022", + "rootDir": "src/", + "declaration": false + } +} diff --git a/libs/interchain-query/tsconfig.json b/libs/interchain-query/tsconfig.json new file mode 100644 index 00000000..1a9d5696 --- /dev/null +++ b/libs/interchain-query/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "dist", + "rootDir": "src/" + }, + "include": ["src/**/*.ts"], + "exclude": ["dist", "node_modules", "**/*.spec.*", "**/*.test.*"] +} diff --git a/libs/interchainjs/README.md b/libs/interchainjs/README.md index 97ede840..7e697b67 100644 --- a/libs/interchainjs/README.md +++ b/libs/interchainjs/README.md @@ -14,8 +14,6 @@ Functionalities(Tx, Query) generated by Telescope. -⚠️ **This software is currently in a Development Preview Alpha stage.** We're refactoring helper functions generated by Telescope. Leaner helper functions coming soon! - ## License MIT License (MIT) & Apache License diff --git a/libs/interchainjs/package.json b/libs/interchainjs/package.json index 08a746d5..fd0ed478 100644 --- a/libs/interchainjs/package.json +++ b/libs/interchainjs/package.json @@ -1,7 +1,7 @@ { "name": "interchainjs", "version": "0.0.1-beta.36", - "description": "Wrapper of @interchainjs/auth and @interchainjs/cosmos to fit corresponding interfaces in @cosmjs", + "description": "InterchainJS is a JavaScript library for interacting with Cosmos SDK based blockchains.", "main": "index.js", "module": "esm/index.js", "types": "index.d.ts", diff --git a/libs/interchainjs/src/cosmos/auth/v1beta1/query.rpc.func.ts b/libs/interchainjs/src/cosmos/auth/v1beta1/query.rpc.func.ts index 55204af9..9a6e4931 100644 --- a/libs/interchainjs/src/cosmos/auth/v1beta1/query.rpc.func.ts +++ b/libs/interchainjs/src/cosmos/auth/v1beta1/query.rpc.func.ts @@ -1,5 +1,4 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; -import { buildUseQuery } from "../../../react-query"; import { QueryAccountsRequest, QueryAccountsResponse, QueryAccountRequest, QueryAccountResponse, QueryAccountAddressByIDRequest, QueryAccountAddressByIDResponse, QueryParamsRequest, QueryParamsResponse, QueryModuleAccountsRequest, QueryModuleAccountsResponse, QueryModuleAccountByNameRequest, QueryModuleAccountByNameResponse, Bech32PrefixRequest, Bech32PrefixResponse, AddressBytesToStringRequest, AddressBytesToStringResponse, AddressStringToBytesRequest, AddressStringToBytesResponse, QueryAccountInfoRequest, QueryAccountInfoResponse } from "./query"; export const createGetAccounts = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryAccountsRequest.encode, @@ -8,10 +7,6 @@ export const createGetAccounts = (clientResolver?: RpcResolver) => buildQuery({ - builderQueryFn: createGetAccounts, - queryKeyPrefix: "AccountsQuery" -}); export const createGetAccount = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryAccountRequest.encode, decode: QueryAccountResponse.decode, @@ -19,10 +14,6 @@ export const createGetAccount = (clientResolver?: RpcResolver) => buildQuery({ - builderQueryFn: createGetAccount, - queryKeyPrefix: "AccountQuery" -}); export const createGetAccountAddressByID = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryAccountAddressByIDRequest.encode, decode: QueryAccountAddressByIDResponse.decode, @@ -30,10 +21,6 @@ export const createGetAccountAddressByID = (clientResolver?: RpcResolver) => bui method: "AccountAddressByID", clientResolver }); -export const useGetAccountAddressByID = buildUseQuery({ - builderQueryFn: createGetAccountAddressByID, - queryKeyPrefix: "AccountAddressByIDQuery" -}); export const createGetParams = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryParamsRequest.encode, decode: QueryParamsResponse.decode, @@ -41,10 +28,6 @@ export const createGetParams = (clientResolver?: RpcResolver) => buildQuery({ - builderQueryFn: createGetParams, - queryKeyPrefix: "ParamsQuery" -}); export const createGetModuleAccounts = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryModuleAccountsRequest.encode, decode: QueryModuleAccountsResponse.decode, @@ -52,10 +35,6 @@ export const createGetModuleAccounts = (clientResolver?: RpcResolver) => buildQu method: "ModuleAccounts", clientResolver }); -export const useGetModuleAccounts = buildUseQuery({ - builderQueryFn: createGetModuleAccounts, - queryKeyPrefix: "ModuleAccountsQuery" -}); export const createGetModuleAccountByName = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryModuleAccountByNameRequest.encode, decode: QueryModuleAccountByNameResponse.decode, @@ -63,10 +42,6 @@ export const createGetModuleAccountByName = (clientResolver?: RpcResolver) => bu method: "ModuleAccountByName", clientResolver }); -export const useGetModuleAccountByName = buildUseQuery({ - builderQueryFn: createGetModuleAccountByName, - queryKeyPrefix: "ModuleAccountByNameQuery" -}); export const createGetBech32Prefix = (clientResolver?: RpcResolver) => buildQuery({ encode: Bech32PrefixRequest.encode, decode: Bech32PrefixResponse.decode, @@ -74,10 +49,6 @@ export const createGetBech32Prefix = (clientResolver?: RpcResolver) => buildQuer method: "Bech32Prefix", clientResolver }); -export const useGetBech32Prefix = buildUseQuery({ - builderQueryFn: createGetBech32Prefix, - queryKeyPrefix: "Bech32PrefixQuery" -}); export const createGetAddressBytesToString = (clientResolver?: RpcResolver) => buildQuery({ encode: AddressBytesToStringRequest.encode, decode: AddressBytesToStringResponse.decode, @@ -85,10 +56,6 @@ export const createGetAddressBytesToString = (clientResolver?: RpcResolver) => b method: "AddressBytesToString", clientResolver }); -export const useGetAddressBytesToString = buildUseQuery({ - builderQueryFn: createGetAddressBytesToString, - queryKeyPrefix: "AddressBytesToStringQuery" -}); export const createGetAddressStringToBytes = (clientResolver?: RpcResolver) => buildQuery({ encode: AddressStringToBytesRequest.encode, decode: AddressStringToBytesResponse.decode, @@ -96,18 +63,10 @@ export const createGetAddressStringToBytes = (clientResolver?: RpcResolver) => b method: "AddressStringToBytes", clientResolver }); -export const useGetAddressStringToBytes = buildUseQuery({ - builderQueryFn: createGetAddressStringToBytes, - queryKeyPrefix: "AddressStringToBytesQuery" -}); export const createGetAccountInfo = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryAccountInfoRequest.encode, decode: QueryAccountInfoResponse.decode, service: "cosmos.auth.v1beta1.Query", method: "AccountInfo", clientResolver -}); -export const useGetAccountInfo = buildUseQuery({ - builderQueryFn: createGetAccountInfo, - queryKeyPrefix: "AccountInfoQuery" }); \ No newline at end of file diff --git a/libs/interchainjs/src/cosmos/authz/v1beta1/tx.rpc.func.ts b/libs/interchainjs/src/cosmos/authz/v1beta1/tx.rpc.func.ts index de818f66..18006a6c 100644 --- a/libs/interchainjs/src/cosmos/authz/v1beta1/tx.rpc.func.ts +++ b/libs/interchainjs/src/cosmos/authz/v1beta1/tx.rpc.func.ts @@ -1,5 +1,4 @@ import { buildTx, SigningClientResolver } from "../../../helper-func-types"; -import { buildUseMutation } from "../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgGrant, MsgExec, MsgRevoke } from "./tx"; export const createGrant = (clientResolver?: SigningClientResolver) => buildTx({ @@ -8,24 +7,15 @@ export const createGrant = (clientResolver?: SigningClientResolver) => buildTx({ - builderMutationFn: createGrant -}); export const createExec = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgExec.typeUrl, encoders: toEncoders(MsgExec), converters: toConverters(MsgExec) }); -export const useExec = buildUseMutation({ - builderMutationFn: createExec -}); export const createRevoke = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgRevoke.typeUrl, encoders: toEncoders(MsgRevoke), converters: toConverters(MsgRevoke) -}); -export const useRevoke = buildUseMutation({ - builderMutationFn: createRevoke }); \ No newline at end of file diff --git a/libs/interchainjs/src/cosmos/bank/v1beta1/query.rpc.func.ts b/libs/interchainjs/src/cosmos/bank/v1beta1/query.rpc.func.ts index 3ba6a682..dc21baf8 100644 --- a/libs/interchainjs/src/cosmos/bank/v1beta1/query.rpc.func.ts +++ b/libs/interchainjs/src/cosmos/bank/v1beta1/query.rpc.func.ts @@ -1,5 +1,4 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; -import { buildUseQuery } from "../../../react-query"; import { QueryBalanceRequest, QueryBalanceResponse, QueryAllBalancesRequest, QueryAllBalancesResponse, QuerySpendableBalancesRequest, QuerySpendableBalancesResponse, QuerySpendableBalanceByDenomRequest, QuerySpendableBalanceByDenomResponse, QueryTotalSupplyRequest, QueryTotalSupplyResponse, QuerySupplyOfRequest, QuerySupplyOfResponse, QueryParamsRequest, QueryParamsResponse, QueryDenomMetadataRequest, QueryDenomMetadataResponse, QueryDenomMetadataByQueryStringRequest, QueryDenomMetadataByQueryStringResponse, QueryDenomsMetadataRequest, QueryDenomsMetadataResponse, QueryDenomOwnersRequest, QueryDenomOwnersResponse, QueryDenomOwnersByQueryRequest, QueryDenomOwnersByQueryResponse, QuerySendEnabledRequest, QuerySendEnabledResponse } from "./query"; export const createGetBalance = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryBalanceRequest.encode, @@ -8,10 +7,6 @@ export const createGetBalance = (clientResolver?: RpcResolver) => buildQuery({ - builderQueryFn: createGetBalance, - queryKeyPrefix: "BalanceQuery" -}); export const createGetAllBalances = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryAllBalancesRequest.encode, decode: QueryAllBalancesResponse.decode, @@ -19,10 +14,6 @@ export const createGetAllBalances = (clientResolver?: RpcResolver) => buildQuery method: "AllBalances", clientResolver }); -export const useGetAllBalances = buildUseQuery({ - builderQueryFn: createGetAllBalances, - queryKeyPrefix: "AllBalancesQuery" -}); export const createGetSpendableBalances = (clientResolver?: RpcResolver) => buildQuery({ encode: QuerySpendableBalancesRequest.encode, decode: QuerySpendableBalancesResponse.decode, @@ -30,10 +21,6 @@ export const createGetSpendableBalances = (clientResolver?: RpcResolver) => buil method: "SpendableBalances", clientResolver }); -export const useGetSpendableBalances = buildUseQuery({ - builderQueryFn: createGetSpendableBalances, - queryKeyPrefix: "SpendableBalancesQuery" -}); export const createGetSpendableBalanceByDenom = (clientResolver?: RpcResolver) => buildQuery({ encode: QuerySpendableBalanceByDenomRequest.encode, decode: QuerySpendableBalanceByDenomResponse.decode, @@ -41,10 +28,6 @@ export const createGetSpendableBalanceByDenom = (clientResolver?: RpcResolver) = method: "SpendableBalanceByDenom", clientResolver }); -export const useGetSpendableBalanceByDenom = buildUseQuery({ - builderQueryFn: createGetSpendableBalanceByDenom, - queryKeyPrefix: "SpendableBalanceByDenomQuery" -}); export const createGetTotalSupply = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryTotalSupplyRequest.encode, decode: QueryTotalSupplyResponse.decode, @@ -52,10 +35,6 @@ export const createGetTotalSupply = (clientResolver?: RpcResolver) => buildQuery method: "TotalSupply", clientResolver }); -export const useGetTotalSupply = buildUseQuery({ - builderQueryFn: createGetTotalSupply, - queryKeyPrefix: "TotalSupplyQuery" -}); export const createGetSupplyOf = (clientResolver?: RpcResolver) => buildQuery({ encode: QuerySupplyOfRequest.encode, decode: QuerySupplyOfResponse.decode, @@ -63,10 +42,6 @@ export const createGetSupplyOf = (clientResolver?: RpcResolver) => buildQuery({ - builderQueryFn: createGetSupplyOf, - queryKeyPrefix: "SupplyOfQuery" -}); export const createGetParams = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryParamsRequest.encode, decode: QueryParamsResponse.decode, @@ -74,10 +49,6 @@ export const createGetParams = (clientResolver?: RpcResolver) => buildQuery({ - builderQueryFn: createGetParams, - queryKeyPrefix: "ParamsQuery" -}); export const createGetDenomMetadata = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryDenomMetadataRequest.encode, decode: QueryDenomMetadataResponse.decode, @@ -85,10 +56,6 @@ export const createGetDenomMetadata = (clientResolver?: RpcResolver) => buildQue method: "DenomMetadata", clientResolver }); -export const useGetDenomMetadata = buildUseQuery({ - builderQueryFn: createGetDenomMetadata, - queryKeyPrefix: "DenomMetadataQuery" -}); export const createGetDenomMetadataByQueryString = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryDenomMetadataByQueryStringRequest.encode, decode: QueryDenomMetadataByQueryStringResponse.decode, @@ -96,10 +63,6 @@ export const createGetDenomMetadataByQueryString = (clientResolver?: RpcResolver method: "DenomMetadataByQueryString", clientResolver }); -export const useGetDenomMetadataByQueryString = buildUseQuery({ - builderQueryFn: createGetDenomMetadataByQueryString, - queryKeyPrefix: "DenomMetadataByQueryStringQuery" -}); export const createGetDenomsMetadata = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryDenomsMetadataRequest.encode, decode: QueryDenomsMetadataResponse.decode, @@ -107,10 +70,6 @@ export const createGetDenomsMetadata = (clientResolver?: RpcResolver) => buildQu method: "DenomsMetadata", clientResolver }); -export const useGetDenomsMetadata = buildUseQuery({ - builderQueryFn: createGetDenomsMetadata, - queryKeyPrefix: "DenomsMetadataQuery" -}); export const createGetDenomOwners = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryDenomOwnersRequest.encode, decode: QueryDenomOwnersResponse.decode, @@ -118,10 +77,6 @@ export const createGetDenomOwners = (clientResolver?: RpcResolver) => buildQuery method: "DenomOwners", clientResolver }); -export const useGetDenomOwners = buildUseQuery({ - builderQueryFn: createGetDenomOwners, - queryKeyPrefix: "DenomOwnersQuery" -}); export const createGetDenomOwnersByQuery = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryDenomOwnersByQueryRequest.encode, decode: QueryDenomOwnersByQueryResponse.decode, @@ -129,18 +84,10 @@ export const createGetDenomOwnersByQuery = (clientResolver?: RpcResolver) => bui method: "DenomOwnersByQuery", clientResolver }); -export const useGetDenomOwnersByQuery = buildUseQuery({ - builderQueryFn: createGetDenomOwnersByQuery, - queryKeyPrefix: "DenomOwnersByQueryQuery" -}); export const createGetSendEnabled = (clientResolver?: RpcResolver) => buildQuery({ encode: QuerySendEnabledRequest.encode, decode: QuerySendEnabledResponse.decode, service: "cosmos.bank.v1beta1.Query", method: "SendEnabled", clientResolver -}); -export const useGetSendEnabled = buildUseQuery({ - builderQueryFn: createGetSendEnabled, - queryKeyPrefix: "SendEnabledQuery" }); \ No newline at end of file diff --git a/libs/interchainjs/src/cosmos/bank/v1beta1/tx.rpc.func.ts b/libs/interchainjs/src/cosmos/bank/v1beta1/tx.rpc.func.ts index aa76bfe3..fa81e316 100644 --- a/libs/interchainjs/src/cosmos/bank/v1beta1/tx.rpc.func.ts +++ b/libs/interchainjs/src/cosmos/bank/v1beta1/tx.rpc.func.ts @@ -1,5 +1,4 @@ import { buildTx, SigningClientResolver } from "../../../helper-func-types"; -import { buildUseMutation } from "../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgSend, MsgMultiSend, MsgUpdateParams, MsgSetSendEnabled } from "./tx"; export const createSend = (clientResolver?: SigningClientResolver) => buildTx({ @@ -8,33 +7,21 @@ export const createSend = (clientResolver?: SigningClientResolver) => buildTx({ - builderMutationFn: createSend -}); export const createMultiSend = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgMultiSend.typeUrl, encoders: toEncoders(MsgMultiSend), converters: toConverters(MsgMultiSend) }); -export const useMultiSend = buildUseMutation({ - builderMutationFn: createMultiSend -}); export const createUpdateParams = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgUpdateParams.typeUrl, encoders: toEncoders(MsgUpdateParams), converters: toConverters(MsgUpdateParams) }); -export const useUpdateParams = buildUseMutation({ - builderMutationFn: createUpdateParams -}); export const createSetSendEnabled = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgSetSendEnabled.typeUrl, encoders: toEncoders(MsgSetSendEnabled), converters: toConverters(MsgSetSendEnabled) -}); -export const useSetSendEnabled = buildUseMutation({ - builderMutationFn: createSetSendEnabled }); \ No newline at end of file diff --git a/libs/interchainjs/src/cosmos/distribution/v1beta1/tx.rpc.func.ts b/libs/interchainjs/src/cosmos/distribution/v1beta1/tx.rpc.func.ts index 79204615..0323b14d 100644 --- a/libs/interchainjs/src/cosmos/distribution/v1beta1/tx.rpc.func.ts +++ b/libs/interchainjs/src/cosmos/distribution/v1beta1/tx.rpc.func.ts @@ -1,5 +1,4 @@ import { buildTx, SigningClientResolver } from "../../../helper-func-types"; -import { buildUseMutation } from "../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgSetWithdrawAddress, MsgWithdrawDelegatorReward, MsgWithdrawValidatorCommission, MsgFundCommunityPool, MsgUpdateParams, MsgCommunityPoolSpend, MsgDepositValidatorRewardsPool } from "./tx"; export const createSetWithdrawAddress = (clientResolver?: SigningClientResolver) => buildTx({ @@ -8,60 +7,39 @@ export const createSetWithdrawAddress = (clientResolver?: SigningClientResolver) encoders: toEncoders(MsgSetWithdrawAddress), converters: toConverters(MsgSetWithdrawAddress) }); -export const useSetWithdrawAddress = buildUseMutation({ - builderMutationFn: createSetWithdrawAddress -}); export const createWithdrawDelegatorReward = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgWithdrawDelegatorReward.typeUrl, encoders: toEncoders(MsgWithdrawDelegatorReward), converters: toConverters(MsgWithdrawDelegatorReward) }); -export const useWithdrawDelegatorReward = buildUseMutation({ - builderMutationFn: createWithdrawDelegatorReward -}); export const createWithdrawValidatorCommission = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgWithdrawValidatorCommission.typeUrl, encoders: toEncoders(MsgWithdrawValidatorCommission), converters: toConverters(MsgWithdrawValidatorCommission) }); -export const useWithdrawValidatorCommission = buildUseMutation({ - builderMutationFn: createWithdrawValidatorCommission -}); export const createFundCommunityPool = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgFundCommunityPool.typeUrl, encoders: toEncoders(MsgFundCommunityPool), converters: toConverters(MsgFundCommunityPool) }); -export const useFundCommunityPool = buildUseMutation({ - builderMutationFn: createFundCommunityPool -}); export const createUpdateParams = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgUpdateParams.typeUrl, encoders: toEncoders(MsgUpdateParams), converters: toConverters(MsgUpdateParams) }); -export const useUpdateParams = buildUseMutation({ - builderMutationFn: createUpdateParams -}); export const createCommunityPoolSpend = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgCommunityPoolSpend.typeUrl, encoders: toEncoders(MsgCommunityPoolSpend), converters: toConverters(MsgCommunityPoolSpend) }); -export const useCommunityPoolSpend = buildUseMutation({ - builderMutationFn: createCommunityPoolSpend -}); export const createDepositValidatorRewardsPool = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgDepositValidatorRewardsPool.typeUrl, encoders: toEncoders(MsgDepositValidatorRewardsPool), converters: toConverters(MsgDepositValidatorRewardsPool) -}); -export const useDepositValidatorRewardsPool = buildUseMutation({ - builderMutationFn: createDepositValidatorRewardsPool }); \ No newline at end of file diff --git a/libs/interchainjs/src/cosmos/feegrant/v1beta1/tx.rpc.func.ts b/libs/interchainjs/src/cosmos/feegrant/v1beta1/tx.rpc.func.ts index 3cfc4271..aa73f97f 100644 --- a/libs/interchainjs/src/cosmos/feegrant/v1beta1/tx.rpc.func.ts +++ b/libs/interchainjs/src/cosmos/feegrant/v1beta1/tx.rpc.func.ts @@ -1,5 +1,4 @@ import { buildTx, SigningClientResolver } from "../../../helper-func-types"; -import { buildUseMutation } from "../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgGrantAllowance, MsgRevokeAllowance, MsgPruneAllowances } from "./tx"; export const createGrantAllowance = (clientResolver?: SigningClientResolver) => buildTx({ @@ -8,24 +7,15 @@ export const createGrantAllowance = (clientResolver?: SigningClientResolver) => encoders: toEncoders(MsgGrantAllowance), converters: toConverters(MsgGrantAllowance) }); -export const useGrantAllowance = buildUseMutation({ - builderMutationFn: createGrantAllowance -}); export const createRevokeAllowance = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgRevokeAllowance.typeUrl, encoders: toEncoders(MsgRevokeAllowance), converters: toConverters(MsgRevokeAllowance) }); -export const useRevokeAllowance = buildUseMutation({ - builderMutationFn: createRevokeAllowance -}); export const createPruneAllowances = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgPruneAllowances.typeUrl, encoders: toEncoders(MsgPruneAllowances), converters: toConverters(MsgPruneAllowances) -}); -export const usePruneAllowances = buildUseMutation({ - builderMutationFn: createPruneAllowances }); \ No newline at end of file diff --git a/libs/interchainjs/src/cosmos/gov/v1/tx.rpc.func.ts b/libs/interchainjs/src/cosmos/gov/v1/tx.rpc.func.ts index cb094f2e..0fe35d3a 100644 --- a/libs/interchainjs/src/cosmos/gov/v1/tx.rpc.func.ts +++ b/libs/interchainjs/src/cosmos/gov/v1/tx.rpc.func.ts @@ -1,5 +1,4 @@ import { buildTx, SigningClientResolver } from "../../../helper-func-types"; -import { buildUseMutation } from "../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgSubmitProposal, MsgExecLegacyContent, MsgVote, MsgVoteWeighted, MsgDeposit, MsgUpdateParams, MsgCancelProposal } from "./tx"; export const createSubmitProposal = (clientResolver?: SigningClientResolver) => buildTx({ @@ -8,60 +7,39 @@ export const createSubmitProposal = (clientResolver?: SigningClientResolver) => encoders: toEncoders(MsgSubmitProposal), converters: toConverters(MsgSubmitProposal) }); -export const useSubmitProposal = buildUseMutation({ - builderMutationFn: createSubmitProposal -}); export const createExecLegacyContent = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgExecLegacyContent.typeUrl, encoders: toEncoders(MsgExecLegacyContent), converters: toConverters(MsgExecLegacyContent) }); -export const useExecLegacyContent = buildUseMutation({ - builderMutationFn: createExecLegacyContent -}); export const createVote = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgVote.typeUrl, encoders: toEncoders(MsgVote), converters: toConverters(MsgVote) }); -export const useVote = buildUseMutation({ - builderMutationFn: createVote -}); export const createVoteWeighted = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgVoteWeighted.typeUrl, encoders: toEncoders(MsgVoteWeighted), converters: toConverters(MsgVoteWeighted) }); -export const useVoteWeighted = buildUseMutation({ - builderMutationFn: createVoteWeighted -}); export const createDeposit = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgDeposit.typeUrl, encoders: toEncoders(MsgDeposit), converters: toConverters(MsgDeposit) }); -export const useDeposit = buildUseMutation({ - builderMutationFn: createDeposit -}); export const createUpdateParams = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgUpdateParams.typeUrl, encoders: toEncoders(MsgUpdateParams), converters: toConverters(MsgUpdateParams) }); -export const useUpdateParams = buildUseMutation({ - builderMutationFn: createUpdateParams -}); export const createCancelProposal = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgCancelProposal.typeUrl, encoders: toEncoders(MsgCancelProposal), converters: toConverters(MsgCancelProposal) -}); -export const useCancelProposal = buildUseMutation({ - builderMutationFn: createCancelProposal }); \ No newline at end of file diff --git a/libs/interchainjs/src/cosmos/gov/v1beta1/query.rpc.func.ts b/libs/interchainjs/src/cosmos/gov/v1beta1/query.rpc.func.ts index 5add14c4..eadeddd8 100644 --- a/libs/interchainjs/src/cosmos/gov/v1beta1/query.rpc.func.ts +++ b/libs/interchainjs/src/cosmos/gov/v1beta1/query.rpc.func.ts @@ -1,5 +1,4 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; -import { buildUseQuery } from "../../../react-query"; import { QueryProposalRequest, QueryProposalResponse, QueryProposalsRequest, QueryProposalsResponse, QueryVoteRequest, QueryVoteResponse, QueryVotesRequest, QueryVotesResponse, QueryParamsRequest, QueryParamsResponse, QueryDepositRequest, QueryDepositResponse, QueryDepositsRequest, QueryDepositsResponse, QueryTallyResultRequest, QueryTallyResultResponse } from "./query"; export const createGetProposal = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryProposalRequest.encode, @@ -8,10 +7,6 @@ export const createGetProposal = (clientResolver?: RpcResolver) => buildQuery({ - builderQueryFn: createGetProposal, - queryKeyPrefix: "ProposalQuery" -}); export const createGetProposals = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryProposalsRequest.encode, decode: QueryProposalsResponse.decode, @@ -19,10 +14,6 @@ export const createGetProposals = (clientResolver?: RpcResolver) => buildQuery({ - builderQueryFn: createGetProposals, - queryKeyPrefix: "ProposalsQuery" -}); export const createGetVote = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryVoteRequest.encode, decode: QueryVoteResponse.decode, @@ -30,10 +21,6 @@ export const createGetVote = (clientResolver?: RpcResolver) => buildQuery({ - builderQueryFn: createGetVote, - queryKeyPrefix: "VoteQuery" -}); export const createGetVotes = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryVotesRequest.encode, decode: QueryVotesResponse.decode, @@ -41,10 +28,6 @@ export const createGetVotes = (clientResolver?: RpcResolver) => buildQuery({ - builderQueryFn: createGetVotes, - queryKeyPrefix: "VotesQuery" -}); export const createGetParams = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryParamsRequest.encode, decode: QueryParamsResponse.decode, @@ -52,10 +35,6 @@ export const createGetParams = (clientResolver?: RpcResolver) => buildQuery({ - builderQueryFn: createGetParams, - queryKeyPrefix: "ParamsQuery" -}); export const createGetDeposit = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryDepositRequest.encode, decode: QueryDepositResponse.decode, @@ -63,10 +42,6 @@ export const createGetDeposit = (clientResolver?: RpcResolver) => buildQuery({ - builderQueryFn: createGetDeposit, - queryKeyPrefix: "DepositQuery" -}); export const createGetDeposits = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryDepositsRequest.encode, decode: QueryDepositsResponse.decode, @@ -74,18 +49,10 @@ export const createGetDeposits = (clientResolver?: RpcResolver) => buildQuery({ - builderQueryFn: createGetDeposits, - queryKeyPrefix: "DepositsQuery" -}); export const createGetTallyResult = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryTallyResultRequest.encode, decode: QueryTallyResultResponse.decode, service: "cosmos.gov.v1beta1.Query", method: "TallyResult", clientResolver -}); -export const useGetTallyResult = buildUseQuery({ - builderQueryFn: createGetTallyResult, - queryKeyPrefix: "TallyResultQuery" }); \ No newline at end of file diff --git a/libs/interchainjs/src/cosmos/gov/v1beta1/tx.rpc.func.ts b/libs/interchainjs/src/cosmos/gov/v1beta1/tx.rpc.func.ts index ff3449ec..222ecb6c 100644 --- a/libs/interchainjs/src/cosmos/gov/v1beta1/tx.rpc.func.ts +++ b/libs/interchainjs/src/cosmos/gov/v1beta1/tx.rpc.func.ts @@ -1,5 +1,4 @@ import { buildTx, SigningClientResolver } from "../../../helper-func-types"; -import { buildUseMutation } from "../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgSubmitProposal, MsgVote, MsgVoteWeighted, MsgDeposit } from "./tx"; export const createSubmitProposal = (clientResolver?: SigningClientResolver) => buildTx({ @@ -8,33 +7,21 @@ export const createSubmitProposal = (clientResolver?: SigningClientResolver) => encoders: toEncoders(MsgSubmitProposal), converters: toConverters(MsgSubmitProposal) }); -export const useSubmitProposal = buildUseMutation({ - builderMutationFn: createSubmitProposal -}); export const createVote = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgVote.typeUrl, encoders: toEncoders(MsgVote), converters: toConverters(MsgVote) }); -export const useVote = buildUseMutation({ - builderMutationFn: createVote -}); export const createVoteWeighted = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgVoteWeighted.typeUrl, encoders: toEncoders(MsgVoteWeighted), converters: toConverters(MsgVoteWeighted) }); -export const useVoteWeighted = buildUseMutation({ - builderMutationFn: createVoteWeighted -}); export const createDeposit = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgDeposit.typeUrl, encoders: toEncoders(MsgDeposit), converters: toConverters(MsgDeposit) -}); -export const useDeposit = buildUseMutation({ - builderMutationFn: createDeposit }); \ No newline at end of file diff --git a/libs/interchainjs/src/cosmos/group/v1/tx.rpc.func.ts b/libs/interchainjs/src/cosmos/group/v1/tx.rpc.func.ts index 95673a00..28648bdd 100644 --- a/libs/interchainjs/src/cosmos/group/v1/tx.rpc.func.ts +++ b/libs/interchainjs/src/cosmos/group/v1/tx.rpc.func.ts @@ -1,5 +1,4 @@ import { buildTx, SigningClientResolver } from "../../../helper-func-types"; -import { buildUseMutation } from "../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgCreateGroup, MsgUpdateGroupMembers, MsgUpdateGroupAdmin, MsgUpdateGroupMetadata, MsgCreateGroupPolicy, MsgCreateGroupWithPolicy, MsgUpdateGroupPolicyAdmin, MsgUpdateGroupPolicyDecisionPolicy, MsgUpdateGroupPolicyMetadata, MsgSubmitProposal, MsgWithdrawProposal, MsgVote, MsgExec, MsgLeaveGroup } from "./tx"; export const createCreateGroup = (clientResolver?: SigningClientResolver) => buildTx({ @@ -8,123 +7,81 @@ export const createCreateGroup = (clientResolver?: SigningClientResolver) => bui encoders: toEncoders(MsgCreateGroup), converters: toConverters(MsgCreateGroup) }); -export const useCreateGroup = buildUseMutation({ - builderMutationFn: createCreateGroup -}); export const createUpdateGroupMembers = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgUpdateGroupMembers.typeUrl, encoders: toEncoders(MsgUpdateGroupMembers), converters: toConverters(MsgUpdateGroupMembers) }); -export const useUpdateGroupMembers = buildUseMutation({ - builderMutationFn: createUpdateGroupMembers -}); export const createUpdateGroupAdmin = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgUpdateGroupAdmin.typeUrl, encoders: toEncoders(MsgUpdateGroupAdmin), converters: toConverters(MsgUpdateGroupAdmin) }); -export const useUpdateGroupAdmin = buildUseMutation({ - builderMutationFn: createUpdateGroupAdmin -}); export const createUpdateGroupMetadata = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgUpdateGroupMetadata.typeUrl, encoders: toEncoders(MsgUpdateGroupMetadata), converters: toConverters(MsgUpdateGroupMetadata) }); -export const useUpdateGroupMetadata = buildUseMutation({ - builderMutationFn: createUpdateGroupMetadata -}); export const createCreateGroupPolicy = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgCreateGroupPolicy.typeUrl, encoders: toEncoders(MsgCreateGroupPolicy), converters: toConverters(MsgCreateGroupPolicy) }); -export const useCreateGroupPolicy = buildUseMutation({ - builderMutationFn: createCreateGroupPolicy -}); export const createCreateGroupWithPolicy = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgCreateGroupWithPolicy.typeUrl, encoders: toEncoders(MsgCreateGroupWithPolicy), converters: toConverters(MsgCreateGroupWithPolicy) }); -export const useCreateGroupWithPolicy = buildUseMutation({ - builderMutationFn: createCreateGroupWithPolicy -}); export const createUpdateGroupPolicyAdmin = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgUpdateGroupPolicyAdmin.typeUrl, encoders: toEncoders(MsgUpdateGroupPolicyAdmin), converters: toConverters(MsgUpdateGroupPolicyAdmin) }); -export const useUpdateGroupPolicyAdmin = buildUseMutation({ - builderMutationFn: createUpdateGroupPolicyAdmin -}); export const createUpdateGroupPolicyDecisionPolicy = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgUpdateGroupPolicyDecisionPolicy.typeUrl, encoders: toEncoders(MsgUpdateGroupPolicyDecisionPolicy), converters: toConverters(MsgUpdateGroupPolicyDecisionPolicy) }); -export const useUpdateGroupPolicyDecisionPolicy = buildUseMutation({ - builderMutationFn: createUpdateGroupPolicyDecisionPolicy -}); export const createUpdateGroupPolicyMetadata = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgUpdateGroupPolicyMetadata.typeUrl, encoders: toEncoders(MsgUpdateGroupPolicyMetadata), converters: toConverters(MsgUpdateGroupPolicyMetadata) }); -export const useUpdateGroupPolicyMetadata = buildUseMutation({ - builderMutationFn: createUpdateGroupPolicyMetadata -}); export const createSubmitProposal = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgSubmitProposal.typeUrl, encoders: toEncoders(MsgSubmitProposal), converters: toConverters(MsgSubmitProposal) }); -export const useSubmitProposal = buildUseMutation({ - builderMutationFn: createSubmitProposal -}); export const createWithdrawProposal = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgWithdrawProposal.typeUrl, encoders: toEncoders(MsgWithdrawProposal), converters: toConverters(MsgWithdrawProposal) }); -export const useWithdrawProposal = buildUseMutation({ - builderMutationFn: createWithdrawProposal -}); export const createVote = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgVote.typeUrl, encoders: toEncoders(MsgVote), converters: toConverters(MsgVote) }); -export const useVote = buildUseMutation({ - builderMutationFn: createVote -}); export const createExec = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgExec.typeUrl, encoders: toEncoders(MsgExec), converters: toConverters(MsgExec) }); -export const useExec = buildUseMutation({ - builderMutationFn: createExec -}); export const createLeaveGroup = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgLeaveGroup.typeUrl, encoders: toEncoders(MsgLeaveGroup), converters: toConverters(MsgLeaveGroup) -}); -export const useLeaveGroup = buildUseMutation({ - builderMutationFn: createLeaveGroup }); \ No newline at end of file diff --git a/libs/interchainjs/src/cosmos/staking/v1beta1/query.rpc.func.ts b/libs/interchainjs/src/cosmos/staking/v1beta1/query.rpc.func.ts index 0d3c0cfc..d870abdc 100644 --- a/libs/interchainjs/src/cosmos/staking/v1beta1/query.rpc.func.ts +++ b/libs/interchainjs/src/cosmos/staking/v1beta1/query.rpc.func.ts @@ -1,5 +1,4 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; -import { buildUseQuery } from "../../../react-query"; import { QueryValidatorsRequest, QueryValidatorsResponse, QueryValidatorRequest, QueryValidatorResponse, QueryValidatorDelegationsRequest, QueryValidatorDelegationsResponse, QueryValidatorUnbondingDelegationsRequest, QueryValidatorUnbondingDelegationsResponse, QueryDelegationRequest, QueryDelegationResponse, QueryUnbondingDelegationRequest, QueryUnbondingDelegationResponse, QueryDelegatorDelegationsRequest, QueryDelegatorDelegationsResponse, QueryDelegatorUnbondingDelegationsRequest, QueryDelegatorUnbondingDelegationsResponse, QueryRedelegationsRequest, QueryRedelegationsResponse, QueryDelegatorValidatorsRequest, QueryDelegatorValidatorsResponse, QueryDelegatorValidatorRequest, QueryDelegatorValidatorResponse, QueryHistoricalInfoRequest, QueryHistoricalInfoResponse, QueryPoolRequest, QueryPoolResponse, QueryParamsRequest, QueryParamsResponse } from "./query"; export const createGetValidators = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryValidatorsRequest.encode, @@ -8,10 +7,6 @@ export const createGetValidators = (clientResolver?: RpcResolver) => buildQuery< method: "Validators", clientResolver }); -export const useGetValidators = buildUseQuery({ - builderQueryFn: createGetValidators, - queryKeyPrefix: "ValidatorsQuery" -}); export const createGetValidator = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryValidatorRequest.encode, decode: QueryValidatorResponse.decode, @@ -19,10 +14,6 @@ export const createGetValidator = (clientResolver?: RpcResolver) => buildQuery({ - builderQueryFn: createGetValidator, - queryKeyPrefix: "ValidatorQuery" -}); export const createGetValidatorDelegations = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryValidatorDelegationsRequest.encode, decode: QueryValidatorDelegationsResponse.decode, @@ -30,10 +21,6 @@ export const createGetValidatorDelegations = (clientResolver?: RpcResolver) => b method: "ValidatorDelegations", clientResolver }); -export const useGetValidatorDelegations = buildUseQuery({ - builderQueryFn: createGetValidatorDelegations, - queryKeyPrefix: "ValidatorDelegationsQuery" -}); export const createGetValidatorUnbondingDelegations = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryValidatorUnbondingDelegationsRequest.encode, decode: QueryValidatorUnbondingDelegationsResponse.decode, @@ -41,10 +28,6 @@ export const createGetValidatorUnbondingDelegations = (clientResolver?: RpcResol method: "ValidatorUnbondingDelegations", clientResolver }); -export const useGetValidatorUnbondingDelegations = buildUseQuery({ - builderQueryFn: createGetValidatorUnbondingDelegations, - queryKeyPrefix: "ValidatorUnbondingDelegationsQuery" -}); export const createGetDelegation = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryDelegationRequest.encode, decode: QueryDelegationResponse.decode, @@ -52,10 +35,6 @@ export const createGetDelegation = (clientResolver?: RpcResolver) => buildQuery< method: "Delegation", clientResolver }); -export const useGetDelegation = buildUseQuery({ - builderQueryFn: createGetDelegation, - queryKeyPrefix: "DelegationQuery" -}); export const createGetUnbondingDelegation = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryUnbondingDelegationRequest.encode, decode: QueryUnbondingDelegationResponse.decode, @@ -63,10 +42,6 @@ export const createGetUnbondingDelegation = (clientResolver?: RpcResolver) => bu method: "UnbondingDelegation", clientResolver }); -export const useGetUnbondingDelegation = buildUseQuery({ - builderQueryFn: createGetUnbondingDelegation, - queryKeyPrefix: "UnbondingDelegationQuery" -}); export const createGetDelegatorDelegations = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryDelegatorDelegationsRequest.encode, decode: QueryDelegatorDelegationsResponse.decode, @@ -74,10 +49,6 @@ export const createGetDelegatorDelegations = (clientResolver?: RpcResolver) => b method: "DelegatorDelegations", clientResolver }); -export const useGetDelegatorDelegations = buildUseQuery({ - builderQueryFn: createGetDelegatorDelegations, - queryKeyPrefix: "DelegatorDelegationsQuery" -}); export const createGetDelegatorUnbondingDelegations = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryDelegatorUnbondingDelegationsRequest.encode, decode: QueryDelegatorUnbondingDelegationsResponse.decode, @@ -85,10 +56,6 @@ export const createGetDelegatorUnbondingDelegations = (clientResolver?: RpcResol method: "DelegatorUnbondingDelegations", clientResolver }); -export const useGetDelegatorUnbondingDelegations = buildUseQuery({ - builderQueryFn: createGetDelegatorUnbondingDelegations, - queryKeyPrefix: "DelegatorUnbondingDelegationsQuery" -}); export const createGetRedelegations = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryRedelegationsRequest.encode, decode: QueryRedelegationsResponse.decode, @@ -96,10 +63,6 @@ export const createGetRedelegations = (clientResolver?: RpcResolver) => buildQue method: "Redelegations", clientResolver }); -export const useGetRedelegations = buildUseQuery({ - builderQueryFn: createGetRedelegations, - queryKeyPrefix: "RedelegationsQuery" -}); export const createGetDelegatorValidators = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryDelegatorValidatorsRequest.encode, decode: QueryDelegatorValidatorsResponse.decode, @@ -107,10 +70,6 @@ export const createGetDelegatorValidators = (clientResolver?: RpcResolver) => bu method: "DelegatorValidators", clientResolver }); -export const useGetDelegatorValidators = buildUseQuery({ - builderQueryFn: createGetDelegatorValidators, - queryKeyPrefix: "DelegatorValidatorsQuery" -}); export const createGetDelegatorValidator = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryDelegatorValidatorRequest.encode, decode: QueryDelegatorValidatorResponse.decode, @@ -118,10 +77,6 @@ export const createGetDelegatorValidator = (clientResolver?: RpcResolver) => bui method: "DelegatorValidator", clientResolver }); -export const useGetDelegatorValidator = buildUseQuery({ - builderQueryFn: createGetDelegatorValidator, - queryKeyPrefix: "DelegatorValidatorQuery" -}); export const createGetHistoricalInfo = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryHistoricalInfoRequest.encode, decode: QueryHistoricalInfoResponse.decode, @@ -129,10 +84,6 @@ export const createGetHistoricalInfo = (clientResolver?: RpcResolver) => buildQu method: "HistoricalInfo", clientResolver }); -export const useGetHistoricalInfo = buildUseQuery({ - builderQueryFn: createGetHistoricalInfo, - queryKeyPrefix: "HistoricalInfoQuery" -}); export const createGetPool = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryPoolRequest.encode, decode: QueryPoolResponse.decode, @@ -140,18 +91,10 @@ export const createGetPool = (clientResolver?: RpcResolver) => buildQuery({ - builderQueryFn: createGetPool, - queryKeyPrefix: "PoolQuery" -}); export const createGetParams = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryParamsRequest.encode, decode: QueryParamsResponse.decode, service: "cosmos.staking.v1beta1.Query", method: "Params", clientResolver -}); -export const useGetParams = buildUseQuery({ - builderQueryFn: createGetParams, - queryKeyPrefix: "ParamsQuery" }); \ No newline at end of file diff --git a/libs/interchainjs/src/cosmos/staking/v1beta1/tx.rpc.func.ts b/libs/interchainjs/src/cosmos/staking/v1beta1/tx.rpc.func.ts index 78bf119c..81244bbe 100644 --- a/libs/interchainjs/src/cosmos/staking/v1beta1/tx.rpc.func.ts +++ b/libs/interchainjs/src/cosmos/staking/v1beta1/tx.rpc.func.ts @@ -1,5 +1,4 @@ import { buildTx, SigningClientResolver } from "../../../helper-func-types"; -import { buildUseMutation } from "../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgCreateValidator, MsgEditValidator, MsgDelegate, MsgBeginRedelegate, MsgUndelegate, MsgCancelUnbondingDelegation, MsgUpdateParams } from "./tx"; export const createCreateValidator = (clientResolver?: SigningClientResolver) => buildTx({ @@ -8,60 +7,39 @@ export const createCreateValidator = (clientResolver?: SigningClientResolver) => encoders: toEncoders(MsgCreateValidator), converters: toConverters(MsgCreateValidator) }); -export const useCreateValidator = buildUseMutation({ - builderMutationFn: createCreateValidator -}); export const createEditValidator = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgEditValidator.typeUrl, encoders: toEncoders(MsgEditValidator), converters: toConverters(MsgEditValidator) }); -export const useEditValidator = buildUseMutation({ - builderMutationFn: createEditValidator -}); export const createDelegate = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgDelegate.typeUrl, encoders: toEncoders(MsgDelegate), converters: toConverters(MsgDelegate) }); -export const useDelegate = buildUseMutation({ - builderMutationFn: createDelegate -}); export const createBeginRedelegate = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgBeginRedelegate.typeUrl, encoders: toEncoders(MsgBeginRedelegate), converters: toConverters(MsgBeginRedelegate) }); -export const useBeginRedelegate = buildUseMutation({ - builderMutationFn: createBeginRedelegate -}); export const createUndelegate = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgUndelegate.typeUrl, encoders: toEncoders(MsgUndelegate), converters: toConverters(MsgUndelegate) }); -export const useUndelegate = buildUseMutation({ - builderMutationFn: createUndelegate -}); export const createCancelUnbondingDelegation = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgCancelUnbondingDelegation.typeUrl, encoders: toEncoders(MsgCancelUnbondingDelegation), converters: toConverters(MsgCancelUnbondingDelegation) }); -export const useCancelUnbondingDelegation = buildUseMutation({ - builderMutationFn: createCancelUnbondingDelegation -}); export const createUpdateParams = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgUpdateParams.typeUrl, encoders: toEncoders(MsgUpdateParams), converters: toConverters(MsgUpdateParams) -}); -export const useUpdateParams = buildUseMutation({ - builderMutationFn: createUpdateParams }); \ No newline at end of file diff --git a/libs/interchainjs/src/cosmos/tx/v1beta1/service.rpc.func.ts b/libs/interchainjs/src/cosmos/tx/v1beta1/service.rpc.func.ts index 4fb651f5..a13635e1 100644 --- a/libs/interchainjs/src/cosmos/tx/v1beta1/service.rpc.func.ts +++ b/libs/interchainjs/src/cosmos/tx/v1beta1/service.rpc.func.ts @@ -1,5 +1,4 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; -import { buildUseQuery } from "../../../react-query"; import { SimulateRequest, SimulateResponse, GetTxRequest, GetTxResponse, BroadcastTxRequest, BroadcastTxResponse, GetTxsEventRequest, GetTxsEventResponse, GetBlockWithTxsRequest, GetBlockWithTxsResponse, TxDecodeRequest, TxDecodeResponse, TxEncodeRequest, TxEncodeResponse, TxEncodeAminoRequest, TxEncodeAminoResponse, TxDecodeAminoRequest, TxDecodeAminoResponse } from "./service"; export const createGetSimulate = (clientResolver?: RpcResolver) => buildQuery({ encode: SimulateRequest.encode, @@ -8,10 +7,6 @@ export const createGetSimulate = (clientResolver?: RpcResolver) => buildQuery({ - builderQueryFn: createGetSimulate, - queryKeyPrefix: "SimulateQuery" -}); export const createGetGetTx = (clientResolver?: RpcResolver) => buildQuery({ encode: GetTxRequest.encode, decode: GetTxResponse.decode, @@ -19,10 +14,6 @@ export const createGetGetTx = (clientResolver?: RpcResolver) => buildQuery({ - builderQueryFn: createGetGetTx, - queryKeyPrefix: "GetTxQuery" -}); export const createGetBroadcastTx = (clientResolver?: RpcResolver) => buildQuery({ encode: BroadcastTxRequest.encode, decode: BroadcastTxResponse.decode, @@ -30,10 +21,6 @@ export const createGetBroadcastTx = (clientResolver?: RpcResolver) => buildQuery method: "BroadcastTx", clientResolver }); -export const useGetBroadcastTx = buildUseQuery({ - builderQueryFn: createGetBroadcastTx, - queryKeyPrefix: "BroadcastTxQuery" -}); export const createGetGetTxsEvent = (clientResolver?: RpcResolver) => buildQuery({ encode: GetTxsEventRequest.encode, decode: GetTxsEventResponse.decode, @@ -41,10 +28,6 @@ export const createGetGetTxsEvent = (clientResolver?: RpcResolver) => buildQuery method: "GetTxsEvent", clientResolver }); -export const useGetGetTxsEvent = buildUseQuery({ - builderQueryFn: createGetGetTxsEvent, - queryKeyPrefix: "GetTxsEventQuery" -}); export const createGetGetBlockWithTxs = (clientResolver?: RpcResolver) => buildQuery({ encode: GetBlockWithTxsRequest.encode, decode: GetBlockWithTxsResponse.decode, @@ -52,10 +35,6 @@ export const createGetGetBlockWithTxs = (clientResolver?: RpcResolver) => buildQ method: "GetBlockWithTxs", clientResolver }); -export const useGetGetBlockWithTxs = buildUseQuery({ - builderQueryFn: createGetGetBlockWithTxs, - queryKeyPrefix: "GetBlockWithTxsQuery" -}); export const createGetTxDecode = (clientResolver?: RpcResolver) => buildQuery({ encode: TxDecodeRequest.encode, decode: TxDecodeResponse.decode, @@ -63,10 +42,6 @@ export const createGetTxDecode = (clientResolver?: RpcResolver) => buildQuery({ - builderQueryFn: createGetTxDecode, - queryKeyPrefix: "TxDecodeQuery" -}); export const createGetTxEncode = (clientResolver?: RpcResolver) => buildQuery({ encode: TxEncodeRequest.encode, decode: TxEncodeResponse.decode, @@ -74,10 +49,6 @@ export const createGetTxEncode = (clientResolver?: RpcResolver) => buildQuery({ - builderQueryFn: createGetTxEncode, - queryKeyPrefix: "TxEncodeQuery" -}); export const createGetTxEncodeAmino = (clientResolver?: RpcResolver) => buildQuery({ encode: TxEncodeAminoRequest.encode, decode: TxEncodeAminoResponse.decode, @@ -85,18 +56,10 @@ export const createGetTxEncodeAmino = (clientResolver?: RpcResolver) => buildQue method: "TxEncodeAmino", clientResolver }); -export const useGetTxEncodeAmino = buildUseQuery({ - builderQueryFn: createGetTxEncodeAmino, - queryKeyPrefix: "TxEncodeAminoQuery" -}); export const createGetTxDecodeAmino = (clientResolver?: RpcResolver) => buildQuery({ encode: TxDecodeAminoRequest.encode, decode: TxDecodeAminoResponse.decode, service: "cosmos.tx.v1beta1.Service", method: "TxDecodeAmino", clientResolver -}); -export const useGetTxDecodeAmino = buildUseQuery({ - builderQueryFn: createGetTxDecodeAmino, - queryKeyPrefix: "TxDecodeAminoQuery" }); \ No newline at end of file diff --git a/libs/interchainjs/src/cosmos/vesting/v1beta1/tx.rpc.func.ts b/libs/interchainjs/src/cosmos/vesting/v1beta1/tx.rpc.func.ts index a0043688..49328086 100644 --- a/libs/interchainjs/src/cosmos/vesting/v1beta1/tx.rpc.func.ts +++ b/libs/interchainjs/src/cosmos/vesting/v1beta1/tx.rpc.func.ts @@ -1,5 +1,4 @@ import { buildTx, SigningClientResolver } from "../../../helper-func-types"; -import { buildUseMutation } from "../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgCreateVestingAccount, MsgCreatePermanentLockedAccount, MsgCreatePeriodicVestingAccount } from "./tx"; export const createCreateVestingAccount = (clientResolver?: SigningClientResolver) => buildTx({ @@ -8,24 +7,15 @@ export const createCreateVestingAccount = (clientResolver?: SigningClientResolve encoders: toEncoders(MsgCreateVestingAccount), converters: toConverters(MsgCreateVestingAccount) }); -export const useCreateVestingAccount = buildUseMutation({ - builderMutationFn: createCreateVestingAccount -}); export const createCreatePermanentLockedAccount = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgCreatePermanentLockedAccount.typeUrl, encoders: toEncoders(MsgCreatePermanentLockedAccount), converters: toConverters(MsgCreatePermanentLockedAccount) }); -export const useCreatePermanentLockedAccount = buildUseMutation({ - builderMutationFn: createCreatePermanentLockedAccount -}); export const createCreatePeriodicVestingAccount = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgCreatePeriodicVestingAccount.typeUrl, encoders: toEncoders(MsgCreatePeriodicVestingAccount), converters: toConverters(MsgCreatePeriodicVestingAccount) -}); -export const useCreatePeriodicVestingAccount = buildUseMutation({ - builderMutationFn: createCreatePeriodicVestingAccount }); \ No newline at end of file diff --git a/libs/interchainjs/src/cosmwasm/wasm/v1/query.rpc.func.ts b/libs/interchainjs/src/cosmwasm/wasm/v1/query.rpc.func.ts index 53986d9b..eed9fbf1 100644 --- a/libs/interchainjs/src/cosmwasm/wasm/v1/query.rpc.func.ts +++ b/libs/interchainjs/src/cosmwasm/wasm/v1/query.rpc.func.ts @@ -1,5 +1,4 @@ import { RpcResolver, buildQuery } from "../../../helper-func-types"; -import { buildUseQuery } from "../../../react-query"; import { QueryContractInfoRequest, QueryContractInfoResponse, QueryContractHistoryRequest, QueryContractHistoryResponse, QueryContractsByCodeRequest, QueryContractsByCodeResponse, QueryAllContractStateRequest, QueryAllContractStateResponse, QueryRawContractStateRequest, QueryRawContractStateResponse, QuerySmartContractStateRequest, QuerySmartContractStateResponse, QueryCodeRequest, QueryCodeResponse, QueryCodesRequest, QueryCodesResponse, QueryPinnedCodesRequest, QueryPinnedCodesResponse, QueryParamsRequest, QueryParamsResponse, QueryContractsByCreatorRequest, QueryContractsByCreatorResponse, QueryBuildAddressRequest, QueryBuildAddressResponse } from "./query"; export const createGetContractInfo = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryContractInfoRequest.encode, @@ -8,10 +7,6 @@ export const createGetContractInfo = (clientResolver?: RpcResolver) => buildQuer method: "ContractInfo", clientResolver }); -export const useGetContractInfo = buildUseQuery({ - builderQueryFn: createGetContractInfo, - queryKeyPrefix: "ContractInfoQuery" -}); export const createGetContractHistory = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryContractHistoryRequest.encode, decode: QueryContractHistoryResponse.decode, @@ -19,10 +14,6 @@ export const createGetContractHistory = (clientResolver?: RpcResolver) => buildQ method: "ContractHistory", clientResolver }); -export const useGetContractHistory = buildUseQuery({ - builderQueryFn: createGetContractHistory, - queryKeyPrefix: "ContractHistoryQuery" -}); export const createGetContractsByCode = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryContractsByCodeRequest.encode, decode: QueryContractsByCodeResponse.decode, @@ -30,10 +21,6 @@ export const createGetContractsByCode = (clientResolver?: RpcResolver) => buildQ method: "ContractsByCode", clientResolver }); -export const useGetContractsByCode = buildUseQuery({ - builderQueryFn: createGetContractsByCode, - queryKeyPrefix: "ContractsByCodeQuery" -}); export const createGetAllContractState = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryAllContractStateRequest.encode, decode: QueryAllContractStateResponse.decode, @@ -41,10 +28,6 @@ export const createGetAllContractState = (clientResolver?: RpcResolver) => build method: "AllContractState", clientResolver }); -export const useGetAllContractState = buildUseQuery({ - builderQueryFn: createGetAllContractState, - queryKeyPrefix: "AllContractStateQuery" -}); export const createGetRawContractState = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryRawContractStateRequest.encode, decode: QueryRawContractStateResponse.decode, @@ -52,10 +35,6 @@ export const createGetRawContractState = (clientResolver?: RpcResolver) => build method: "RawContractState", clientResolver }); -export const useGetRawContractState = buildUseQuery({ - builderQueryFn: createGetRawContractState, - queryKeyPrefix: "RawContractStateQuery" -}); export const createGetSmartContractState = (clientResolver?: RpcResolver) => buildQuery({ encode: QuerySmartContractStateRequest.encode, decode: QuerySmartContractStateResponse.decode, @@ -63,10 +42,6 @@ export const createGetSmartContractState = (clientResolver?: RpcResolver) => bui method: "SmartContractState", clientResolver }); -export const useGetSmartContractState = buildUseQuery({ - builderQueryFn: createGetSmartContractState, - queryKeyPrefix: "SmartContractStateQuery" -}); export const createGetCode = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryCodeRequest.encode, decode: QueryCodeResponse.decode, @@ -74,10 +49,6 @@ export const createGetCode = (clientResolver?: RpcResolver) => buildQuery({ - builderQueryFn: createGetCode, - queryKeyPrefix: "CodeQuery" -}); export const createGetCodes = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryCodesRequest.encode, decode: QueryCodesResponse.decode, @@ -85,10 +56,6 @@ export const createGetCodes = (clientResolver?: RpcResolver) => buildQuery({ - builderQueryFn: createGetCodes, - queryKeyPrefix: "CodesQuery" -}); export const createGetPinnedCodes = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryPinnedCodesRequest.encode, decode: QueryPinnedCodesResponse.decode, @@ -96,10 +63,6 @@ export const createGetPinnedCodes = (clientResolver?: RpcResolver) => buildQuery method: "PinnedCodes", clientResolver }); -export const useGetPinnedCodes = buildUseQuery({ - builderQueryFn: createGetPinnedCodes, - queryKeyPrefix: "PinnedCodesQuery" -}); export const createGetParams = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryParamsRequest.encode, decode: QueryParamsResponse.decode, @@ -107,10 +70,6 @@ export const createGetParams = (clientResolver?: RpcResolver) => buildQuery({ - builderQueryFn: createGetParams, - queryKeyPrefix: "ParamsQuery" -}); export const createGetContractsByCreator = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryContractsByCreatorRequest.encode, decode: QueryContractsByCreatorResponse.decode, @@ -118,18 +77,10 @@ export const createGetContractsByCreator = (clientResolver?: RpcResolver) => bui method: "ContractsByCreator", clientResolver }); -export const useGetContractsByCreator = buildUseQuery({ - builderQueryFn: createGetContractsByCreator, - queryKeyPrefix: "ContractsByCreatorQuery" -}); export const createGetBuildAddress = (clientResolver?: RpcResolver) => buildQuery({ encode: QueryBuildAddressRequest.encode, decode: QueryBuildAddressResponse.decode, service: "cosmwasm.wasm.v1.Query", method: "BuildAddress", clientResolver -}); -export const useGetBuildAddress = buildUseQuery({ - builderQueryFn: createGetBuildAddress, - queryKeyPrefix: "BuildAddressQuery" }); \ No newline at end of file diff --git a/libs/interchainjs/src/cosmwasm/wasm/v1/tx.rpc.func.ts b/libs/interchainjs/src/cosmwasm/wasm/v1/tx.rpc.func.ts index 82a34fc7..61f2ed80 100644 --- a/libs/interchainjs/src/cosmwasm/wasm/v1/tx.rpc.func.ts +++ b/libs/interchainjs/src/cosmwasm/wasm/v1/tx.rpc.func.ts @@ -1,5 +1,4 @@ import { buildTx, SigningClientResolver } from "../../../helper-func-types"; -import { buildUseMutation } from "../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgStoreCode, MsgInstantiateContract, MsgInstantiateContract2, MsgExecuteContract, MsgMigrateContract, MsgUpdateAdmin, MsgClearAdmin, MsgUpdateInstantiateConfig, MsgUpdateParams, MsgSudoContract, MsgPinCodes, MsgUnpinCodes, MsgStoreAndInstantiateContract, MsgRemoveCodeUploadParamsAddresses, MsgAddCodeUploadParamsAddresses, MsgStoreAndMigrateContract, MsgUpdateContractLabel } from "./tx"; export const createStoreCode = (clientResolver?: SigningClientResolver) => buildTx({ @@ -8,150 +7,99 @@ export const createStoreCode = (clientResolver?: SigningClientResolver) => build encoders: toEncoders(MsgStoreCode), converters: toConverters(MsgStoreCode) }); -export const useStoreCode = buildUseMutation({ - builderMutationFn: createStoreCode -}); export const createInstantiateContract = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgInstantiateContract.typeUrl, encoders: toEncoders(MsgInstantiateContract), converters: toConverters(MsgInstantiateContract) }); -export const useInstantiateContract = buildUseMutation({ - builderMutationFn: createInstantiateContract -}); export const createInstantiateContract2 = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgInstantiateContract2.typeUrl, encoders: toEncoders(MsgInstantiateContract2), converters: toConverters(MsgInstantiateContract2) }); -export const useInstantiateContract2 = buildUseMutation({ - builderMutationFn: createInstantiateContract2 -}); export const createExecuteContract = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgExecuteContract.typeUrl, encoders: toEncoders(MsgExecuteContract), converters: toConverters(MsgExecuteContract) }); -export const useExecuteContract = buildUseMutation({ - builderMutationFn: createExecuteContract -}); export const createMigrateContract = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgMigrateContract.typeUrl, encoders: toEncoders(MsgMigrateContract), converters: toConverters(MsgMigrateContract) }); -export const useMigrateContract = buildUseMutation({ - builderMutationFn: createMigrateContract -}); export const createUpdateAdmin = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgUpdateAdmin.typeUrl, encoders: toEncoders(MsgUpdateAdmin), converters: toConverters(MsgUpdateAdmin) }); -export const useUpdateAdmin = buildUseMutation({ - builderMutationFn: createUpdateAdmin -}); export const createClearAdmin = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgClearAdmin.typeUrl, encoders: toEncoders(MsgClearAdmin), converters: toConverters(MsgClearAdmin) }); -export const useClearAdmin = buildUseMutation({ - builderMutationFn: createClearAdmin -}); export const createUpdateInstantiateConfig = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgUpdateInstantiateConfig.typeUrl, encoders: toEncoders(MsgUpdateInstantiateConfig), converters: toConverters(MsgUpdateInstantiateConfig) }); -export const useUpdateInstantiateConfig = buildUseMutation({ - builderMutationFn: createUpdateInstantiateConfig -}); export const createUpdateParams = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgUpdateParams.typeUrl, encoders: toEncoders(MsgUpdateParams), converters: toConverters(MsgUpdateParams) }); -export const useUpdateParams = buildUseMutation({ - builderMutationFn: createUpdateParams -}); export const createSudoContract = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgSudoContract.typeUrl, encoders: toEncoders(MsgSudoContract), converters: toConverters(MsgSudoContract) }); -export const useSudoContract = buildUseMutation({ - builderMutationFn: createSudoContract -}); export const createPinCodes = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgPinCodes.typeUrl, encoders: toEncoders(MsgPinCodes), converters: toConverters(MsgPinCodes) }); -export const usePinCodes = buildUseMutation({ - builderMutationFn: createPinCodes -}); export const createUnpinCodes = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgUnpinCodes.typeUrl, encoders: toEncoders(MsgUnpinCodes), converters: toConverters(MsgUnpinCodes) }); -export const useUnpinCodes = buildUseMutation({ - builderMutationFn: createUnpinCodes -}); export const createStoreAndInstantiateContract = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgStoreAndInstantiateContract.typeUrl, encoders: toEncoders(MsgStoreAndInstantiateContract), converters: toConverters(MsgStoreAndInstantiateContract) }); -export const useStoreAndInstantiateContract = buildUseMutation({ - builderMutationFn: createStoreAndInstantiateContract -}); export const createRemoveCodeUploadParamsAddresses = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgRemoveCodeUploadParamsAddresses.typeUrl, encoders: toEncoders(MsgRemoveCodeUploadParamsAddresses), converters: toConverters(MsgRemoveCodeUploadParamsAddresses) }); -export const useRemoveCodeUploadParamsAddresses = buildUseMutation({ - builderMutationFn: createRemoveCodeUploadParamsAddresses -}); export const createAddCodeUploadParamsAddresses = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgAddCodeUploadParamsAddresses.typeUrl, encoders: toEncoders(MsgAddCodeUploadParamsAddresses), converters: toConverters(MsgAddCodeUploadParamsAddresses) }); -export const useAddCodeUploadParamsAddresses = buildUseMutation({ - builderMutationFn: createAddCodeUploadParamsAddresses -}); export const createStoreAndMigrateContract = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgStoreAndMigrateContract.typeUrl, encoders: toEncoders(MsgStoreAndMigrateContract), converters: toConverters(MsgStoreAndMigrateContract) }); -export const useStoreAndMigrateContract = buildUseMutation({ - builderMutationFn: createStoreAndMigrateContract -}); export const createUpdateContractLabel = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgUpdateContractLabel.typeUrl, encoders: toEncoders(MsgUpdateContractLabel), converters: toConverters(MsgUpdateContractLabel) -}); -export const useUpdateContractLabel = buildUseMutation({ - builderMutationFn: createUpdateContractLabel }); \ No newline at end of file diff --git a/libs/interchainjs/src/ibc/applications/transfer/v1/tx.rpc.func.ts b/libs/interchainjs/src/ibc/applications/transfer/v1/tx.rpc.func.ts index 2e888d2c..72028384 100644 --- a/libs/interchainjs/src/ibc/applications/transfer/v1/tx.rpc.func.ts +++ b/libs/interchainjs/src/ibc/applications/transfer/v1/tx.rpc.func.ts @@ -1,5 +1,4 @@ import { buildTx, SigningClientResolver } from "../../../../helper-func-types"; -import { buildUseMutation } from "../../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgTransfer, MsgUpdateParams } from "./tx"; export const createTransfer = (clientResolver?: SigningClientResolver) => buildTx({ @@ -8,15 +7,9 @@ export const createTransfer = (clientResolver?: SigningClientResolver) => buildT encoders: toEncoders(MsgTransfer), converters: toConverters(MsgTransfer) }); -export const useTransfer = buildUseMutation({ - builderMutationFn: createTransfer -}); export const createUpdateParams = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgUpdateParams.typeUrl, encoders: toEncoders(MsgUpdateParams), converters: toConverters(MsgUpdateParams) -}); -export const useUpdateParams = buildUseMutation({ - builderMutationFn: createUpdateParams }); \ No newline at end of file diff --git a/libs/interchainjs/src/ibc/core/channel/v1/tx.rpc.func.ts b/libs/interchainjs/src/ibc/core/channel/v1/tx.rpc.func.ts index a7fc06c2..92917fb9 100644 --- a/libs/interchainjs/src/ibc/core/channel/v1/tx.rpc.func.ts +++ b/libs/interchainjs/src/ibc/core/channel/v1/tx.rpc.func.ts @@ -1,5 +1,4 @@ import { buildTx, SigningClientResolver } from "../../../../helper-func-types"; -import { buildUseMutation } from "../../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgChannelOpenInit, MsgChannelOpenTry, MsgChannelOpenAck, MsgChannelOpenConfirm, MsgChannelCloseInit, MsgChannelCloseConfirm, MsgRecvPacket, MsgTimeout, MsgTimeoutOnClose, MsgAcknowledgement, MsgChannelUpgradeInit, MsgChannelUpgradeTry, MsgChannelUpgradeAck, MsgChannelUpgradeConfirm, MsgChannelUpgradeOpen, MsgChannelUpgradeTimeout, MsgChannelUpgradeCancel, MsgUpdateParams, MsgPruneAcknowledgements } from "./tx"; export const createChannelOpenInit = (clientResolver?: SigningClientResolver) => buildTx({ @@ -8,168 +7,111 @@ export const createChannelOpenInit = (clientResolver?: SigningClientResolver) => encoders: toEncoders(MsgChannelOpenInit), converters: toConverters(MsgChannelOpenInit) }); -export const useChannelOpenInit = buildUseMutation({ - builderMutationFn: createChannelOpenInit -}); export const createChannelOpenTry = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgChannelOpenTry.typeUrl, encoders: toEncoders(MsgChannelOpenTry), converters: toConverters(MsgChannelOpenTry) }); -export const useChannelOpenTry = buildUseMutation({ - builderMutationFn: createChannelOpenTry -}); export const createChannelOpenAck = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgChannelOpenAck.typeUrl, encoders: toEncoders(MsgChannelOpenAck), converters: toConverters(MsgChannelOpenAck) }); -export const useChannelOpenAck = buildUseMutation({ - builderMutationFn: createChannelOpenAck -}); export const createChannelOpenConfirm = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgChannelOpenConfirm.typeUrl, encoders: toEncoders(MsgChannelOpenConfirm), converters: toConverters(MsgChannelOpenConfirm) }); -export const useChannelOpenConfirm = buildUseMutation({ - builderMutationFn: createChannelOpenConfirm -}); export const createChannelCloseInit = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgChannelCloseInit.typeUrl, encoders: toEncoders(MsgChannelCloseInit), converters: toConverters(MsgChannelCloseInit) }); -export const useChannelCloseInit = buildUseMutation({ - builderMutationFn: createChannelCloseInit -}); export const createChannelCloseConfirm = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgChannelCloseConfirm.typeUrl, encoders: toEncoders(MsgChannelCloseConfirm), converters: toConverters(MsgChannelCloseConfirm) }); -export const useChannelCloseConfirm = buildUseMutation({ - builderMutationFn: createChannelCloseConfirm -}); export const createRecvPacket = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgRecvPacket.typeUrl, encoders: toEncoders(MsgRecvPacket), converters: toConverters(MsgRecvPacket) }); -export const useRecvPacket = buildUseMutation({ - builderMutationFn: createRecvPacket -}); export const createTimeout = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgTimeout.typeUrl, encoders: toEncoders(MsgTimeout), converters: toConverters(MsgTimeout) }); -export const useTimeout = buildUseMutation({ - builderMutationFn: createTimeout -}); export const createTimeoutOnClose = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgTimeoutOnClose.typeUrl, encoders: toEncoders(MsgTimeoutOnClose), converters: toConverters(MsgTimeoutOnClose) }); -export const useTimeoutOnClose = buildUseMutation({ - builderMutationFn: createTimeoutOnClose -}); export const createAcknowledgement = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgAcknowledgement.typeUrl, encoders: toEncoders(MsgAcknowledgement), converters: toConverters(MsgAcknowledgement) }); -export const useAcknowledgement = buildUseMutation({ - builderMutationFn: createAcknowledgement -}); export const createChannelUpgradeInit = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgChannelUpgradeInit.typeUrl, encoders: toEncoders(MsgChannelUpgradeInit), converters: toConverters(MsgChannelUpgradeInit) }); -export const useChannelUpgradeInit = buildUseMutation({ - builderMutationFn: createChannelUpgradeInit -}); export const createChannelUpgradeTry = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgChannelUpgradeTry.typeUrl, encoders: toEncoders(MsgChannelUpgradeTry), converters: toConverters(MsgChannelUpgradeTry) }); -export const useChannelUpgradeTry = buildUseMutation({ - builderMutationFn: createChannelUpgradeTry -}); export const createChannelUpgradeAck = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgChannelUpgradeAck.typeUrl, encoders: toEncoders(MsgChannelUpgradeAck), converters: toConverters(MsgChannelUpgradeAck) }); -export const useChannelUpgradeAck = buildUseMutation({ - builderMutationFn: createChannelUpgradeAck -}); export const createChannelUpgradeConfirm = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgChannelUpgradeConfirm.typeUrl, encoders: toEncoders(MsgChannelUpgradeConfirm), converters: toConverters(MsgChannelUpgradeConfirm) }); -export const useChannelUpgradeConfirm = buildUseMutation({ - builderMutationFn: createChannelUpgradeConfirm -}); export const createChannelUpgradeOpen = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgChannelUpgradeOpen.typeUrl, encoders: toEncoders(MsgChannelUpgradeOpen), converters: toConverters(MsgChannelUpgradeOpen) }); -export const useChannelUpgradeOpen = buildUseMutation({ - builderMutationFn: createChannelUpgradeOpen -}); export const createChannelUpgradeTimeout = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgChannelUpgradeTimeout.typeUrl, encoders: toEncoders(MsgChannelUpgradeTimeout), converters: toConverters(MsgChannelUpgradeTimeout) }); -export const useChannelUpgradeTimeout = buildUseMutation({ - builderMutationFn: createChannelUpgradeTimeout -}); export const createChannelUpgradeCancel = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgChannelUpgradeCancel.typeUrl, encoders: toEncoders(MsgChannelUpgradeCancel), converters: toConverters(MsgChannelUpgradeCancel) }); -export const useChannelUpgradeCancel = buildUseMutation({ - builderMutationFn: createChannelUpgradeCancel -}); export const createUpdateChannelParams = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgUpdateParams.typeUrl, encoders: toEncoders(MsgUpdateParams), converters: toConverters(MsgUpdateParams) }); -export const useUpdateChannelParams = buildUseMutation({ - builderMutationFn: createUpdateChannelParams -}); export const createPruneAcknowledgements = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgPruneAcknowledgements.typeUrl, encoders: toEncoders(MsgPruneAcknowledgements), converters: toConverters(MsgPruneAcknowledgements) -}); -export const usePruneAcknowledgements = buildUseMutation({ - builderMutationFn: createPruneAcknowledgements }); \ No newline at end of file diff --git a/libs/interchainjs/src/ibc/core/client/v1/tx.rpc.func.ts b/libs/interchainjs/src/ibc/core/client/v1/tx.rpc.func.ts index cf8b181c..a178d5d2 100644 --- a/libs/interchainjs/src/ibc/core/client/v1/tx.rpc.func.ts +++ b/libs/interchainjs/src/ibc/core/client/v1/tx.rpc.func.ts @@ -1,5 +1,4 @@ import { buildTx, SigningClientResolver } from "../../../../helper-func-types"; -import { buildUseMutation } from "../../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgCreateClient, MsgUpdateClient, MsgUpgradeClient, MsgSubmitMisbehaviour, MsgRecoverClient, MsgIBCSoftwareUpgrade, MsgUpdateParams } from "./tx"; export const createCreateClient = (clientResolver?: SigningClientResolver) => buildTx({ @@ -8,60 +7,39 @@ export const createCreateClient = (clientResolver?: SigningClientResolver) => bu encoders: toEncoders(MsgCreateClient), converters: toConverters(MsgCreateClient) }); -export const useCreateClient = buildUseMutation({ - builderMutationFn: createCreateClient -}); export const createUpdateClient = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgUpdateClient.typeUrl, encoders: toEncoders(MsgUpdateClient), converters: toConverters(MsgUpdateClient) }); -export const useUpdateClient = buildUseMutation({ - builderMutationFn: createUpdateClient -}); export const createUpgradeClient = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgUpgradeClient.typeUrl, encoders: toEncoders(MsgUpgradeClient), converters: toConverters(MsgUpgradeClient) }); -export const useUpgradeClient = buildUseMutation({ - builderMutationFn: createUpgradeClient -}); export const createSubmitMisbehaviour = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgSubmitMisbehaviour.typeUrl, encoders: toEncoders(MsgSubmitMisbehaviour), converters: toConverters(MsgSubmitMisbehaviour) }); -export const useSubmitMisbehaviour = buildUseMutation({ - builderMutationFn: createSubmitMisbehaviour -}); export const createRecoverClient = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgRecoverClient.typeUrl, encoders: toEncoders(MsgRecoverClient), converters: toConverters(MsgRecoverClient) }); -export const useRecoverClient = buildUseMutation({ - builderMutationFn: createRecoverClient -}); export const createIBCSoftwareUpgrade = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgIBCSoftwareUpgrade.typeUrl, encoders: toEncoders(MsgIBCSoftwareUpgrade), converters: toConverters(MsgIBCSoftwareUpgrade) }); -export const useIBCSoftwareUpgrade = buildUseMutation({ - builderMutationFn: createIBCSoftwareUpgrade -}); export const createUpdateClientParams = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgUpdateParams.typeUrl, encoders: toEncoders(MsgUpdateParams), converters: toConverters(MsgUpdateParams) -}); -export const useUpdateClientParams = buildUseMutation({ - builderMutationFn: createUpdateClientParams }); \ No newline at end of file diff --git a/libs/interchainjs/src/ibc/core/connection/v1/tx.rpc.func.ts b/libs/interchainjs/src/ibc/core/connection/v1/tx.rpc.func.ts index 2c81e862..c6b7e37d 100644 --- a/libs/interchainjs/src/ibc/core/connection/v1/tx.rpc.func.ts +++ b/libs/interchainjs/src/ibc/core/connection/v1/tx.rpc.func.ts @@ -1,5 +1,4 @@ import { buildTx, SigningClientResolver } from "../../../../helper-func-types"; -import { buildUseMutation } from "../../../../react-query"; import { toEncoders, toConverters } from "@interchainjs/cosmos/utils"; import { MsgConnectionOpenInit, MsgConnectionOpenTry, MsgConnectionOpenAck, MsgConnectionOpenConfirm, MsgUpdateParams } from "./tx"; export const createConnectionOpenInit = (clientResolver?: SigningClientResolver) => buildTx({ @@ -8,42 +7,27 @@ export const createConnectionOpenInit = (clientResolver?: SigningClientResolver) encoders: toEncoders(MsgConnectionOpenInit), converters: toConverters(MsgConnectionOpenInit) }); -export const useConnectionOpenInit = buildUseMutation({ - builderMutationFn: createConnectionOpenInit -}); export const createConnectionOpenTry = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgConnectionOpenTry.typeUrl, encoders: toEncoders(MsgConnectionOpenTry), converters: toConverters(MsgConnectionOpenTry) }); -export const useConnectionOpenTry = buildUseMutation({ - builderMutationFn: createConnectionOpenTry -}); export const createConnectionOpenAck = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgConnectionOpenAck.typeUrl, encoders: toEncoders(MsgConnectionOpenAck), converters: toConverters(MsgConnectionOpenAck) }); -export const useConnectionOpenAck = buildUseMutation({ - builderMutationFn: createConnectionOpenAck -}); export const createConnectionOpenConfirm = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgConnectionOpenConfirm.typeUrl, encoders: toEncoders(MsgConnectionOpenConfirm), converters: toConverters(MsgConnectionOpenConfirm) }); -export const useConnectionOpenConfirm = buildUseMutation({ - builderMutationFn: createConnectionOpenConfirm -}); export const createUpdateConnectionParams = (clientResolver?: SigningClientResolver) => buildTx({ clientResolver, typeUrl: MsgUpdateParams.typeUrl, encoders: toEncoders(MsgUpdateParams), converters: toConverters(MsgUpdateParams) -}); -export const useUpdateConnectionParams = buildUseMutation({ - builderMutationFn: createUpdateConnectionParams }); \ No newline at end of file diff --git a/package.json b/package.json index c3aa2c41..90fde7e9 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "libs/*" ], "scripts": { - "codegen": "telescope transpile --config ./scripts/interchainjs.telescope.json", + "codegen": "telescope transpile --config ./scripts/interchainjs.telescope.json && telescope transpile --config ./scripts/interchain-query.telescope.json", "codegen:types": "telescope transpile --config ./scripts/cosmos-types.telescope.json", "proto": "telescope download --config ./scripts/.protod.config.json", "test": "lerna run test --stream", diff --git a/scripts/interchain-query.telescope.json b/scripts/interchain-query.telescope.json new file mode 100644 index 00000000..bf5ae593 --- /dev/null +++ b/scripts/interchain-query.telescope.json @@ -0,0 +1,77 @@ +{ + "protoDirs": [ + "./protos" + ], + "outPath": "./libs/interchain-query/src", + "options": { + "classesUseArrowFunctions": true, + "env": "v-next", + "useInterchainJs": true, + "useSDKTypes": false, + "prototypes": { + "enableRegistryLoader": false, + "enableMessageComposer": false, + "enabled": true, + "parser": { + "keepCase": false + }, + "methods": { + "fromJSON": false, + "toJSON": false, + "encode": true, + "decode": true, + "fromPartial": true, + "toAmino": true, + "fromAmino": true, + "fromProto": false, + "toProto": false, + "fromProtoMsg": false, + "toProtoMsg": false, + "toAminoMsg": true, + "fromAminoMsg": true + }, + "addTypeUrlToDecoders": false, + "addTypeUrlToObjects": true, + "addAminoTypeToObjects": true, + "typingsFormat": { + "duration": "duration", + "timestamp": "date", + "useExact": false, + "useDeepPartial": true, + "num64": "bigint", + "customTypes": { + "useCosmosSDKDec": false + }, + "useTelescopeGeneratedType": true, + "autoFixUndefinedEnumDefault": true + } + }, + "bundle": { + "enabled": false + }, + "stargateClients": { + "enabled": false + }, + "lcdClients": { + "enabled": false + }, + "rpcClients": { + "enabled": false + }, + "helperFuncCreators": { + "enabled": true, + "genCustomHooks": true + }, + "interfaces": { + "enabled": true, + "useGlobalDecoderRegistry": true, + "useUnionTypes": true + }, + "aminoEncoding": { + "enabled": true, + "useLegacyInlineEncoding": false, + "disableMsgTypes": false, + "useProtoOptionality": true + } + } +} \ No newline at end of file diff --git a/scripts/interchainjs.telescope.json b/scripts/interchainjs.telescope.json index 0d956ee4..4e07bb84 100644 --- a/scripts/interchainjs.telescope.json +++ b/scripts/interchainjs.telescope.json @@ -60,7 +60,7 @@ }, "helperFuncCreators": { "enabled": true, - "genCustomHooks": true + "genCustomHooks": false }, "interfaces": { "enabled": true,